java with part. login-triggered startCalculation
authorwneuper
Fri, 15 Apr 2005 18:46:34 +0200
changeset 2241b2a210700075
parent 2240 86d38e19c729
child 2242 59b2daf10a6d
java with part. login-triggered startCalculation
src/java/isac/bridge/CalcTree.java
src/java/isac/bridge/MathEngine.java
src/java/isac/gui/WindowApplication.java
src/java/isac/gui/Worksheet.java
src/java/isac/gui/browser/example/ExampleBrowserPanel.java
     1.1 --- a/src/java/isac/bridge/CalcTree.java	Wed Apr 13 15:36:03 2005 +0200
     1.2 +++ b/src/java/isac/bridge/CalcTree.java	Fri Apr 15 18:46:34 2005 +0200
     1.3 @@ -126,7 +126,7 @@
     1.4  	 * TODO simplify CalcHead CalcTree calcTree = (CalcTree) calcTrees.get(new
     1.5  	 * Integer(id));//WN040922 TODO simplify
     1.6  	 * 
     1.7 -	 * if (calcHead.getCalcHeadStatus() != CalcHead.CALCHEAD_CORRECT) { throw
     1.8 +	 * if (calcHead.getCalcHeadStatus() != CalcHead.MODEL_ITEM_CORRECT) { throw
     1.9  	 * new Exception("Startsolving with incorrect CalcHead"); } Tactic t =
    1.10  	 * calcTree.fetchProposedTactic(); if (t.getName().compareTo("Apply_Method") !=
    1.11  	 * 0) { throw new Exception("Startsolving fetches " + t.getName()); } //Next
    1.12 @@ -190,7 +190,7 @@
    1.13  			bridgeRMI_.completeCalcHead(this.id_, calcHead, completeItem);
    1.14  			//WN040924 calcHead.fillValuesfrom(newCalcHead);
    1.15  			//TODO: Remove the following line!!
    1.16 -			calcHead.setCalcHeadStatus(CalcHead.CALCHEAD_CORRECT);
    1.17 +			calcHead.setCalcHeadStatus(CalcHead.MODEL_ITEM_CORRECT);
    1.18  
    1.19  		} catch (RemoteException e) {
    1.20  			e.printStackTrace();
     2.1 --- a/src/java/isac/bridge/MathEngine.java	Wed Apr 13 15:36:03 2005 +0200
     2.2 +++ b/src/java/isac/bridge/MathEngine.java	Fri Apr 15 18:46:34 2005 +0200
     2.3 @@ -138,7 +138,7 @@
     2.4  	 * calcTree = (CalcTree) calcTrees.get(new Integer(id));//WN040922 TODO
     2.5  	 * simplify
     2.6  	 * 
     2.7 -	 * if (calcHead.getCalcHeadStatus() != CalcHead.CALCHEAD_CORRECT) { throw
     2.8 +	 * if (calcHead.getCalcHeadStatus() != CalcHead.MODEL_ITEM_CORRECT) { throw
     2.9  	 * new Exception("Startsolving with incorrect CalcHead"); } Tactic t =
    2.10  	 * calcTree.fetchProposedTactic(); if (t.getName().compareTo("Apply_Method") !=
    2.11  	 * 0) { throw new Exception("Startsolving fetches " + t.getName()); } //Next
    2.12 @@ -171,7 +171,7 @@
    2.13  	 *      bridgeRMI.completeCalcHead(calcHead, completeItem);
    2.14  	 *      bridgeRMI.completeCalcHead(calcHead, completeItem); //WN040924
    2.15  	 *      calcHead.fillValuesfrom(newCalcHead); //TODO: Remove the following
    2.16 -	 *      line!! calcHead.setCalcHeadStatus(CalcHead.CALCHEAD_CORRECT); }
    2.17 +	 *      line!! calcHead.setCalcHeadStatus(CalcHead.MODEL_ITEM_CORRECT); }
    2.18  	 *      catch (RemoteException e) { e.printStackTrace(); } }
    2.19  	 */
    2.20  
     3.1 --- a/src/java/isac/gui/WindowApplication.java	Wed Apr 13 15:36:03 2005 +0200
     3.2 +++ b/src/java/isac/gui/WindowApplication.java	Fri Apr 15 18:46:34 2005 +0200
     3.3 @@ -18,6 +18,7 @@
     3.4  import isac.gui.util.*;
     3.5  import isac.session.SDialog;
     3.6  import isac.util.Formalization;
     3.7 +import isac.util.formulae.CalcHead;
     3.8  import isac.wsdialog.DGuide;
     3.9  
    3.10  import java.awt.*;
    3.11 @@ -40,535 +41,537 @@
    3.12   *  
    3.13   */
    3.14  public class WindowApplication extends JFrame implements ActionListener,
    3.15 -    ILoginListener {
    3.16 -  static Logger logger = Logger.getLogger(WindowApplication.class.getName());
    3.17 +		ILoginListener {
    3.18 +	static Logger logger = Logger.getLogger(WindowApplication.class.getName());
    3.19  
    3.20 -  /** Local settings for the user */
    3.21 -  private Locale locale;
    3.22 +	/** Local settings for the user */
    3.23 +	private Locale locale;
    3.24  
    3.25 -  /** Container for the internal frames, which will contain the worksheets */
    3.26 -  private JDesktopPane worksheetDesktopPane;
    3.27 +	/** Container for the internal frames, which will contain the worksheets */
    3.28 +	private JDesktopPane worksheetDesktopPane;
    3.29  
    3.30 -  private JInternalFrame contentFrame;
    3.31 +	private JInternalFrame contentFrame;
    3.32  
    3.33 -  private JInternalFrame tryMatchFrame;
    3.34 +	private JInternalFrame tryMatchFrame;
    3.35  
    3.36 -  private JInternalFrame tryRefineFrame;
    3.37 +	private JInternalFrame tryRefineFrame;
    3.38  
    3.39 -  private JInternalFrame activeFrame;
    3.40 +	private JInternalFrame activeFrame;
    3.41  
    3.42 -  /** login dialoge */
    3.43 -  private LoginScreen loginScreen;
    3.44 +	/** login dialoge */
    3.45 +	private LoginScreen loginScreen;
    3.46  
    3.47 -  private CalcHeadPanel tryMatchPanel;
    3.48 +	private CalcHeadPanel tryMatchPanel;
    3.49  
    3.50 -  private CalcHeadPanel tryRefinePanel;
    3.51 +	private CalcHeadPanel tryRefinePanel;
    3.52  
    3.53 -  private ContentPanel contentPanel;
    3.54 +	private ContentPanel contentPanel;
    3.55  
    3.56 -  /** Top container that contains all elements of this frame */
    3.57 -  private JSplitPane splitPane;
    3.58 +	/** Top container that contains all elements of this frame */
    3.59 +	private JSplitPane splitPane;
    3.60  
    3.61 -  /** The most recent active worksheet */
    3.62 -  private Worksheet lastActiveWS;
    3.63 +	/** The most recent active worksheet */
    3.64 +	private Worksheet lastActiveWS;
    3.65  
    3.66 -  /** Required to logon a user and to obtain the <code>WSDialog</code> */
    3.67 -  private SDialog sessionDialog;
    3.68 +	/** Required to logon a user and to obtain the <code>WSDialog</code> */
    3.69 +	//private SDialog sessionDialog;//WN050415 unused
    3.70 +	/** Unique sessionId for this WindowApplication */
    3.71 +	private String session_id_;
    3.72  
    3.73 -  /** Unique sessionId for this WindowApplication */
    3.74 -  private String sessionId;
    3.75 +	/** Required to logon a user and to obtain the <code>WSDialog</code> */
    3.76 +	private SDialog session_dialog_;
    3.77  
    3.78 -  private SDialog sdialog;//?WN0502 ?see sessionDialog???
    3.79 +	// LK 04.08.30
    3.80 +	// Menu Buttons
    3.81 +	//left side
    3.82 +	private JButton newWorksheetButton;
    3.83  
    3.84 -  // LK 04.08.30
    3.85 -  // Menu Buttons
    3.86 -  //left side
    3.87 -  private JButton newWorksheetButton;
    3.88 -  
    3.89 -  private JButton exampleBrowserButton;
    3.90 -  
    3.91 -  private JButton problemBrowserButton;
    3.92 +	private JButton exampleBrowserButton;
    3.93  
    3.94 -  private JButton methodBrowserButton;
    3.95 +	private JButton problemBrowserButton;
    3.96  
    3.97 -  private JButton theoryBrowserButton;
    3.98 +	private JButton methodBrowserButton;
    3.99  
   3.100 -  //right side
   3.101 -  private JButton nextStepButton;
   3.102 +	private JButton theoryBrowserButton;
   3.103  
   3.104 -  private JButton autocalcButton;
   3.105 +	//right side
   3.106 +	private JButton nextStepButton;
   3.107  
   3.108 -  private JButton tacticsButton;
   3.109 +	private JButton autocalcButton;
   3.110  
   3.111 -  private ExampleBrowserPanel exampleBrowserPanel;
   3.112 +	private JButton tacticsButton;
   3.113  
   3.114 -  private ProblemBrowserPanel problemBrowserPanel;
   3.115 +	private ExampleBrowserPanel exampleBrowserPanel;
   3.116  
   3.117 -  private MethodBrowserPanel methodBrowserPanel;
   3.118 +	private ProblemBrowserPanel problemBrowserPanel;
   3.119  
   3.120 -  private BrowserWindow exampleBrowserWindow;
   3.121 +	private MethodBrowserPanel methodBrowserPanel;
   3.122  
   3.123 -  private BrowserWindow problemBrowserWindow;
   3.124 +	private BrowserWindow exampleBrowserWindow;
   3.125  
   3.126 -  private BrowserWindow methodBrowserWindow;
   3.127 +	private BrowserWindow problemBrowserWindow;
   3.128  
   3.129 -  private JInternalFrame exampleBrowserFrame;
   3.130 +	private BrowserWindow methodBrowserWindow;
   3.131  
   3.132 -  private JInternalFrame problemBrowserFrame;
   3.133 +	private JInternalFrame exampleBrowserFrame;
   3.134  
   3.135 -  private JInternalFrame methodBrowserFrame;
   3.136 +	private JInternalFrame problemBrowserFrame;
   3.137  
   3.138 -  /**
   3.139 -   * Panel that displays the different "browseable" hierarchies (e.g. the
   3.140 -   * example Browser).
   3.141 -   */
   3.142 -  //private BrowserPanel browserPanel;
   3.143 -  public WindowApplication() {
   3.144 -    locale = Locale.getDefault();
   3.145 +	private JInternalFrame methodBrowserFrame;
   3.146  
   3.147 -    this.setSize(new Dimension(1024, 768));
   3.148 -    Point screenCenter = this.screenCenter();
   3.149 -    this.setLocation(screenCenter);
   3.150 +	/**
   3.151 +	 * Panel that displays the different "browseable" hierarchies (e.g. the
   3.152 +	 * example Browser).
   3.153 +	 */
   3.154 +	//private BrowserPanel browserPanel;
   3.155 +	public WindowApplication() {
   3.156 +		locale = Locale.getDefault();
   3.157  
   3.158 -    Container contentPane = this.getContentPane();
   3.159 -    this.buildMenuBar();
   3.160 +		this.setSize(new Dimension(1024, 768));
   3.161 +		Point screenCenter = this.screenCenter();
   3.162 +		this.setLocation(screenCenter);
   3.163  
   3.164 -    this.createWorksheetPane();
   3.165 -    this.createBrowserPanel();
   3.166 -    this.buildSplitPane();
   3.167 +		Container contentPane = this.getContentPane();
   3.168 +		this.buildMenuBar();
   3.169  
   3.170 -    contentPane.add(splitPane);
   3.171 +		this.createWorksheetPane();
   3.172 +		this.createBrowserPanel();
   3.173 +		this.buildSplitPane();
   3.174  
   3.175 -    JFrame.setDefaultLookAndFeelDecorated(true);
   3.176 -    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   3.177 -    this.hide();
   3.178 +		contentPane.add(splitPane);
   3.179  
   3.180 -    loginScreen = new LoginScreen();
   3.181 -    loginScreen.addListener(this);
   3.182 -    loginScreen.show();
   3.183 -  }
   3.184 +		JFrame.setDefaultLookAndFeelDecorated(true);
   3.185 +		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   3.186 +		this.hide();
   3.187  
   3.188 -  /* LK 04.08.27 */
   3.189 -  /**
   3.190 -   * login mehtod caled from <code>LoginScreen</code> Initialize the remote
   3.191 -   * isac objects <code>ObjectManager</code> and <code>SessionDialog</code>.
   3.192 -   */
   3.193 -  private void login(String username, String password) {
   3.194 -  	logger.fatal("WA->SH: login");
   3.195 -    sessionId = InformationProcessor.login(username, password);
   3.196 -    if (sessionId != null) {
   3.197 -      sdialog = InformationProcessor.getSDialog();
   3.198 -      loginScreen.dispose();
   3.199 -      this.show();
   3.200 -      //openNewWorksheet(DialogGuide.STARTFROM_EMPTY_WORKSHEET, CalcHead.VIEWSTYLE_FULL);
   3.201 -    } else {
   3.202 -      loginScreen.showErrorMsg();
   3.203 -    }
   3.204 -  }
   3.205 +		loginScreen = new LoginScreen();
   3.206 +		loginScreen.addListener(this);
   3.207 +		loginScreen.show();
   3.208 +	}
   3.209  
   3.210 -  /**
   3.211 -   * Create a new DialogGuide that can be connected to a new Worksheet
   3.212 -   */
   3.213 -  private DGuide newDialog() {
   3.214 -  	logger.fatal("WA->SH: newDialog()");
   3.215 -    String dialogId = null;
   3.216 -    DGuide dialog = null;
   3.217 -    try {
   3.218 -      dialogId = sdialog.openDGuide(sessionId);
   3.219 -      dialog = sdialog.getDGuide(dialogId);
   3.220 -    } catch (RemoteException e) {
   3.221 -      logger.error("newDialog", e.detail);
   3.222 -    }
   3.223 -  	logger.fatal("WA<--DG: newDialog <-dialogId="+dialogId);
   3.224 -    return dialog;
   3.225 -  }
   3.226 +	/* LK 04.08.27 */
   3.227 +	/**
   3.228 +	 * login mehtod caled from <code>LoginScreen</code> Initialize the remote
   3.229 +	 * isac objects <code>ObjectManager</code> and <code>SessionDialog</code>.
   3.230 +	 */
   3.231 +	private void login(String username, String password) {
   3.232 +		logger.fatal("WA->SH: login");
   3.233 +		session_id_ = InformationProcessor.login(username, password);
   3.234 +		if (session_id_ != null) {
   3.235 +			session_dialog_ = InformationProcessor.getSDialog();
   3.236 +			loginScreen.dispose();
   3.237 +			this.show();
   3.238 +			//openNewWorksheet(DialogGuide.STARTFROM_EMPTY_WORKSHEET,
   3.239 +			// CalcHead.VIEWSTYLE_FULL);
   3.240 +		} else {
   3.241 +			loginScreen.showErrorMsg();
   3.242 +		}
   3.243 +	}
   3.244  
   3.245 -  //---------- Load the different hierarchies---------------------------
   3.246 +	/**
   3.247 +	 * Create a new DialogGuide that can be connected to a new Worksheet
   3.248 +	 */
   3.249 +	private DGuide newDialog() {
   3.250 +		logger.fatal("WA->SH: newDialog()");
   3.251 +		String dialog_id = null;
   3.252 +		DGuide dialog = null;
   3.253 +		try {
   3.254 +			dialog_id = session_dialog_.openDGuide(session_id_);
   3.255 +			dialog = session_dialog_.getDGuide(dialog_id);
   3.256 +		} catch (RemoteException e) {
   3.257 +			logger.error("newDialog", e.detail);
   3.258 +		}
   3.259 +		logger.fatal("WA<--DG: newDialog <-dialogId=" + dialog_id);
   3.260 +		return dialog;
   3.261 +	}
   3.262  
   3.263 -  private Hierarchy loadExpHierarchy() {
   3.264 -    String dummy = InformationProcessor.loadHierarchy(sessionId, "exp");
   3.265 -    System.out.println("WN##### loadExpHierarchy, dummy=" + dummy);
   3.266 -    XMLExampleParser expParser = new XMLExampleParser(dummy);
   3.267 -    Node root = expParser.getRoot();
   3.268 -    Hierarchy hierarchy = expParser.createExampleNodesHierarchy(root);
   3.269 -    return hierarchy;
   3.270 -  }
   3.271 +	//---------- Load the different hierarchies---------------------------
   3.272  
   3.273 -  private Hierarchy loadPblHierarchy() {
   3.274 -    String dummy = InformationProcessor.loadHierarchy(sessionId, "pbl");
   3.275 -    XMLProblemParser pblParser = new XMLProblemParser(dummy);
   3.276 -    Node root = pblParser.getRoot();
   3.277 -    Hierarchy hierarchy = pblParser.createProblemNodesHierarchy(root);
   3.278 -    return hierarchy;
   3.279 -  }
   3.280 +	private Hierarchy loadExpHierarchy() {
   3.281 +		String dummy = InformationProcessor.loadHierarchy(session_id_, "exp");
   3.282 +		System.out.println("WN##### loadExpHierarchy, dummy=" + dummy);
   3.283 +		XMLExampleParser expParser = new XMLExampleParser(dummy);
   3.284 +		Node root = expParser.getRoot();
   3.285 +		Hierarchy hierarchy = expParser.createExampleNodesHierarchy(root);
   3.286 +		return hierarchy;
   3.287 +	}
   3.288  
   3.289 -  private Hierarchy loadMetHierarchy() {
   3.290 -    String dummy = InformationProcessor.loadHierarchy(sessionId, "met");
   3.291 -    XMLMethodParser metParser = new XMLMethodParser(dummy);
   3.292 -    Node root = metParser.getRoot();
   3.293 -    Hierarchy hierarchy = metParser.createMethodNodesHierarchy(root);
   3.294 -    return hierarchy;
   3.295 -  }
   3.296 +	private Hierarchy loadPblHierarchy() {
   3.297 +		String dummy = InformationProcessor.loadHierarchy(session_id_, "pbl");
   3.298 +		XMLProblemParser pblParser = new XMLProblemParser(dummy);
   3.299 +		Node root = pblParser.getRoot();
   3.300 +		Hierarchy hierarchy = pblParser.createProblemNodesHierarchy(root);
   3.301 +		return hierarchy;
   3.302 +	}
   3.303  
   3.304 -  private void buildMenuBar() {
   3.305 +	private Hierarchy loadMetHierarchy() {
   3.306 +		String dummy = InformationProcessor.loadHierarchy(session_id_, "met");
   3.307 +		XMLMethodParser metParser = new XMLMethodParser(dummy);
   3.308 +		Node root = metParser.getRoot();
   3.309 +		Hierarchy hierarchy = metParser.createMethodNodesHierarchy(root);
   3.310 +		return hierarchy;
   3.311 +	}
   3.312  
   3.313 -    JMenuBar menuBar = new JMenuBar();
   3.314 +	private void buildMenuBar() {
   3.315  
   3.316 -    //left side
   3.317 -    newWorksheetButton = new JButton("NEW");
   3.318 -    newWorksheetButton.setName("New");
   3.319 -    newWorksheetButton.addActionListener(this);
   3.320 -    exampleBrowserButton = new JButton("Examples");
   3.321 -    exampleBrowserButton.setName("Examples");
   3.322 -    exampleBrowserButton.addActionListener(this);
   3.323 -    problemBrowserButton = new JButton("Problems");
   3.324 -    problemBrowserButton.setName("Problems");
   3.325 -    problemBrowserButton.addActionListener(this);
   3.326 -    methodBrowserButton = new JButton("Methods");
   3.327 -    methodBrowserButton.setName("Methods");
   3.328 -    methodBrowserButton.addActionListener(this);
   3.329 -    theoryBrowserButton = new JButton("Theories");
   3.330 -    theoryBrowserButton.setName("Theories");
   3.331 -    theoryBrowserButton.addActionListener(this);
   3.332 +		JMenuBar menuBar = new JMenuBar();
   3.333  
   3.334 -    
   3.335 -    //right side
   3.336 -    nextStepButton = new JButton("Next");
   3.337 -    nextStepButton.setName("Next");
   3.338 -    nextStepButton.addActionListener(this);
   3.339 -    autocalcButton = new JButton("Auto");
   3.340 -    autocalcButton.setName("Auto");
   3.341 -    autocalcButton.addActionListener(this);
   3.342 -    tacticsButton = new JButton("Tactics");
   3.343 -    tacticsButton.setName("Tactics");
   3.344 -    tacticsButton.addActionListener(this);
   3.345 +		//left side
   3.346 +		newWorksheetButton = new JButton("NEW");
   3.347 +		newWorksheetButton.setName("New");
   3.348 +		newWorksheetButton.addActionListener(this);
   3.349 +		exampleBrowserButton = new JButton("Examples");
   3.350 +		exampleBrowserButton.setName("Examples");
   3.351 +		exampleBrowserButton.addActionListener(this);
   3.352 +		problemBrowserButton = new JButton("Problems");
   3.353 +		problemBrowserButton.setName("Problems");
   3.354 +		problemBrowserButton.addActionListener(this);
   3.355 +		methodBrowserButton = new JButton("Methods");
   3.356 +		methodBrowserButton.setName("Methods");
   3.357 +		methodBrowserButton.addActionListener(this);
   3.358 +		theoryBrowserButton = new JButton("Theories");
   3.359 +		theoryBrowserButton.setName("Theories");
   3.360 +		theoryBrowserButton.addActionListener(this);
   3.361  
   3.362 -    //add left menu buttons
   3.363 -    menuBar.add(newWorksheetButton);
   3.364 -    menuBar.add(exampleBrowserButton);
   3.365 -    menuBar.add(problemBrowserButton);
   3.366 -    menuBar.add(methodBrowserButton);
   3.367 -    menuBar.add(theoryBrowserButton);
   3.368 -    //seperate
   3.369 -    menuBar.add(new JLabel("              "));
   3.370 -    menuBar.add(new JLabel("              "));
   3.371 -    menuBar.add(new JLabel("              "));
   3.372 -    menuBar.add(new JLabel("              "));
   3.373 -    menuBar.add(new JLabel("              "));
   3.374 -    menuBar.add(new JLabel("              "));
   3.375 -    //add right menu buttons
   3.376 -    menuBar.add(nextStepButton);
   3.377 -    menuBar.add(autocalcButton);
   3.378 -    menuBar.add(tacticsButton);
   3.379 +		//right side
   3.380 +		nextStepButton = new JButton("Next");
   3.381 +		nextStepButton.setName("Next");
   3.382 +		nextStepButton.addActionListener(this);
   3.383 +		autocalcButton = new JButton("Auto");
   3.384 +		autocalcButton.setName("Auto");
   3.385 +		autocalcButton.addActionListener(this);
   3.386 +		tacticsButton = new JButton("Tactics");
   3.387 +		tacticsButton.setName("Tactics");
   3.388 +		tacticsButton.addActionListener(this);
   3.389  
   3.390 -    this.setJMenuBar(menuBar);
   3.391 -  }
   3.392 +		//add left menu buttons
   3.393 +		menuBar.add(newWorksheetButton);
   3.394 +		menuBar.add(exampleBrowserButton);
   3.395 +		menuBar.add(problemBrowserButton);
   3.396 +		menuBar.add(methodBrowserButton);
   3.397 +		menuBar.add(theoryBrowserButton);
   3.398 +		//seperate
   3.399 +		menuBar.add(new JLabel("              "));
   3.400 +		menuBar.add(new JLabel("              "));
   3.401 +		menuBar.add(new JLabel("              "));
   3.402 +		menuBar.add(new JLabel("              "));
   3.403 +		menuBar.add(new JLabel("              "));
   3.404 +		menuBar.add(new JLabel("              "));
   3.405 +		//add right menu buttons
   3.406 +		menuBar.add(nextStepButton);
   3.407 +		menuBar.add(autocalcButton);
   3.408 +		menuBar.add(tacticsButton);
   3.409  
   3.410 -  private void createBrowserPanel() {
   3.411 -    exampleBrowserPanel = new ExampleBrowserPanel(this, loadExpHierarchy());
   3.412 -    exampleBrowserWindow = new BrowserWindow(exampleBrowserPanel);
   3.413 -    exampleBrowserFrame = createInternalFrame("Example Browser", false, true,
   3.414 -                                              false, false);
   3.415 -    exampleBrowserFrame.getContentPane().add(exampleBrowserWindow);
   3.416 -    //    this.addInternalFrame(exampleBrowserFrame);
   3.417 -    //    exampleBrowserFrame.pack();
   3.418 -    //    exampleBrowserFrame.hide();
   3.419 +		this.setJMenuBar(menuBar);
   3.420 +	}
   3.421  
   3.422 -    problemBrowserPanel = new ProblemBrowserPanel(this, loadPblHierarchy());
   3.423 -    problemBrowserWindow = new BrowserWindow(problemBrowserPanel);
   3.424 -    problemBrowserFrame = createInternalFrame("Problem Browser", false, true,
   3.425 -                                              false, false);
   3.426 -    problemBrowserFrame.getContentPane().add(problemBrowserWindow);
   3.427 -    //    this.addInternalFrame(problemBrowserFrame);
   3.428 -    //    problemBrowserFrame.pack();
   3.429 -    //    problemBrowserFrame.hide();
   3.430 +	private void createBrowserPanel() {
   3.431 +		exampleBrowserPanel = new ExampleBrowserPanel(this, loadExpHierarchy());
   3.432 +		exampleBrowserWindow = new BrowserWindow(exampleBrowserPanel);
   3.433 +		exampleBrowserFrame = createInternalFrame("Example Browser", false,
   3.434 +				true, false, false);
   3.435 +		exampleBrowserFrame.getContentPane().add(exampleBrowserWindow);
   3.436 +		//    this.addInternalFrame(exampleBrowserFrame);
   3.437 +		//    exampleBrowserFrame.pack();
   3.438 +		//    exampleBrowserFrame.hide();
   3.439  
   3.440 -    methodBrowserPanel = new MethodBrowserPanel(this, loadMetHierarchy());
   3.441 -    methodBrowserWindow = new BrowserWindow(methodBrowserPanel);
   3.442 -    methodBrowserFrame = createInternalFrame("Method Browser", false, true,
   3.443 -                                             false, false);
   3.444 -    methodBrowserFrame.getContentPane().add(methodBrowserWindow);
   3.445 -    //    this.addInternalFrame(methodBrowserFrame);
   3.446 -    //    methodBrowserFrame.pack();
   3.447 -    //    methodBrowserFrame.hide();
   3.448 -  }
   3.449 +		problemBrowserPanel = new ProblemBrowserPanel(this, loadPblHierarchy());
   3.450 +		problemBrowserWindow = new BrowserWindow(problemBrowserPanel);
   3.451 +		problemBrowserFrame = createInternalFrame("Problem Browser", false,
   3.452 +				true, false, false);
   3.453 +		problemBrowserFrame.getContentPane().add(problemBrowserWindow);
   3.454 +		//    this.addInternalFrame(problemBrowserFrame);
   3.455 +		//    problemBrowserFrame.pack();
   3.456 +		//    problemBrowserFrame.hide();
   3.457  
   3.458 -  /**
   3.459 -   * Open a new Worksheet and start the modeling and specification phase.
   3.460 -   * 
   3.461 -   * @param f
   3.462 -   *          Formalization (can be empty see UC 2.5.4) that the math engine
   3.463 -   *          needs to start a calculation
   3.464 -   * @param source
   3.465 -   *          Source of the Formalization (e.g. ExampleHierarchy or from
   3.466 -   *          Scratch)
   3.467 -   * @param type
   3.468 -   *          Requested ViewType for the CalcHead
   3.469 -   */
   3.470 -  public void openNewWorksheetWithCalchead(final Formalization f,
   3.471 -                                           final int source, final int type) {
   3.472 -    JInternalFrame internalFrame = createInternalFrame("Worksheet", true, true,
   3.473 -                                                       true, false);
   3.474 -    internalFrame.getContentPane().setLayout(new BorderLayout());
   3.475 -    final DGuide dialog = newDialog();
   3.476 +		methodBrowserPanel = new MethodBrowserPanel(this, loadMetHierarchy());
   3.477 +		methodBrowserWindow = new BrowserWindow(methodBrowserPanel);
   3.478 +		methodBrowserFrame = createInternalFrame("Method Browser", false, true,
   3.479 +				false, false);
   3.480 +		methodBrowserFrame.getContentPane().add(methodBrowserWindow);
   3.481 +		//    this.addInternalFrame(methodBrowserFrame);
   3.482 +		//    methodBrowserFrame.pack();
   3.483 +		//    methodBrowserFrame.hide();
   3.484 +	}
   3.485  
   3.486 -    final SwingWorker worker = new SwingWorker() {
   3.487 -      public Object construct() {
   3.488 -        Worksheet ws = new Worksheet(locale, dialog, f, source, type);
   3.489 -        return ws;
   3.490 -      }
   3.491 +	/**
   3.492 +	 * Open a new Worksheet and start the modeling and specification phase.
   3.493 +	 * 
   3.494 +	 * @param f
   3.495 +	 *            Formalization (can be empty see UC 2.5.4) that the math engine
   3.496 +	 *            needs to start a calculation
   3.497 +	 * @param source
   3.498 +	 *            Source of the Formalization (e.g. ExampleHierarchy or from
   3.499 +	 *            Scratch)
   3.500 +	 * @param type
   3.501 +	 *            Requested ViewType for the CalcHead
   3.502 +	 * @throws RemoteException
   3.503 +	 */
   3.504 +	public void openNewWorksheet(final Formalization f, final int source)
   3.505 +			throws RemoteException {
   3.506 +		JInternalFrame internalFrame = createInternalFrame("Worksheet", true,
   3.507 +				true, true, false);
   3.508 +		internalFrame.getContentPane().setLayout(new BorderLayout());
   3.509 +		final DGuide dialog = newDialog();
   3.510 +		
   3.511 +		final SwingWorker worker = new SwingWorker() {
   3.512 +			public Object construct() {
   3.513 +				Worksheet ws = new Worksheet(locale, dialog, f, source);
   3.514 +				return ws;
   3.515 +			}
   3.516  
   3.517 -      public void finished() {
   3.518 -        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   3.519 -      }
   3.520 -    };
   3.521 -    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   3.522 -    worker.start();
   3.523 -    internalFrame.getContentPane().add((Worksheet) worker.get(),
   3.524 -                                       BorderLayout.CENTER);
   3.525 -    int width, height = 0;
   3.526 -    height = internalFrame.getPreferredSize().height;
   3.527 -    width = internalFrame.getPreferredSize().width;
   3.528 -    height = height < 300 ? 300 : height;
   3.529 -    width = width < 600 ? 600 : width;
   3.530 -    internalFrame.setPreferredSize(new Dimension(width, height));
   3.531 -    internalFrame.pack();
   3.532 -    internalFrame.setVisible(true);
   3.533 -    this.addInternalFrame(internalFrame);
   3.534 -  }
   3.535 +			public void finished() {
   3.536 +				setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   3.537 +			}
   3.538 +		};
   3.539 +		this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   3.540 +		worker.start();
   3.541 +		internalFrame.getContentPane().add((Worksheet) worker.get(),
   3.542 +				BorderLayout.CENTER);
   3.543 +		int width, height = 0;
   3.544 +		height = internalFrame.getPreferredSize().height;
   3.545 +		width = internalFrame.getPreferredSize().width;
   3.546 +		height = height < 300 ? 300 : height;
   3.547 +		width = width < 600 ? 600 : width;
   3.548 +		internalFrame.setPreferredSize(new Dimension(width, height));
   3.549 +		internalFrame.pack();
   3.550 +		internalFrame.setVisible(true);
   3.551 +		this.addInternalFrame(internalFrame);
   3.552 +	}
   3.553  
   3.554 -  /**
   3.555 -   * ?WN0502:
   3.556 -   * opens an empty worksheet with an (empty) headline
   3.557 -   * to be filled with an 'algebra-system-command'
   3.558 -   * 
   3.559 -   * @param <paramname> <paramdescription>
   3.560 -   * @return <return value>
   3.561 -   * @see {openNewWorksheetWithCalchead}
   3.562 -   */
   3.563 -  public void openNewWorksheet(final int source, final int type) {
   3.564 -    final Formalization f = new Formalization();
   3.565 -    JInternalFrame internalFrame = createInternalFrame("Worksheet", true, true,
   3.566 -                                                       true, false);
   3.567 -    internalFrame.getContentPane().setLayout(new BorderLayout());
   3.568 -    final DGuide dialog = newDialog();
   3.569 +	/**
   3.570 +	 * opens an empty worksheet either (1) with an (empty) headline to be filled
   3.571 +	 * with an 'algebra-system-command' or (2) with an empty CalcHeadPanel,
   3.572 +	 * (1,2) depending on the DialogGuide
   3.573 +	 * 
   3.574 +	 * @param <paramname>
   3.575 +	 *            <paramdescription>
   3.576 +	 * @return <return value>
   3.577 +	 * @see {openNewWorksheetWithCalchead}
   3.578 +	 */
   3.579 +	public void openBlankWorksheet(final int source, final int type) {
   3.580 +		final Formalization f = new Formalization();
   3.581 +		JInternalFrame internalFrame = createInternalFrame("Worksheet", true,
   3.582 +				true, true, false);
   3.583 +		internalFrame.getContentPane().setLayout(new BorderLayout());
   3.584 +		final DGuide dialog = newDialog();
   3.585  
   3.586 -    final SwingWorker worker = new SwingWorker() {
   3.587 -      public Object construct() {
   3.588 -        Worksheet ws = new Worksheet(locale, dialog, f, source, type);
   3.589 -        return ws;
   3.590 -      }
   3.591 +		final SwingWorker worker = new SwingWorker() {
   3.592 +			public Object construct() {
   3.593 +				Worksheet ws = new Worksheet(locale, dialog, f, source);
   3.594 +				return ws;
   3.595 +			}
   3.596  
   3.597 -      public void finished() {
   3.598 -        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   3.599 -      }
   3.600 -    };
   3.601 -    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   3.602 -    worker.start();
   3.603 -    internalFrame.getContentPane().add((Worksheet) worker.get(),
   3.604 -                                       BorderLayout.CENTER);
   3.605 -    int width, height = 0;
   3.606 -    height = internalFrame.getPreferredSize().height;
   3.607 -    width = internalFrame.getPreferredSize().width;
   3.608 -    height = height < 300 ? 300 : height;
   3.609 -    width = width < 600 ? 600 : width;
   3.610 -    internalFrame.setPreferredSize(new Dimension(width, height));
   3.611 -    internalFrame.pack();
   3.612 -    internalFrame.setVisible(true);
   3.613 -    this.addInternalFrame(internalFrame);
   3.614 -  }
   3.615 +			public void finished() {
   3.616 +				setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   3.617 +			}
   3.618 +		};
   3.619 +		this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   3.620 +		worker.start();
   3.621 +		internalFrame.getContentPane().add((Worksheet) worker.get(),
   3.622 +				BorderLayout.CENTER);
   3.623 +		int width, height = 0;
   3.624 +		height = internalFrame.getPreferredSize().height;
   3.625 +		width = internalFrame.getPreferredSize().width;
   3.626 +		height = height < 300 ? 300 : height;
   3.627 +		width = width < 600 ? 600 : width;
   3.628 +		internalFrame.setPreferredSize(new Dimension(width, height));
   3.629 +		internalFrame.pack();
   3.630 +		internalFrame.setVisible(true);
   3.631 +		this.addInternalFrame(internalFrame);
   3.632 +	}
   3.633  
   3.634 -  //  public void openCalcHeadInWS(CalcHead ch) {
   3.635 -  //    if (activeFrame.getContentPane().getComponentCount() == 1) {
   3.636 -  //      CalcHeadPanel chp = new CalcHeadPanel(this, locale, ch, lastActiveWS);
   3.637 -  //      activeFrame.getContentPane().add(chp, BorderLayout.NORTH);
   3.638 -  //    } else if (activeFrame.getContentPane().getComponentCount() == 2) {
   3.639 -  //      CalcHeadPanel chp =
   3.640 -  // (CalcHeadPanel)activeFrame.getContentPane().getComponent(1);
   3.641 -  //      chp.setCalcHead(ch);
   3.642 -  //    }
   3.643 -  //    activeFrame.validate();
   3.644 -  //  }
   3.645 +	//  public void openCalcHeadInWS(CalcHead ch) {
   3.646 +	//    if (activeFrame.getContentPane().getComponentCount() == 1) {
   3.647 +	//      CalcHeadPanel chp = new CalcHeadPanel(this, locale, ch, lastActiveWS);
   3.648 +	//      activeFrame.getContentPane().add(chp, BorderLayout.NORTH);
   3.649 +	//    } else if (activeFrame.getContentPane().getComponentCount() == 2) {
   3.650 +	//      CalcHeadPanel chp =
   3.651 +	// (CalcHeadPanel)activeFrame.getContentPane().getComponent(1);
   3.652 +	//      chp.setCalcHead(ch);
   3.653 +	//    }
   3.654 +	//    activeFrame.validate();
   3.655 +	//  }
   3.656  
   3.657 -  private JInternalFrame createInternalFrame(String title, boolean resizable,
   3.658 -                                             boolean closable,
   3.659 -                                             boolean maximizable,
   3.660 -                                             boolean iconifiable) {
   3.661 -    JInternalFrame internalFrame = new JInternalFrame(title, resizable,
   3.662 -        closable, maximizable, iconifiable);
   3.663 -    return internalFrame;
   3.664 -  }
   3.665 +	private JInternalFrame createInternalFrame(String title, boolean resizable,
   3.666 +			boolean closable, boolean maximizable, boolean iconifiable) {
   3.667 +		JInternalFrame internalFrame = new JInternalFrame(title, resizable,
   3.668 +				closable, maximizable, iconifiable);
   3.669 +		return internalFrame;
   3.670 +	}
   3.671  
   3.672 -  private void createWorksheetPane() {
   3.673 -    worksheetDesktopPane = new JDesktopPane();
   3.674 -    Dimension d = new Dimension();
   3.675 -    d.setSize(this.getWidth() * 0.60, 0.0);
   3.676 -    worksheetDesktopPane.setMinimumSize(d);
   3.677 -    worksheetDesktopPane.setDesktopManager(new DefaultDesktopManager() {
   3.678 -      public void activateFrame(JInternalFrame jif) {
   3.679 -        super.activateFrame(jif);
   3.680 -        activeFrame = jif;
   3.681 -      }
   3.682 -    });
   3.683 -    // "ghost frame" dragging; very fast but weired for some user
   3.684 -    worksheetDesktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
   3.685 -  }
   3.686 +	private void createWorksheetPane() {
   3.687 +		worksheetDesktopPane = new JDesktopPane();
   3.688 +		Dimension d = new Dimension();
   3.689 +		d.setSize(this.getWidth() * 0.60, 0.0);
   3.690 +		worksheetDesktopPane.setMinimumSize(d);
   3.691 +		worksheetDesktopPane.setDesktopManager(new DefaultDesktopManager() {
   3.692 +			public void activateFrame(JInternalFrame jif) {
   3.693 +				super.activateFrame(jif);
   3.694 +				activeFrame = jif;
   3.695 +			}
   3.696 +		});
   3.697 +		// "ghost frame" dragging; very fast but weired for some user
   3.698 +		worksheetDesktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
   3.699 +	}
   3.700  
   3.701 -  /**
   3.702 -   * Get the currently active Worksheet (which has the cursor).
   3.703 -   * 
   3.704 -   * @return The active Worksheet.
   3.705 -   */
   3.706 -  public Worksheet getActiveWorksheet() {
   3.707 -    // assumes that the first component is the worksheet
   3.708 -    if (activeFrame != null) {
   3.709 -      Component comp = activeFrame.getContentPane().getComponent(0);
   3.710 -      if (comp instanceof Worksheet) {
   3.711 -        lastActiveWS = (Worksheet) comp;
   3.712 -      }
   3.713 -    }
   3.714 -    return lastActiveWS;
   3.715 -  }
   3.716 +	/**
   3.717 +	 * Get the currently active Worksheet (which has the cursor).
   3.718 +	 * 
   3.719 +	 * @return The active Worksheet.
   3.720 +	 */
   3.721 +	public Worksheet getActiveWorksheet() {
   3.722 +		// assumes that the first component is the worksheet
   3.723 +		if (activeFrame != null) {
   3.724 +			Component comp = activeFrame.getContentPane().getComponent(0);
   3.725 +			if (comp instanceof Worksheet) {
   3.726 +				lastActiveWS = (Worksheet) comp;
   3.727 +			}
   3.728 +		}
   3.729 +		return lastActiveWS;
   3.730 +	}
   3.731  
   3.732 -  private void buildSplitPane() {
   3.733 -    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
   3.734 -    //splitPane.setLeftComponent(browserPanel);
   3.735 -    splitPane.setRightComponent(worksheetDesktopPane);
   3.736 -    splitPane.setOneTouchExpandable(true);
   3.737 -    splitPane.setDividerLocation(250);
   3.738 -  }
   3.739 +	private void buildSplitPane() {
   3.740 +		splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
   3.741 +		//splitPane.setLeftComponent(browserPanel);
   3.742 +		splitPane.setRightComponent(worksheetDesktopPane);
   3.743 +		splitPane.setOneTouchExpandable(true);
   3.744 +		splitPane.setDividerLocation(250);
   3.745 +	}
   3.746  
   3.747 -  private Point screenCenter() {
   3.748 -    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   3.749 -    int midX = screenSize.width / 2 - this.getWidth() / 2;
   3.750 -    int midY = screenSize.height / 2 - this.getHeight() / 2;
   3.751 -    return new Point(midX, midY);
   3.752 -  }
   3.753 +	private Point screenCenter() {
   3.754 +		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   3.755 +		int midX = screenSize.width / 2 - this.getWidth() / 2;
   3.756 +		int midY = screenSize.height / 2 - this.getHeight() / 2;
   3.757 +		return new Point(midX, midY);
   3.758 +	}
   3.759  
   3.760 -  private void addInternalFrame(JInternalFrame frame) {
   3.761 -    worksheetDesktopPane.add(frame);
   3.762 -    worksheetDesktopPane.getDesktopManager().activateFrame(frame);
   3.763 -    frame.toFront();
   3.764 -    frame.grabFocus();
   3.765 -  }
   3.766 +	private void addInternalFrame(JInternalFrame frame) {
   3.767 +		worksheetDesktopPane.add(frame);
   3.768 +		worksheetDesktopPane.getDesktopManager().activateFrame(frame);
   3.769 +		frame.toFront();
   3.770 +		frame.grabFocus();
   3.771 +	}
   3.772  
   3.773 -  /**
   3.774 -   * Get the session id of the current connection.
   3.775 -   * 
   3.776 -   * @return Systemwide unique session id
   3.777 -   */
   3.778 -  public String getSessionId() {
   3.779 -    return sessionId;
   3.780 -  }
   3.781 +	/**
   3.782 +	 * Get the session id of the current connection.
   3.783 +	 * 
   3.784 +	 * @return Systemwide unique session id
   3.785 +	 */
   3.786 +	public String getSessionId() {
   3.787 +		return session_id_;
   3.788 +	}
   3.789  
   3.790 -  /**
   3.791 -   * Get the content Panel.
   3.792 -   * 
   3.793 -   * @return ContentPanel
   3.794 -   */
   3.795 -  public ContentPanel getContentPanel() {
   3.796 -    if (contentPanel == null) {
   3.797 -      this.contentPanel = new ContentPanel(sessionId);
   3.798 -    }
   3.799 -    return contentPanel;
   3.800 -  }
   3.801 +	/**
   3.802 +	 * Get the content Panel.
   3.803 +	 * 
   3.804 +	 * @return ContentPanel
   3.805 +	 */
   3.806 +	public ContentPanel getContentPanel() {
   3.807 +		if (contentPanel == null) {
   3.808 +			this.contentPanel = new ContentPanel(session_id_);
   3.809 +		}
   3.810 +		return contentPanel;
   3.811 +	}
   3.812  
   3.813 -  /**
   3.814 -   * Get the currently used locale.
   3.815 -   * 
   3.816 -   * @return currently used locale.
   3.817 -   */
   3.818 -  public Locale getLocale() {
   3.819 -    return locale;
   3.820 -  }
   3.821 +	/**
   3.822 +	 * Get the currently used locale.
   3.823 +	 * 
   3.824 +	 * @return currently used locale.
   3.825 +	 */
   3.826 +	public Locale getLocale() {
   3.827 +		return locale;
   3.828 +	}
   3.829  
   3.830 -  /**
   3.831 -   * Show the content frame which includes a window that shows the content of a
   3.832 -   * selected entry in the hierarchy.
   3.833 -   */
   3.834 -  public void showContentFrame() {
   3.835 -    if (contentFrame == null) {
   3.836 -      contentFrame = new JInternalFrame("Content Window", true, true, true);
   3.837 -      this.addInternalFrame(contentFrame);
   3.838 -      contentFrame.getContentPane().add(contentPanel, BorderLayout.CENTER);
   3.839 -      contentFrame.pack();
   3.840 -      contentFrame.setVisible(true);
   3.841 -    } else if (!contentFrame.isVisible()) {
   3.842 -      this.addInternalFrame(contentFrame);
   3.843 -      contentFrame.setVisible(true);
   3.844 -    }
   3.845 -  }
   3.846 +	/**
   3.847 +	 * Show the content frame which includes a window that shows the content of
   3.848 +	 * a selected entry in the hierarchy.
   3.849 +	 */
   3.850 +	public void showContentFrame() {
   3.851 +		if (contentFrame == null) {
   3.852 +			contentFrame = new JInternalFrame("Content Window", true, true,
   3.853 +					true);
   3.854 +			this.addInternalFrame(contentFrame);
   3.855 +			contentFrame.getContentPane()
   3.856 +					.add(contentPanel, BorderLayout.CENTER);
   3.857 +			contentFrame.pack();
   3.858 +			contentFrame.setVisible(true);
   3.859 +		} else if (!contentFrame.isVisible()) {
   3.860 +			this.addInternalFrame(contentFrame);
   3.861 +			contentFrame.setVisible(true);
   3.862 +		}
   3.863 +	}
   3.864  
   3.865 -  //----------ActionListener----------------------------------------
   3.866 +	//----------ActionListener----------------------------------------
   3.867  
   3.868 -  public void actionPerformed(ActionEvent e) {
   3.869 -    if (e.getSource() == problemBrowserButton) {
   3.870 -      if (!problemBrowserFrame.isVisible()) {
   3.871 -        problemBrowserFrame.setSize(300, 650);
   3.872 -        problemBrowserFrame.setLocation(700, 0);
   3.873 -        this.addInternalFrame(problemBrowserFrame);
   3.874 -        problemBrowserFrame.show();
   3.875 -      }
   3.876 -    } else if (e.getSource() == newWorksheetButton) {
   3.877 -      JOptionPane.showMessageDialog(this, "not yet implemented");
   3.878 -    } else if (e.getSource() == exampleBrowserButton) {
   3.879 -      if (!exampleBrowserFrame.isVisible()) {
   3.880 -        exampleBrowserFrame.setSize(300, 650);
   3.881 -        exampleBrowserFrame.setLocation(700, 0);
   3.882 -        this.addInternalFrame(exampleBrowserFrame);
   3.883 -        exampleBrowserFrame.show();
   3.884 -      }
   3.885 -    } else if (e.getSource() == methodBrowserButton) {
   3.886 -      if (!methodBrowserFrame.isVisible()) {
   3.887 -        methodBrowserFrame.setSize(300, 650);
   3.888 -        methodBrowserFrame.setLocation(700, 0);
   3.889 -        this.addInternalFrame(methodBrowserFrame);
   3.890 -        methodBrowserFrame.show();
   3.891 -      }
   3.892 -    } else if (e.getSource() == theoryBrowserButton) {
   3.893 -      JOptionPane.showMessageDialog(this, "not yet implemented");
   3.894 -    } else if (e.getSource() == nextStepButton) {
   3.895 -      getActiveWorksheet().nextStep();
   3.896 -    } else if (e.getSource() == autocalcButton) {
   3.897 -      getActiveWorksheet().autoCalc();
   3.898 -    } else if (e.getSource() == tacticsButton) {
   3.899 -      JOptionPane.showMessageDialog(this, "not yet implemented");
   3.900 -    } else { //invalid source
   3.901 -      logger.error("invalid source for ActionEvent");
   3.902 -    }
   3.903 -    //    Formalization f = new Formalization();
   3.904 -    //    openNewWorksheet(f, DialogGuide.STARTFROM_EMPTY_WORKSHEET,
   3.905 -    // CalcHead.VIEWSTYLE_SIMPLE_SOLVE);
   3.906 -  }
   3.907 +	public void actionPerformed(ActionEvent e) {
   3.908 +		if (e.getSource() == problemBrowserButton) {
   3.909 +			if (!problemBrowserFrame.isVisible()) {
   3.910 +				problemBrowserFrame.setSize(300, 650);
   3.911 +				problemBrowserFrame.setLocation(700, 0);
   3.912 +				this.addInternalFrame(problemBrowserFrame);
   3.913 +				problemBrowserFrame.show();
   3.914 +			}
   3.915 +		} else if (e.getSource() == newWorksheetButton) {
   3.916 +			JOptionPane.showMessageDialog(this, "not yet implemented");
   3.917 +		} else if (e.getSource() == exampleBrowserButton) {
   3.918 +			if (!exampleBrowserFrame.isVisible()) {
   3.919 +				exampleBrowserFrame.setSize(300, 650);
   3.920 +				exampleBrowserFrame.setLocation(700, 0);
   3.921 +				this.addInternalFrame(exampleBrowserFrame);
   3.922 +				exampleBrowserFrame.show();
   3.923 +			}
   3.924 +		} else if (e.getSource() == methodBrowserButton) {
   3.925 +			if (!methodBrowserFrame.isVisible()) {
   3.926 +				methodBrowserFrame.setSize(300, 650);
   3.927 +				methodBrowserFrame.setLocation(700, 0);
   3.928 +				this.addInternalFrame(methodBrowserFrame);
   3.929 +				methodBrowserFrame.show();
   3.930 +			}
   3.931 +		} else if (e.getSource() == theoryBrowserButton) {
   3.932 +			JOptionPane.showMessageDialog(this, "not yet implemented");
   3.933 +		} else if (e.getSource() == nextStepButton) {
   3.934 +			getActiveWorksheet().nextStep();
   3.935 +		} else if (e.getSource() == autocalcButton) {
   3.936 +			getActiveWorksheet().autoCalc();
   3.937 +		} else if (e.getSource() == tacticsButton) {
   3.938 +			JOptionPane.showMessageDialog(this, "not yet implemented");
   3.939 +		} else { //invalid source
   3.940 +			logger.error("invalid source for ActionEvent");
   3.941 +		}
   3.942 +		//    Formalization f = new Formalization();
   3.943 +		//    openNewWorksheet(f, DialogGuide.STARTFROM_EMPTY_WORKSHEET,
   3.944 +		// CalcHead.VIEWSTYLE_SIMPLE_SOLVE);
   3.945 +	}
   3.946  
   3.947 -  public static void main(String[] args) {
   3.948 +	public static void main(String[] args) {
   3.949  
   3.950 -    SwingUtilities.invokeLater(new Runnable() {
   3.951 -      public void run() {
   3.952 -        WindowApplication windowApplication = new WindowApplication();
   3.953 -        if (logger.isDebugEnabled())
   3.954 -          logger.debug("WindowApplication started");
   3.955 -      }
   3.956 -    });
   3.957 +		SwingUtilities.invokeLater(new Runnable() {
   3.958 +			public void run() {
   3.959 +				WindowApplication windowApplication = new WindowApplication();
   3.960 +				if (logger.isDebugEnabled())
   3.961 +					logger.debug("WindowApplication started");
   3.962 +			}
   3.963 +		});
   3.964  
   3.965 -  }
   3.966 +	}
   3.967  
   3.968 -  /*
   3.969 -   * (non-Javadoc)
   3.970 -   * 
   3.971 -   * @see isac.gui.ILoginListener#loginEventOccured(isac.gui.LoginEvent)
   3.972 -   */
   3.973 -  public void loginEventOccured(LoginEvent loginEvent) {
   3.974 -    int type = loginEvent.getType();
   3.975 -    switch (type) {
   3.976 -    case (LoginEvent.LOGIN_TYPE_TRY_TO_LOGIN):
   3.977 -      String username = loginEvent.getUsername();
   3.978 -      String password = loginEvent.getPassword();
   3.979 -      this.login(username, password);
   3.980 -      break;
   3.981 -    case (LoginEvent.LOGIN_TYPE_EXIT):
   3.982 -      this.dispose();
   3.983 -      break;
   3.984 -    }
   3.985 -  }
   3.986 +	/*
   3.987 +	 * (non-Javadoc)
   3.988 +	 * 
   3.989 +	 * @see isac.gui.ILoginListener#loginEventOccured(isac.gui.LoginEvent)
   3.990 +	 */
   3.991 +	public void loginEventOccured(LoginEvent loginEvent) {
   3.992 +		int type = loginEvent.getType();
   3.993 +		switch (type) {
   3.994 +		case (LoginEvent.LOGIN_TYPE_TRY_TO_LOGIN):
   3.995 +			String username = loginEvent.getUsername();
   3.996 +			String password = loginEvent.getPassword();
   3.997 +			this.login(username, password);
   3.998 +			break;
   3.999 +		case (LoginEvent.LOGIN_TYPE_EXIT):
  3.1000 +			this.dispose();
  3.1001 +			break;
  3.1002 +		}
  3.1003 +	}
  3.1004  }
  3.1005 \ No newline at end of file
     4.1 --- a/src/java/isac/gui/Worksheet.java	Wed Apr 13 15:36:03 2005 +0200
     4.2 +++ b/src/java/isac/gui/Worksheet.java	Fri Apr 15 18:46:34 2005 +0200
     4.3 @@ -23,6 +23,7 @@
     4.4  import isac.util.interfaces.IToUser;
     4.5  import isac.util.interfaces.IToWorksheet;
     4.6  import isac.util.tactics.Tactic;
     4.7 +import isac.util.users.IUserSettings;
     4.8  import isac.wsdialog.DGuide;
     4.9  import isac.wsdialog.DialogProtocolException;
    4.10  import isac.wsdialog.IUIElement;
    4.11 @@ -78,625 +79,659 @@
    4.12   * @author Mario Hochreiter
    4.13   * @version 0.1 15/09/2003
    4.14   */
    4.15 -public class Worksheet extends JPanel implements ActionListener, /*IToUser, */ CellEditorListener, Serializable{
    4.16 +public class Worksheet extends JPanel implements ActionListener, /* IToUser, */
    4.17 +CellEditorListener, Serializable {
    4.18  
    4.19  	private MouseAdapter ml;
    4.20  
    4.21  	private JMenuItem applicableTacticsMenuItem_;
    4.22 -  private JMenuItem tacticAppliedMenuItem_;
    4.23 -  private JMenuItem assumptionsMenuItem_;
    4.24 -  private JMenuItem intermediateStepsMenuItem_;
    4.25 +
    4.26 +	private JMenuItem tacticAppliedMenuItem_;
    4.27 +
    4.28 +	private JMenuItem assumptionsMenuItem_;
    4.29 +
    4.30 +	private JMenuItem intermediateStepsMenuItem_;
    4.31  
    4.32  	private JPopupMenu popupMenu;
    4.33 -  private JPopupMenu applicableTacticsMenu_;
    4.34 -  
    4.35 -  private Point mousePoint_;
    4.36 -  private Component mouseComponent_;
    4.37 -  
    4.38 -  private Vector applicableTactics_;
    4.39 +
    4.40 +	private JPopupMenu applicableTacticsMenu_;
    4.41 +
    4.42 +	private Point mousePoint_;
    4.43 +
    4.44 +	private Component mouseComponent_;
    4.45 +
    4.46 +	private Vector applicableTactics_;
    4.47  
    4.48  	static Logger logger = Logger.getLogger(Worksheet.class.getName());
    4.49  
    4.50 -  protected IToUser worksheet_rmi_1_;
    4.51 -  protected IToWorksheet worksheet_rmi_2_;
    4.52 -  
    4.53 -  /** variable that says if the calculation has ended */
    4.54 -  protected boolean calculationEnded;
    4.55 -  
    4.56 -  // formula which will be edited if the dialog allows it
    4.57 -  protected CalcFormula edited_formula_;
    4.58 +	protected IToUser worksheet_rmi_1_;
    4.59  
    4.60 -  /** Model for the JTree */
    4.61 -  protected TreeModel model;
    4.62 -  
    4.63 -  protected CalcTree calcTree;
    4.64 +	protected IToWorksheet worksheet_rmi_2_;
    4.65  
    4.66 -  protected CalcModelHierarchy calc;
    4.67 +	/** variable that says if the calculation has ended */
    4.68 +	protected boolean calculationEnded;
    4.69  
    4.70 -  /** Used to represent the model. */
    4.71 -  protected JTree tree;
    4.72 +	// formula which will be edited if the dialog allows it
    4.73 +	protected CalcFormula edited_formula_;
    4.74  
    4.75 -  /** Dialog which is responsible for the communication with the kernel */
    4.76 -  protected DGuide dialog;
    4.77 +	/** Model for the JTree */
    4.78 +	protected TreeModel model;
    4.79  
    4.80 -  /** Button for doing the next step in calculation */
    4.81 -  //protected JButton nextStep;
    4.82 -  /** Calculate whole example (without single stepping) */
    4.83 -  //protected JButton autoCalc;
    4.84 -  /** true if it is allowed to call tryMatch/tryRefine, false otherwiese */
    4.85 -  protected boolean callProblemAllowed;
    4.86 +	protected CalcTree calcTree;
    4.87  
    4.88 -  /** true if in single stepping mode */
    4.89 -  protected boolean singleStepping;
    4.90 +	protected CalcModelHierarchy calc;
    4.91  
    4.92 -  protected JPanel buttonPanel;
    4.93 +	/** Used to represent the model. */
    4.94 +	protected JTree tree;
    4.95  
    4.96 -  /** Panel which is shows the calcHead if forced */
    4.97 -  protected CalcHeadPanel chp;
    4.98 +	/** Dialog which is responsible for the communication with the kernel */
    4.99 +	protected DGuide dialog;
   4.100  
   4.101 -  /** Panle which shows the tactic if forced */
   4.102 -  protected TacticPanel tp;
   4.103 +	/** Button for doing the next step in calculation */
   4.104 +	//protected JButton nextStep;
   4.105 +	/** Calculate whole example (without single stepping) */
   4.106 +	//protected JButton autoCalc;
   4.107 +	/** true if it is allowed to call tryMatch/tryRefine, false otherwiese */
   4.108 +	protected boolean callProblemAllowed;
   4.109  
   4.110 -  /** submit calcHead and start calculation */
   4.111 -  protected JButton startSolving;
   4.112 +	/** true if in single stepping mode */
   4.113 +	protected boolean singleStepping;
   4.114  
   4.115 -  /** check calc head */
   4.116 -  protected JButton checkCalcHead;
   4.117 +	protected JPanel buttonPanel;
   4.118  
   4.119 -  /** complete calc head */
   4.120 -  protected JButton compCalcHead;
   4.121 +	/** Panel which is shows the calcHead if forced */
   4.122 +	protected CalcHeadPanel chp;
   4.123  
   4.124 -  protected ICalcIterator it_;
   4.125 +	/** Panle which shows the tactic if forced */
   4.126 +	protected TacticPanel tp;
   4.127  
   4.128 -  protected CalcHead ch;
   4.129 -  
   4.130 -  //LK 04.11.18
   4.131 -  protected int current_row_;
   4.132 +	/** submit calcHead and start calculation */
   4.133 +	protected JButton startSolving;
   4.134  
   4.135 -  /**
   4.136 -   * Create a <code>Worksheet</code> that displays the Formalization in the
   4.137 -   * requested viewStyle. The text of the labels is localized. The given
   4.138 -   * <code>DGuide</code> is connected to the <code>Worksheet</code>.
   4.139 -   * 
   4.140 -   * @param l
   4.141 -   *          Locale that is used.
   4.142 -   * @param dialogGuide
   4.143 -   *          The dialog guide that is connected to the Worksheet
   4.144 -   * @param f
   4.145 -   *          Formalization necessary to start a new calculation
   4.146 -   * @param source
   4.147 -   *          Where was the calculation started
   4.148 -   * @param viewStyle
   4.149 -   *          Requested view style (how detailed the CalcHead should be
   4.150 -   *          displayed)
   4.151 -   */
   4.152 -  public Worksheet(final Locale l, DGuide dialogGuide, Formalization f,
   4.153 -                   int source, int viewStyle) {
   4.154 -    // LK 04.11.18 (1 line)
   4.155 -    current_row_ = 0;
   4.156 -    singleStepping = true;
   4.157 -    callProblemAllowed = true;
   4.158 -    super.setLayout(new BorderLayout());
   4.159 -    dialog = dialogGuide;
   4.160 -    try {
   4.161 -      logger.debug(f.toString());
   4.162 -      calcTree = dialog.startCalculation(0, f, source, viewStyle);
   4.163 -      ICalcIterator it = calcTree.iterator();
   4.164 -      try {
   4.165 -        ch =  (CalcHead) it.getFormula();
   4.166 -        //dialog.setNextTactic(dialog.fetchProposedTactic());
   4.167 -      } catch (Exception e) {
   4.168 -        e.printStackTrace();
   4.169 -      }
   4.170 -      logger.debug(ch);
   4.171 -      logger.info("reqViewStyle: " + viewStyle);
   4.172 -      //TODO: alter
   4.173 -      // that's how the viewStyle should be set but it does not work
   4.174 -      //dialog.notifyUserAction(new
   4.175 -      // UserActionOnInt(IUserAction.UI_SPECIFY_CHANGE_VIEW, 5));
   4.176 -      //workaround
   4.177 -      //ch.setViewStyle(CalcHead.VIEWSTYLE_FULL);
   4.178 -      logger.info("getViewStyle: " + ch.getViewStyle());
   4.179 -      logger.debug(ch);
   4.180 -      worksheet_rmi_1_ = new WorksheetRMI(this);
   4.181 -      worksheet_rmi_2_ = new WorksheetRMI(this);
   4.182 -      dialog.addDataChangeListener(worksheet_rmi_1_);
   4.183 -      dialog.registerUIControlListener(worksheet_rmi_2_);
   4.184 -      chp = new CalcHeadPanel(l, ch, ch.getViewStyle());
   4.185 -      this.buildCalcHeadPanelButtons();
   4.186 -      super.add(chp, BorderLayout.NORTH);
   4.187 -      switch (ch.getViewStyle()) {
   4.188 -        case CalcHead.VIEWSTYLE_SINGLELINE:
   4.189 -          this.startCalc();
   4.190 -          break;
   4.191 -        default:
   4.192 -        this.startCalc();   
   4.193 -      }
   4.194 -    } catch (RemoteException e) {
   4.195 -      // TODO Auto-generated catch block
   4.196 -      e.printStackTrace();
   4.197 -      //    } catch (DialogProtocolException e) {
   4.198 -      //		logger.error(e);
   4.199 -    }
   4.200 -    //    outputText = new JTextArea(10, 50);
   4.201 -    //    this.add(new JScrollPane(outputText), BorderLayout.CENTER);
   4.202 -  }
   4.203 +	/** check calc head */
   4.204 +	protected JButton checkCalcHead;
   4.205  
   4.206 -  private void buildCalcHeadPanelButtons() {
   4.207 -    buttonPanel = new JPanel();
   4.208 -    //TODO localize!!!
   4.209 -    startSolving = new JButton("start Solving");
   4.210 -    compCalcHead = new JButton("complete CalcHead");
   4.211 -    checkCalcHead = new JButton("check CalcHead");
   4.212 -    startSolving.addActionListener(this);
   4.213 -    compCalcHead.addActionListener(this);
   4.214 -    checkCalcHead.addActionListener(this);
   4.215 -    buttonPanel.add(checkCalcHead);
   4.216 -    buttonPanel.add(compCalcHead);
   4.217 -    buttonPanel.add(startSolving);
   4.218 -    super.add(buttonPanel, BorderLayout.SOUTH);
   4.219 -  }
   4.220 +	/** complete calc head */
   4.221 +	protected JButton compCalcHead;
   4.222  
   4.223 -  //  private void buildButtons() {
   4.224 -  //    this.remove(buttonPanel);
   4.225 -  //    buttonPanel = new JPanel();
   4.226 -  //    //TODO localize!!!
   4.227 -  //    nextStep = new JButton("Next step");
   4.228 -  //	  autoCalc = new JButton("Autocalc");
   4.229 -  //    nextStep.addActionListener(this);
   4.230 -  //  	autoCalc.addActionListener(this);
   4.231 -  //    buttonPanel.add(nextStep);
   4.232 -  //    buttonPanel.add(autoCalc);
   4.233 -  //    this.add(buttonPanel, BorderLayout.SOUTH);
   4.234 -  //  }
   4.235 +	protected ICalcIterator it_;
   4.236  
   4.237 -  protected void buildMenu() {
   4.238 -    popupMenu = new JPopupMenu();
   4.239 -    applicableTacticsMenuItem_ = new JMenuItem("applicable tactics");
   4.240 -    applicableTacticsMenuItem_.addActionListener(this);
   4.241 -    tacticAppliedMenuItem_ = new JMenuItem("tactic applied");
   4.242 -    tacticAppliedMenuItem_.addActionListener(this);
   4.243 -    assumptionsMenuItem_ = new JMenuItem("assumptions");
   4.244 -    assumptionsMenuItem_.addActionListener(this);
   4.245 -    intermediateStepsMenuItem_ = new JMenuItem("intermediate steps");
   4.246 -    intermediateStepsMenuItem_.addActionListener(this);
   4.247 -    popupMenu.add(applicableTacticsMenuItem_);
   4.248 -    popupMenu.add(tacticAppliedMenuItem_);
   4.249 -    popupMenu.add(assumptionsMenuItem_);
   4.250 -    popupMenu.add(intermediateStepsMenuItem_);
   4.251 -    this.initMouseListener(); 
   4.252 -  }
   4.253 -  
   4.254 -  protected void buildApplicableTacticsMenu() {
   4.255 -    applicableTacticsMenu_ = new JPopupMenu();
   4.256 -    Iterator it = applicableTactics_.iterator();
   4.257 -    Integer step = new Integer(0);
   4.258 -    while (it.hasNext()) {
   4.259 -      Tactic tactic = (Tactic)it.next();
   4.260 -      JMenuItem item = new JMenuItem(tactic.toSMLString());
   4.261 -      item.setActionCommand(step.toString());
   4.262 -      item.addActionListener(this);
   4.263 -      applicableTacticsMenu_.add(item);
   4.264 -      int stepInt = step.intValue();
   4.265 -      stepInt++;
   4.266 -      step = new Integer(stepInt);
   4.267 -    }
   4.268 -    applicableTacticsMenu_.show(mouseComponent_, mousePoint_.x, mousePoint_.y);
   4.269 -  }
   4.270 +	protected CalcHead ch;
   4.271  
   4.272 -  protected void initMouseListener() {
   4.273 -    ml = new MouseAdapter() {
   4.274 -      public void mousePressed(MouseEvent e) {
   4.275 -        logger.info("mouseEvent");
   4.276 -        if (e.getButton() == MouseEvent.BUTTON3 && !isCallProblemAllowed() && (tree.getSelectionPath() != null)) {
   4.277 -          mousePoint_ = e.getPoint();
   4.278 -          mouseComponent_ = e.getComponent();
   4.279 -          popupMenu.show(e.getComponent(), e.getX(), e.getY());
   4.280 -        }
   4.281 -      }
   4.282 -    };
   4.283 -    tree.addMouseListener(ml);
   4.284 -  }
   4.285 +	//LK 04.11.18
   4.286 +	protected int current_row_;
   4.287  
   4.288 -  private void showTacticPanel() {
   4.289 -    if (tp == null) {
   4.290 -      tp = new TacticPanel();
   4.291 -      super.add(tp, BorderLayout.EAST);
   4.292 -    }
   4.293 -  }
   4.294 +	/**
   4.295 +	 * Create a <code>Worksheet</code> that displays the Formalization in the
   4.296 +	 * requested viewStyle. The text of the labels is localized. The given
   4.297 +	 * <code>DGuide</code> is connected to the <code>Worksheet</code>.
   4.298 +	 * 
   4.299 +	 * @param l
   4.300 +	 *            Locale that is used.
   4.301 +	 * @param dialogGuide
   4.302 +	 *            The dialog guide that is connected to the Worksheet
   4.303 +	 * @param f
   4.304 +	 *            Formalization necessary to start a new calculation
   4.305 +	 * @param source
   4.306 +	 *            Where was the calculation started
   4.307 +	 */
   4.308 +	public Worksheet(final Locale l, DGuide dialogGuide, Formalization f,
   4.309 +			int source) {
   4.310 +		// LK 04.11.18 (1 line)
   4.311 +		current_row_ = 0;
   4.312 +		singleStepping = true;
   4.313 +		callProblemAllowed = true;
   4.314 +		super.setLayout(new BorderLayout());
   4.315 +		dialog = dialogGuide;
   4.316 +		try {
   4.317 +			logger.debug(f.toString());
   4.318 +			calcTree = dialog.startCalculation(0, f, source);
   4.319 +			ICalcIterator it = calcTree.iterator();
   4.320 +			try {
   4.321 +				ch = (CalcHead) it.getFormula();
   4.322 +			} catch (Exception e) {
   4.323 +				e.printStackTrace();
   4.324 +			}
   4.325 +			//logger.debug(ch);
   4.326 +			//logger.info("reqViewStyle: " + viewStyle);
   4.327 +			//TODO: alter
   4.328 +			// that's how the viewStyle should be set but it does not work
   4.329 +			//dialog.notifyUserAction(new
   4.330 +			// UserActionOnInt(IUserAction.UI_SPECIFY_CHANGE_VIEW, 5));
   4.331 +			//workaround
   4.332 +			//ch.setViewStyle(CalcHead.VIEWSTYLE_FULL);
   4.333 +			//logger.info("getViewStyle: " + ch.getViewStyle());
   4.334 +			//logger.debug(ch);
   4.335 +			worksheet_rmi_1_ = new WorksheetRMI(this);
   4.336 +			worksheet_rmi_2_ = new WorksheetRMI(this);
   4.337 +			dialog.addDataChangeListener(worksheet_rmi_1_);
   4.338 +			dialog.registerUIControlListener(worksheet_rmi_2_);
   4.339 +			chp = new CalcHeadPanel(l, ch, ch.getViewStyle());
   4.340 +			this.buildCalcHeadPanelButtons();
   4.341 +			super.add(chp, BorderLayout.NORTH);
   4.342  
   4.343 -  /* LK 04.09.02 */
   4.344 -  public boolean isCalculationEnded() {
   4.345 -    return this.calculationEnded;
   4.346 -  }
   4.347 +			//the calculation-related stuff is switched in
   4.348 +			// DialogGuide.startCalculation
   4.349 +			switch (dialog.getUserSettings(IUserSettings.start_worksheet)) {
   4.350 +			case IUserSettings.SKIP_SPECIFY_START_SOLVE:
   4.351 +				ch.setViewStyle(CalcHead.VIEWSTYLE_SINGLELINE);
   4.352 +				//etc. from above copied here
   4.353 +				this.startCalc();
   4.354 +				break;
   4.355 +			case IUserSettings.POP_CALCHEAD_WITH_DESCRIPTIONS:
   4.356 +				ch.setViewStyle(CalcHead.VIEWSTYLE_FULL);
   4.357 +				//etc. from above copied here
   4.358 +				this.startCalc();
   4.359 +				break;
   4.360 +			default:
   4.361 +				this.startCalc();
   4.362 +			}
   4.363 +		} catch (RemoteException e) {
   4.364 +			// TODO Auto-generated catch block
   4.365 +			e.printStackTrace();
   4.366 +			//    } catch (DialogProtocolException e) {
   4.367 +			//		logger.error(e);
   4.368 +		}
   4.369 +		//    outputText = new JTextArea(10, 50);
   4.370 +		//    this.add(new JScrollPane(outputText), BorderLayout.CENTER);
   4.371 +	}
   4.372  
   4.373 -  //TreeView
   4.374 -  public void setTreeTableModel() {
   4.375 -    calc = new CalcModelHierarchy();
   4.376 -    model = new CalculationModel(calc, calcTree.iterator());
   4.377 -    tree = new JTree(model);
   4.378 -    tree.setEditable(true);
   4.379 -    tree.setCellRenderer(new CustomTreeCellRenderer());
   4.380 -    tree.setCellEditor(new DefaultTreeCellEditor(tree,
   4.381 -        new DefaultTreeCellRenderer()));
   4.382 -    //LK 04.11.17: (1 line)
   4.383 -    tree.getCellEditor().addCellEditorListener(this);
   4.384 -    tree.getSelectionModel()
   4.385 -        .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
   4.386 -    tree.setRootVisible(false);
   4.387 -    tree.setShowsRootHandles(true);
   4.388 -    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_A,
   4.389 -                                          KeyEvent.CTRL_DOWN_MASK);
   4.390 -    tree.getInputMap().put(ks, "none");
   4.391 -    super.add(new JScrollPane(tree), BorderLayout.CENTER);
   4.392 -  }
   4.393 +	private void buildCalcHeadPanelButtons() {
   4.394 +		buttonPanel = new JPanel();
   4.395 +		//TODO localize!!!
   4.396 +		startSolving = new JButton("start Solving");
   4.397 +		compCalcHead = new JButton("complete CalcHead");
   4.398 +		checkCalcHead = new JButton("check CalcHead");
   4.399 +		startSolving.addActionListener(this);
   4.400 +		compCalcHead.addActionListener(this);
   4.401 +		checkCalcHead.addActionListener(this);
   4.402 +		buttonPanel.add(checkCalcHead);
   4.403 +		buttonPanel.add(compCalcHead);
   4.404 +		buttonPanel.add(startSolving);
   4.405 +		super.add(buttonPanel, BorderLayout.SOUTH);
   4.406 +	}
   4.407  
   4.408 -  /**
   4.409 -   * Do matching (see UC 2.5.6).
   4.410 -   * 
   4.411 -   * @param problemID
   4.412 -   *          unique id for a CalcHead
   4.413 -   */
   4.414 -  public void tryMatch(CalcHeadCompoundID problemID) {
   4.415 -    try {
   4.416 -      // dialog.tryMatch(ch, problemID);
   4.417 -      dialog.notifyUserAction(new UserActionOnCalcHeadCompoundID(
   4.418 -          IUIElement.UI_SPECIFY_TRY_MATCH, problemID));
   4.419 -      logger.debug("CalcHead after tryMatch: " + ch.toSMLString());
   4.420 -      chp.fillTextFieldsFromCalcHead(ch);
   4.421 -      this.showCalcHeadPane();
   4.422 -    } catch (RemoteException e) {
   4.423 -      e.printStackTrace();
   4.424 -      //    } catch (NotInSpecificationPhaseException e) {
   4.425 -      //      e.printStackTrace();
   4.426 -    } catch (DialogProtocolException e) {
   4.427 -      logger.error(e.getMessage(), e);
   4.428 -    }
   4.429 -  }
   4.430 +	//  private void buildButtons() {
   4.431 +	//    this.remove(buttonPanel);
   4.432 +	//    buttonPanel = new JPanel();
   4.433 +	//    //TODO localize!!!
   4.434 +	//    nextStep = new JButton("Next step");
   4.435 +	//	  autoCalc = new JButton("Autocalc");
   4.436 +	//    nextStep.addActionListener(this);
   4.437 +	//  	autoCalc.addActionListener(this);
   4.438 +	//    buttonPanel.add(nextStep);
   4.439 +	//    buttonPanel.add(autoCalc);
   4.440 +	//    this.add(buttonPanel, BorderLayout.SOUTH);
   4.441 +	//  }
   4.442  
   4.443 -  /**
   4.444 -   * Refine a problem (see UC 2.5.7).
   4.445 -   * 
   4.446 -   * @param problemID
   4.447 -   *          unique id for a CalcHead
   4.448 -   */
   4.449 -  // method at the moment only gets CalcHead but does not
   4.450 -  // mark the refined problem in the problem hierarchy
   4.451 -  public void tryRefine(CalcHeadCompoundID problemID) {
   4.452 -    try {
   4.453 -      // dialog.tryRefine(ch, problemID);
   4.454 -      dialog.notifyUserAction(new UserActionOnCalcHeadCompoundID(
   4.455 -          IUIElement.UI_SPECIFY_TRY_REFINE, problemID));
   4.456 -      chp.fillTextFieldsFromCalcHead(ch);
   4.457 -      this.showCalcHeadPane();
   4.458 -    } catch (DialogProtocolException e) {
   4.459 -      logger.error(e);
   4.460 -    } catch (RemoteException e) {
   4.461 -      logger.error(e);
   4.462 -    }
   4.463 -  }
   4.464 +	protected void buildMenu() {
   4.465 +		popupMenu = new JPopupMenu();
   4.466 +		applicableTacticsMenuItem_ = new JMenuItem("applicable tactics");
   4.467 +		applicableTacticsMenuItem_.addActionListener(this);
   4.468 +		tacticAppliedMenuItem_ = new JMenuItem("tactic applied");
   4.469 +		tacticAppliedMenuItem_.addActionListener(this);
   4.470 +		assumptionsMenuItem_ = new JMenuItem("assumptions");
   4.471 +		assumptionsMenuItem_.addActionListener(this);
   4.472 +		intermediateStepsMenuItem_ = new JMenuItem("intermediate steps");
   4.473 +		intermediateStepsMenuItem_.addActionListener(this);
   4.474 +		popupMenu.add(applicableTacticsMenuItem_);
   4.475 +		popupMenu.add(tacticAppliedMenuItem_);
   4.476 +		popupMenu.add(assumptionsMenuItem_);
   4.477 +		popupMenu.add(intermediateStepsMenuItem_);
   4.478 +		this.initMouseListener();
   4.479 +	}
   4.480  
   4.481 -  /**
   4.482 -   * Show all applicable Tactics that can be used for the next calculation step
   4.483 -   * (UC 2.5.11).
   4.484 -   * 
   4.485 -   * @param scope
   4.486 -   *          The filter parameter selects the scope of search for applicable
   4.487 -   *          tactics.
   4.488 -   */
   4.489 -  public void showApplicableTactics(int scope) {
   4.490 -    try {
   4.491 -      Tactic[] tactic = dialog.fetchApplicableTactics(scope);
   4.492 -      //TODO: show tactis in a list the user can select
   4.493 -    } catch (RemoteException e) {
   4.494 -      logger.error(e);
   4.495 -    }
   4.496 -  }
   4.497 +	protected void buildApplicableTacticsMenu() {
   4.498 +		applicableTacticsMenu_ = new JPopupMenu();
   4.499 +		Iterator it = applicableTactics_.iterator();
   4.500 +		Integer step = new Integer(0);
   4.501 +		while (it.hasNext()) {
   4.502 +			Tactic tactic = (Tactic) it.next();
   4.503 +			JMenuItem item = new JMenuItem(tactic.toSMLString());
   4.504 +			item.setActionCommand(step.toString());
   4.505 +			item.addActionListener(this);
   4.506 +			applicableTacticsMenu_.add(item);
   4.507 +			int stepInt = step.intValue();
   4.508 +			stepInt++;
   4.509 +			step = new Integer(stepInt);
   4.510 +		}
   4.511 +		applicableTacticsMenu_.show(mouseComponent_, mousePoint_.x,
   4.512 +				mousePoint_.y);
   4.513 +	}
   4.514  
   4.515 -  /**
   4.516 -   * Call problem is allowed if the calculation is not in solving phase.
   4.517 -   */
   4.518 -  public boolean isCallProblemAllowed() {
   4.519 -    return callProblemAllowed;
   4.520 -  }
   4.521 +	protected void initMouseListener() {
   4.522 +		ml = new MouseAdapter() {
   4.523 +			public void mousePressed(MouseEvent e) {
   4.524 +				logger.info("mouseEvent");
   4.525 +				if (e.getButton() == MouseEvent.BUTTON3
   4.526 +						&& !isCallProblemAllowed()
   4.527 +						&& (tree.getSelectionPath() != null)) {
   4.528 +					mousePoint_ = e.getPoint();
   4.529 +					mouseComponent_ = e.getComponent();
   4.530 +					popupMenu.show(e.getComponent(), e.getX(), e.getY());
   4.531 +				}
   4.532 +			}
   4.533 +		};
   4.534 +		tree.addMouseListener(ml);
   4.535 +	}
   4.536  
   4.537 -  /**
   4.538 -   * @return true if the calculation has started.
   4.539 -   */
   4.540 -  public boolean isCalculationStarted() {
   4.541 -    return it_ != null;
   4.542 -  }
   4.543 +	private void showTacticPanel() {
   4.544 +		if (tp == null) {
   4.545 +			tp = new TacticPanel();
   4.546 +			super.add(tp, BorderLayout.EAST);
   4.547 +		}
   4.548 +	}
   4.549  
   4.550 -  private void setIterator() {
   4.551 -    try {
   4.552 -      it_ = calcTree.iterator();
   4.553 -      it_.moveRoot();
   4.554 -    } catch (RemoteException e) {
   4.555 -      e.printStackTrace();
   4.556 -      System.exit(5);
   4.557 -    }
   4.558 -  } 
   4.559 -  
   4.560 -  private void showCalcHeadPane() {
   4.561 -    super.add(chp, BorderLayout.NORTH);
   4.562 -    super.validate();
   4.563 -  }
   4.564 +	/* LK 04.09.02 */
   4.565 +	public boolean isCalculationEnded() {
   4.566 +		return this.calculationEnded;
   4.567 +	}
   4.568  
   4.569 -  /* LK 04.09.01 */
   4.570 -  // to be called from the windowApplication
   4.571 -  public void nextStep() {
   4.572 -    try {
   4.573 -      dialog.notifyUserAction(new UserAction(IUIElement.UI_CALCULATE_1));
   4.574 -//      singleStepping = true;
   4.575 -//      Tactic propTactic;
   4.576 -//      try {
   4.577 -//        if (it_ == null)
   4.578 -//          this.setIterator();
   4.579 -//        propTactic = dialog.fetchProposedTactic();
   4.580 -//        //FIXME:WN: vvvv ...endCalculation
   4.581 -//        if (propTactic != null) {
   4.582 -//          dialog.setNextTactic(propTactic);
   4.583 -//        } else {
   4.584 -//          this.calculationEnded = true;
   4.585 -//        }
   4.586 -//      } catch (RemoteException e1) {
   4.587 -//        e1.printStackTrace();
   4.588 -//      } //try
   4.589 -    } catch (RemoteException e) {
   4.590 -      // TODO Auto-generated catch block
   4.591 -      e.printStackTrace();
   4.592 -    } catch (DialogProtocolException e) {
   4.593 -      // TODO Auto-generated catch block
   4.594 -      e.printStackTrace();
   4.595 -    }
   4.596 -  }
   4.597 +	//TreeView
   4.598 +	public void setTreeTableModel() {
   4.599 +		calc = new CalcModelHierarchy();
   4.600 +		model = new CalculationModel(calc, calcTree.iterator());
   4.601 +		tree = new JTree(model);
   4.602 +		tree.setEditable(true);
   4.603 +		tree.setCellRenderer(new CustomTreeCellRenderer());
   4.604 +		tree.setCellEditor(new DefaultTreeCellEditor(tree,
   4.605 +				new DefaultTreeCellRenderer()));
   4.606 +		//LK 04.11.17: (1 line)
   4.607 +		tree.getCellEditor().addCellEditorListener(this);
   4.608 +		tree.getSelectionModel().setSelectionMode(
   4.609 +				TreeSelectionModel.SINGLE_TREE_SELECTION);
   4.610 +		tree.setRootVisible(false);
   4.611 +		tree.setShowsRootHandles(true);
   4.612 +		KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_A,
   4.613 +				KeyEvent.CTRL_DOWN_MASK);
   4.614 +		tree.getInputMap().put(ks, "none");
   4.615 +		super.add(new JScrollPane(tree), BorderLayout.CENTER);
   4.616 +	}
   4.617  
   4.618 -  /* LK 04.09.01 */
   4.619 -  // to be called from the windowApplication
   4.620 -  public void autoCalc() {
   4.621 -    //if (!this.calculationEnded) {
   4.622 -      try {
   4.623 -        singleStepping = false;
   4.624 -        dialog
   4.625 -              .notifyUserAction(new UserAction(
   4.626 -                                               IUserAction.UI_CALCULATE_ALL));
   4.627 -        for (int i=0; i < tree.getRowCount(); i++) {
   4.628 -          tree.expandRow(i);
   4.629 -        }
   4.630 -        this.calculationEnded = true;
   4.631 -      } catch (RemoteException e1) {
   4.632 -        logger.error("actionPerformed", e1.detail);
   4.633 -      } catch (DialogProtocolException e1) {
   4.634 -        logger.error("actionPerformed");
   4.635 -      } //try
   4.636 -    //}//if
   4.637 -  }
   4.638 +	/**
   4.639 +	 * Do matching (see UC 2.5.6).
   4.640 +	 * 
   4.641 +	 * @param problemID
   4.642 +	 *            unique id for a CalcHead
   4.643 +	 */
   4.644 +	public void tryMatch(CalcHeadCompoundID problemID) {
   4.645 +		try {
   4.646 +			// dialog.tryMatch(ch, problemID);
   4.647 +			dialog.notifyUserAction(new UserActionOnCalcHeadCompoundID(
   4.648 +					IUIElement.UI_SPECIFY_TRY_MATCH, problemID));
   4.649 +			logger.debug("CalcHead after tryMatch: " + ch.toSMLString());
   4.650 +			chp.fillTextFieldsFromCalcHead(ch);
   4.651 +			this.showCalcHeadPane();
   4.652 +		} catch (RemoteException e) {
   4.653 +			e.printStackTrace();
   4.654 +			//    } catch (NotInSpecificationPhaseException e) {
   4.655 +			//      e.printStackTrace();
   4.656 +		} catch (DialogProtocolException e) {
   4.657 +			logger.error(e.getMessage(), e);
   4.658 +		}
   4.659 +	}
   4.660  
   4.661 -  private void startCalc() {
   4.662 -    this.setIterator();
   4.663 -    this.setTreeTableModel();
   4.664 -    super.remove(buttonPanel);
   4.665 -    this.buildMenu();
   4.666 -    super.remove(chp);
   4.667 -    //    this.showTacticPanel();
   4.668 -    this.validate();
   4.669 -    callProblemAllowed = false;
   4.670 -  }
   4.671 -  
   4.672 -  public void startSolving() {
   4.673 -    try {
   4.674 -      //    dialog.newCalculation(ch);
   4.675 -      chp.fillCalcHeadFromTextFields(ch);
   4.676 -      logger.fatal("WS->DG: UI_SPECIFY_CALCULATE_1");
   4.677 -      if (dialog.notifyUserAction(new UserAction(
   4.678 -          IUserAction.UI_SPECIFY_CALCULATE_1))) { 
   4.679 -        startCalc();
   4.680 -      } else {
   4.681 -        JOptionPane.showMessageDialog(this, "Please enter a correct CalcHead",
   4.682 -                                      "CalcHead not correct",
   4.683 -                                      JOptionPane.WARNING_MESSAGE);
   4.684 -      }
   4.685 -    } catch (RemoteException e1) {
   4.686 -      logger.error("actionPerformed", e1.detail);
   4.687 -    } catch (DialogProtocolException e2) {
   4.688 -      logger.error("actionPerformed", e2);
   4.689 -    }
   4.690 -  }
   4.691 +	/**
   4.692 +	 * Refine a problem (see UC 2.5.7).
   4.693 +	 * 
   4.694 +	 * @param problemID
   4.695 +	 *            unique id for a CalcHead
   4.696 +	 */
   4.697 +	// method at the moment only gets CalcHead but does not
   4.698 +	// mark the refined problem in the problem hierarchy
   4.699 +	public void tryRefine(CalcHeadCompoundID problemID) {
   4.700 +		try {
   4.701 +			// dialog.tryRefine(ch, problemID);
   4.702 +			dialog.notifyUserAction(new UserActionOnCalcHeadCompoundID(
   4.703 +					IUIElement.UI_SPECIFY_TRY_REFINE, problemID));
   4.704 +			chp.fillTextFieldsFromCalcHead(ch);
   4.705 +			this.showCalcHeadPane();
   4.706 +		} catch (DialogProtocolException e) {
   4.707 +			logger.error(e);
   4.708 +		} catch (RemoteException e) {
   4.709 +			logger.error(e);
   4.710 +		}
   4.711 +	}
   4.712  
   4.713 -  public void compCalcHead() {
   4.714 -    try {
   4.715 -      chp.fillCalcHeadFromTextFields(ch);
   4.716 -      dialog.notifyUserAction(new UserAction(
   4.717 -          IUserAction.UI_SPECIFY_COMPLETE_CALCHEAD));
   4.718 -      chp.fillTextFieldsFromCalcHead(ch);
   4.719 -    } catch (Exception e1) {
   4.720 -      logger.error(e1);
   4.721 -    }
   4.722 -  }
   4.723 +	/**
   4.724 +	 * Show all applicable Tactics that can be used for the next calculation
   4.725 +	 * step (UC 2.5.11).
   4.726 +	 * 
   4.727 +	 * @param scope
   4.728 +	 *            The filter parameter selects the scope of search for
   4.729 +	 *            applicable tactics.
   4.730 +	 */
   4.731 +	public void showApplicableTactics(int scope) {
   4.732 +		try {
   4.733 +			Tactic[] tactic = dialog.fetchApplicableTactics(scope);
   4.734 +			//TODO: show tactis in a list the user can select
   4.735 +		} catch (RemoteException e) {
   4.736 +			logger.error(e);
   4.737 +		}
   4.738 +	}
   4.739  
   4.740 -  public void checkCalcHead() {
   4.741 -    try {
   4.742 -      logger.debug(dialog);
   4.743 -      dialog.notifyUserAction(new UserAction(
   4.744 -          IUserAction.UI_SPECIFY_CHECK_CALCHEAD));
   4.745 -      chp.fillTextFieldsFromCalcHead(ch);
   4.746 -    } catch (Exception e1) {
   4.747 -      logger.error(e1);
   4.748 -    }
   4.749 -  }
   4.750 +	/**
   4.751 +	 * Call problem is allowed if the calculation is not in solving phase.
   4.752 +	 */
   4.753 +	public boolean isCallProblemAllowed() {
   4.754 +		return callProblemAllowed;
   4.755 +	}
   4.756  
   4.757 -  /**
   4.758 -   * shows the applicable tactics, if applied on the activeFormula
   4.759 -   * a applicable tactic can be chosen and is applied to this formula
   4.760 -   */
   4.761 -  public void applicableTactics() {
   4.762 -    try {
   4.763 -      CalcModelNode node = (CalcModelNode)tree.getSelectionPath().getLastPathComponent();
   4.764 -      ICalcIterator it = node.getValue();
   4.765 -      applicableTactics_ = it.getApplicableTactics(0);
   4.766 -      buildApplicableTacticsMenu();
   4.767 -//      dialog.notifyUserAction(new UserAction(
   4.768 -//          IUserAction.UI_SOLVE_GET_APPLICABLE_TACTICS));
   4.769 -    } catch (Exception e1) {
   4.770 -      logger.error(e1);
   4.771 -    }
   4.772 -  }
   4.773 -  
   4.774 -  /**
   4.775 -   * shows the Tactic that was applied to this formula
   4.776 -   *
   4.777 -   */
   4.778 -  public void tacticApplied() {
   4.779 -    try {
   4.780 -      CalcModelNode node = (CalcModelNode)tree.getSelectionPath().getLastPathComponent();
   4.781 -      node.tacticString = ((ICalcIterator)node.getValue()).getTactic().getName();
   4.782 -      tree.repaint();
   4.783 -    } catch (Exception e1) {
   4.784 -      logger.error(e1);
   4.785 -    }
   4.786 -  }
   4.787 -  
   4.788 -  public void assumptions() {
   4.789 -    try {
   4.790 -      System.out.println("assumtions");
   4.791 -    } catch (Exception e1) {
   4.792 -      logger.error(e1);
   4.793 -    }
   4.794 -  }
   4.795 -  
   4.796 -  public void intermediateSteps() {
   4.797 -    try {
   4.798 -      CalcModelNode node = (CalcModelNode)tree.getSelectionPath().getLastPathComponent();
   4.799 -      ICalcIterator it = node.getValue();
   4.800 -      calcTree.intermediateSteps(it);
   4.801 -    } catch (Exception e1) {
   4.802 -      logger.error(e1);
   4.803 -    }
   4.804 -  }
   4.805 -  
   4.806 -  
   4.807 -  //------------- Implementation of ActionListener ----------------
   4.808 -  public void actionPerformed(ActionEvent e) {
   4.809 -    if (e.getSource() == startSolving) {
   4.810 -      startSolving();
   4.811 -    } else if (e.getSource() == compCalcHead) {
   4.812 -      compCalcHead();
   4.813 -    } else if (e.getSource() == checkCalcHead) {
   4.814 -      checkCalcHead();
   4.815 -    } else if (e.getSource() == applicableTacticsMenuItem_) {
   4.816 -      applicableTactics();
   4.817 -    } else if (e.getSource() == tacticAppliedMenuItem_) {
   4.818 -      tacticApplied();
   4.819 -    } else if (e.getSource() == assumptionsMenuItem_) {
   4.820 -      assumptions();
   4.821 -    } else if (e.getSource() == intermediateStepsMenuItem_) {
   4.822 -      intermediateSteps();
   4.823 -    } else if (e.getActionCommand() != null && !e.getActionCommand().equals("")) {
   4.824 -      int pos = Integer.parseInt(e.getActionCommand());
   4.825 -      Tactic tactic = (Tactic)applicableTactics_.get(pos);
   4.826 -      try {
   4.827 -        dialog.notifyUserAction(new UserActionOnCalcElement(IUserAction.UI_SOLVE_SET_NEXT_TACTIC, tactic));
   4.828 -      } catch (RemoteException e1) {
   4.829 -        // TODO Auto-generated catch block
   4.830 -        e1.printStackTrace();
   4.831 -      } catch (DialogProtocolException e1) {
   4.832 -        // TODO Auto-generated catch block
   4.833 -        e1.printStackTrace();
   4.834 -      }
   4.835 -    } else { 
   4.836 -      //unexpected event source
   4.837 -      logger.error("unexpected event source " + e.getSource());
   4.838 -    }
   4.839 -  }
   4.840 +	/**
   4.841 +	 * @return true if the calculation has started.
   4.842 +	 */
   4.843 +	public boolean isCalculationStarted() {
   4.844 +		return it_ != null;
   4.845 +	}
   4.846  
   4.847 -  public void calcChanged(CalcChangedEvent event){
   4.848 -    logger.debug("single Stepping: " + singleStepping);
   4.849 -    logger.debug(model);
   4.850 -    logger.debug("calc" + calc);
   4.851 -    logger.debug(model);
   4.852 -    ((CalculationModel) model).calcChanged(event);
   4.853 -    for (int i=0; i < tree.getRowCount(); i++) {
   4.854 -      tree.expandRow(i);
   4.855 -    }
   4.856 -    tree.setEditable(true);
   4.857 -  }
   4.858 +	private void setIterator() {
   4.859 +		try {
   4.860 +			it_ = calcTree.iterator();
   4.861 +			it_.moveRoot();
   4.862 +		} catch (RemoteException e) {
   4.863 +			e.printStackTrace();
   4.864 +			System.exit(5);
   4.865 +		}
   4.866 +	}
   4.867  
   4.868 -  /**
   4.869 -   * if the user has canceled the edition, the worksheet should inform the dialogGuide
   4.870 -   * @see javax.swing.event.CellEditorListener#editingCanceled(javax.swing.event.ChangeEvent)
   4.871 -   */
   4.872 -  public void editingCanceled(ChangeEvent e) {
   4.873 -    // TODO Auto-generated method stub
   4.874 -    
   4.875 -  }
   4.876 +	private void showCalcHeadPane() {
   4.877 +		super.add(chp, BorderLayout.NORTH);
   4.878 +		super.validate();
   4.879 +	}
   4.880  
   4.881 -  /**
   4.882 -   * if the user has changed the value of a node, it should be altered
   4.883 -   * @see javax.swing.event.CellEditorListener#editingStopped(javax.swing.event.ChangeEvent)
   4.884 -   */
   4.885 -  public void editingStopped(ChangeEvent e) {
   4.886 -    Object o = tree.getCellEditor().getCellEditorValue();
   4.887 -    //TODO: LK 04.11.17: temporary solution: 
   4.888 +	/* LK 04.09.01 */
   4.889 +	// to be called from the windowApplication
   4.890 +	public void nextStep() {
   4.891 +		try {
   4.892 +			dialog.notifyUserAction(new UserAction(IUIElement.UI_CALCULATE_1));
   4.893 +			//      singleStepping = true;
   4.894 +			//      Tactic propTactic;
   4.895 +			//      try {
   4.896 +			//        if (it_ == null)
   4.897 +			//          this.setIterator();
   4.898 +			//        propTactic = dialog.fetchProposedTactic();
   4.899 +			//        //FIXME:WN: vvvv ...endCalculation
   4.900 +			//        if (propTactic != null) {
   4.901 +			//          dialog.setNextTactic(propTactic);
   4.902 +			//        } else {
   4.903 +			//          this.calculationEnded = true;
   4.904 +			//        }
   4.905 +			//      } catch (RemoteException e1) {
   4.906 +			//        e1.printStackTrace();
   4.907 +			//      } //try
   4.908 +		} catch (RemoteException e) {
   4.909 +			// TODO Auto-generated catch block
   4.910 +			e.printStackTrace();
   4.911 +		} catch (DialogProtocolException e) {
   4.912 +			// TODO Auto-generated catch block
   4.913 +			e.printStackTrace();
   4.914 +		}
   4.915 +	}
   4.916  
   4.917 -//    if (!((CalculationModel)model).editNode(current_node, (String)tree.getCellEditor().getCellEditorValue())) {
   4.918 -//      JOptionPane.showMessageDialog(this, "unable to find a way to this step",
   4.919 -//                                      "Error!", JOptionPane.ERROR_MESSAGE);
   4.920 -//    }
   4.921 -      //tree.getModel().valueForPathChanged(tree.getSelectionPath()), o);
   4.922 -    //LK 04.11.17: end of temporary solution:
   4.923 -    try {
   4.924 -      CalcModelNode current_node = (CalcModelNode)tree.getSelectionPath().getLastPathComponent();
   4.925 -      it_ = current_node.getValue();
   4.926 -      if (it_ == null) { // append formula
   4.927 -        //appends after the currently active formula
   4.928 -        edited_formula_ = new CalcFormula();
   4.929 -        edited_formula_.setText((String)o);
   4.930 -        logger.fatal(" WS->DG: UI_SOLVE_APPEND_USER_FORMULA");
   4.931 -        dialog.notifyUserAction(new UserAction(IUserAction.UI_SOLVE_APPEND_USER_FORMULA));
   4.932 -      } else { //replace formula
   4.933 -        logger.fatal(" WS->DG: UI_SOLVE_MOVE_ACTIVE_FORMULA");
   4.934 -        dialog.notifyUserAction(new UserActionOnIterator(IUserAction.UI_SOLVE_MOVE_ACTIVE_FORMULA, it_));
   4.935 -        edited_formula_ = new CalcFormula();
   4.936 -        edited_formula_.setText((String)o);
   4.937 -        edited_formula_.setPosition(it_.getPosition());
   4.938 -        logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA");
   4.939 -        dialog.notifyUserAction(new UserAction(IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA));
   4.940 -      }
   4.941 -    } catch (Exception e1) {
   4.942 -      e1.printStackTrace();
   4.943 -    }
   4.944 -    System.out.println(o);
   4.945 -  }
   4.946 +	/* LK 04.09.01 */
   4.947 +	// to be called from the windowApplication
   4.948 +	public void autoCalc() {
   4.949 +		//if (!this.calculationEnded) {
   4.950 +		try {
   4.951 +			singleStepping = false;
   4.952 +			dialog
   4.953 +					.notifyUserAction(new UserAction(
   4.954 +							IUserAction.UI_CALCULATE_ALL));
   4.955 +			for (int i = 0; i < tree.getRowCount(); i++) {
   4.956 +				tree.expandRow(i);
   4.957 +			}
   4.958 +			this.calculationEnded = true;
   4.959 +		} catch (RemoteException e1) {
   4.960 +			logger.error("actionPerformed", e1.detail);
   4.961 +		} catch (DialogProtocolException e1) {
   4.962 +			logger.error("actionPerformed");
   4.963 +		} //try
   4.964 +		//}//if
   4.965 +	}
   4.966  
   4.967 -  /**
   4.968 -   * @param action
   4.969 -   */
   4.970 -  public boolean doUIAction(IUserAction action) {
   4.971 -    int actionID = action.getActionID();
   4.972 -    switch (actionID) {
   4.973 -      case IUIElement.UI_DO_EDIT_FORMULA:
   4.974 -        try {
   4.975 -          logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE");
   4.976 -          dialog.notifyUserAction(new UserActionOnCalcElement(IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, edited_formula_));
   4.977 -        } catch (RemoteException e) {
   4.978 -          e.printStackTrace();
   4.979 -        } catch (DialogProtocolException e) {
   4.980 -          e.printStackTrace();
   4.981 -        }
   4.982 -        return true;
   4.983 -      case IUIElement.UI_DO_APPEND_FORMULA:
   4.984 -        try {
   4.985 -          logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE");
   4.986 -          dialog.notifyUserAction(new UserActionOnCalcElement(IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, edited_formula_));
   4.987 -        } catch (RemoteException e) {
   4.988 -          e.printStackTrace();
   4.989 -        } catch (DialogProtocolException e) {
   4.990 -          e.printStackTrace();
   4.991 -        }
   4.992 -      default:
   4.993 -        return false;
   4.994 -    }
   4.995 -      
   4.996 -  }
   4.997 -  
   4.998 +	private void startCalc() {
   4.999 +		this.setIterator();
  4.1000 +		this.setTreeTableModel();
  4.1001 +		super.remove(buttonPanel);
  4.1002 +		this.buildMenu();
  4.1003 +		super.remove(chp);
  4.1004 +		//    this.showTacticPanel();
  4.1005 +		this.validate();
  4.1006 +		callProblemAllowed = false;
  4.1007 +	}
  4.1008 +
  4.1009 +	public void startSolving() {
  4.1010 +		try {
  4.1011 +			//    dialog.newCalculation(ch);
  4.1012 +			chp.fillCalcHeadFromTextFields(ch);
  4.1013 +			logger.fatal("WS->DG: UI_SPECIFY_CALCULATE_1");
  4.1014 +			if (dialog.notifyUserAction(new UserAction(
  4.1015 +					IUserAction.UI_SPECIFY_CALCULATE_1))) {
  4.1016 +				startCalc();
  4.1017 +			} else {
  4.1018 +				JOptionPane.showMessageDialog(this,
  4.1019 +						"Please enter a correct CalcHead",
  4.1020 +						"CalcHead not correct", JOptionPane.WARNING_MESSAGE);
  4.1021 +			}
  4.1022 +		} catch (RemoteException e1) {
  4.1023 +			logger.error("actionPerformed", e1.detail);
  4.1024 +		} catch (DialogProtocolException e2) {
  4.1025 +			logger.error("actionPerformed", e2);
  4.1026 +		}
  4.1027 +	}
  4.1028 +
  4.1029 +	public void compCalcHead() {
  4.1030 +		try {
  4.1031 +			chp.fillCalcHeadFromTextFields(ch);
  4.1032 +			dialog.notifyUserAction(new UserAction(
  4.1033 +					IUserAction.UI_SPECIFY_COMPLETE_CALCHEAD));
  4.1034 +			chp.fillTextFieldsFromCalcHead(ch);
  4.1035 +		} catch (Exception e1) {
  4.1036 +			logger.error(e1);
  4.1037 +		}
  4.1038 +	}
  4.1039 +
  4.1040 +	public void checkCalcHead() {
  4.1041 +		try {
  4.1042 +			logger.debug(dialog);
  4.1043 +			dialog.notifyUserAction(new UserAction(
  4.1044 +					IUserAction.UI_SPECIFY_CHECK_CALCHEAD));
  4.1045 +			chp.fillTextFieldsFromCalcHead(ch);
  4.1046 +		} catch (Exception e1) {
  4.1047 +			logger.error(e1);
  4.1048 +		}
  4.1049 +	}
  4.1050 +
  4.1051 +	/**
  4.1052 +	 * shows the applicable tactics, if applied on the activeFormula a
  4.1053 +	 * applicable tactic can be chosen and is applied to this formula
  4.1054 +	 */
  4.1055 +	public void applicableTactics() {
  4.1056 +		try {
  4.1057 +			CalcModelNode node = (CalcModelNode) tree.getSelectionPath()
  4.1058 +					.getLastPathComponent();
  4.1059 +			ICalcIterator it = node.getValue();
  4.1060 +			applicableTactics_ = it.getApplicableTactics(0);
  4.1061 +			buildApplicableTacticsMenu();
  4.1062 +			//      dialog.notifyUserAction(new UserAction(
  4.1063 +			//          IUserAction.UI_SOLVE_GET_APPLICABLE_TACTICS));
  4.1064 +		} catch (Exception e1) {
  4.1065 +			logger.error(e1);
  4.1066 +		}
  4.1067 +	}
  4.1068 +
  4.1069 +	/**
  4.1070 +	 * shows the Tactic that was applied to this formula
  4.1071 +	 *  
  4.1072 +	 */
  4.1073 +	public void tacticApplied() {
  4.1074 +		try {
  4.1075 +			CalcModelNode node = (CalcModelNode) tree.getSelectionPath()
  4.1076 +					.getLastPathComponent();
  4.1077 +			node.tacticString = ((ICalcIterator) node.getValue()).getTactic()
  4.1078 +					.getName();
  4.1079 +			tree.repaint();
  4.1080 +		} catch (Exception e1) {
  4.1081 +			logger.error(e1);
  4.1082 +		}
  4.1083 +	}
  4.1084 +
  4.1085 +	public void assumptions() {
  4.1086 +		try {
  4.1087 +			System.out.println("assumtions");
  4.1088 +		} catch (Exception e1) {
  4.1089 +			logger.error(e1);
  4.1090 +		}
  4.1091 +	}
  4.1092 +
  4.1093 +	public void intermediateSteps() {
  4.1094 +		try {
  4.1095 +			CalcModelNode node = (CalcModelNode) tree.getSelectionPath()
  4.1096 +					.getLastPathComponent();
  4.1097 +			ICalcIterator it = node.getValue();
  4.1098 +			calcTree.intermediateSteps(it);
  4.1099 +		} catch (Exception e1) {
  4.1100 +			logger.error(e1);
  4.1101 +		}
  4.1102 +	}
  4.1103 +
  4.1104 +	//------------- Implementation of ActionListener ----------------
  4.1105 +	public void actionPerformed(ActionEvent e) {
  4.1106 +		if (e.getSource() == startSolving) {
  4.1107 +			startSolving();
  4.1108 +		} else if (e.getSource() == compCalcHead) {
  4.1109 +			compCalcHead();
  4.1110 +		} else if (e.getSource() == checkCalcHead) {
  4.1111 +			checkCalcHead();
  4.1112 +		} else if (e.getSource() == applicableTacticsMenuItem_) {
  4.1113 +			applicableTactics();
  4.1114 +		} else if (e.getSource() == tacticAppliedMenuItem_) {
  4.1115 +			tacticApplied();
  4.1116 +		} else if (e.getSource() == assumptionsMenuItem_) {
  4.1117 +			assumptions();
  4.1118 +		} else if (e.getSource() == intermediateStepsMenuItem_) {
  4.1119 +			intermediateSteps();
  4.1120 +		} else if (e.getActionCommand() != null
  4.1121 +				&& !e.getActionCommand().equals("")) {
  4.1122 +			int pos = Integer.parseInt(e.getActionCommand());
  4.1123 +			Tactic tactic = (Tactic) applicableTactics_.get(pos);
  4.1124 +			try {
  4.1125 +				dialog.notifyUserAction(new UserActionOnCalcElement(
  4.1126 +						IUserAction.UI_SOLVE_SET_NEXT_TACTIC, tactic));
  4.1127 +			} catch (RemoteException e1) {
  4.1128 +				// TODO Auto-generated catch block
  4.1129 +				e1.printStackTrace();
  4.1130 +			} catch (DialogProtocolException e1) {
  4.1131 +				// TODO Auto-generated catch block
  4.1132 +				e1.printStackTrace();
  4.1133 +			}
  4.1134 +		} else {
  4.1135 +			//unexpected event source
  4.1136 +			logger.error("unexpected event source " + e.getSource());
  4.1137 +		}
  4.1138 +	}
  4.1139 +
  4.1140 +	public void calcChanged(CalcChangedEvent event) {
  4.1141 +		logger.debug("single Stepping: " + singleStepping);
  4.1142 +		logger.debug(model);
  4.1143 +		logger.debug("calc" + calc);
  4.1144 +		logger.debug(model);
  4.1145 +		((CalculationModel) model).calcChanged(event);
  4.1146 +		for (int i = 0; i < tree.getRowCount(); i++) {
  4.1147 +			tree.expandRow(i);
  4.1148 +		}
  4.1149 +		tree.setEditable(true);
  4.1150 +	}
  4.1151 +
  4.1152 +	/**
  4.1153 +	 * if the user has canceled the edition, the worksheet should inform the
  4.1154 +	 * dialogGuide
  4.1155 +	 * 
  4.1156 +	 * @see javax.swing.event.CellEditorListener#editingCanceled(javax.swing.event.ChangeEvent)
  4.1157 +	 */
  4.1158 +	public void editingCanceled(ChangeEvent e) {
  4.1159 +		// TODO Auto-generated method stub
  4.1160 +
  4.1161 +	}
  4.1162 +
  4.1163 +	/**
  4.1164 +	 * if the user has changed the value of a node, it should be altered
  4.1165 +	 * 
  4.1166 +	 * @see javax.swing.event.CellEditorListener#editingStopped(javax.swing.event.ChangeEvent)
  4.1167 +	 */
  4.1168 +	public void editingStopped(ChangeEvent e) {
  4.1169 +		Object o = tree.getCellEditor().getCellEditorValue();
  4.1170 +		//TODO: LK 04.11.17: temporary solution:
  4.1171 +
  4.1172 +		//    if (!((CalculationModel)model).editNode(current_node,
  4.1173 +		// (String)tree.getCellEditor().getCellEditorValue())) {
  4.1174 +		//      JOptionPane.showMessageDialog(this, "unable to find a way to this
  4.1175 +		// step",
  4.1176 +		//                                      "Error!", JOptionPane.ERROR_MESSAGE);
  4.1177 +		//    }
  4.1178 +		//tree.getModel().valueForPathChanged(tree.getSelectionPath()), o);
  4.1179 +		//LK 04.11.17: end of temporary solution:
  4.1180 +		try {
  4.1181 +			CalcModelNode current_node = (CalcModelNode) tree
  4.1182 +					.getSelectionPath().getLastPathComponent();
  4.1183 +			it_ = current_node.getValue();
  4.1184 +			if (it_ == null) { // append formula
  4.1185 +				//appends after the currently active formula
  4.1186 +				edited_formula_ = new CalcFormula();
  4.1187 +				edited_formula_.setText((String) o);
  4.1188 +				logger.fatal(" WS->DG: UI_SOLVE_APPEND_USER_FORMULA");
  4.1189 +				dialog.notifyUserAction(new UserAction(
  4.1190 +						IUserAction.UI_SOLVE_APPEND_USER_FORMULA));
  4.1191 +			} else { //replace formula
  4.1192 +				logger.fatal(" WS->DG: UI_SOLVE_MOVE_ACTIVE_FORMULA");
  4.1193 +				dialog.notifyUserAction(new UserActionOnIterator(
  4.1194 +						IUserAction.UI_SOLVE_MOVE_ACTIVE_FORMULA, it_));
  4.1195 +				edited_formula_ = new CalcFormula();
  4.1196 +				edited_formula_.setText((String) o);
  4.1197 +				edited_formula_.setPosition(it_.getPosition());
  4.1198 +				logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA");
  4.1199 +				dialog.notifyUserAction(new UserAction(
  4.1200 +						IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA));
  4.1201 +			}
  4.1202 +		} catch (Exception e1) {
  4.1203 +			e1.printStackTrace();
  4.1204 +		}
  4.1205 +		System.out.println(o);
  4.1206 +	}
  4.1207 +
  4.1208 +	/**
  4.1209 +	 * @param action
  4.1210 +	 */
  4.1211 +	public boolean doUIAction(IUserAction action) {
  4.1212 +		int actionID = action.getActionID();
  4.1213 +		switch (actionID) {
  4.1214 +		case IUIElement.UI_DO_EDIT_FORMULA:
  4.1215 +			try {
  4.1216 +				logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE");
  4.1217 +				dialog.notifyUserAction(new UserActionOnCalcElement(
  4.1218 +						IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE,
  4.1219 +						edited_formula_));
  4.1220 +			} catch (RemoteException e) {
  4.1221 +				e.printStackTrace();
  4.1222 +			} catch (DialogProtocolException e) {
  4.1223 +				e.printStackTrace();
  4.1224 +			}
  4.1225 +			return true;
  4.1226 +		case IUIElement.UI_DO_APPEND_FORMULA:
  4.1227 +			try {
  4.1228 +				logger.fatal(" WS->DG: UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE");
  4.1229 +				dialog.notifyUserAction(new UserActionOnCalcElement(
  4.1230 +						IUserAction.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE,
  4.1231 +						edited_formula_));
  4.1232 +			} catch (RemoteException e) {
  4.1233 +				e.printStackTrace();
  4.1234 +			} catch (DialogProtocolException e) {
  4.1235 +				e.printStackTrace();
  4.1236 +			}
  4.1237 +		default:
  4.1238 +			return false;
  4.1239 +		}
  4.1240 +
  4.1241 +	}
  4.1242 +
  4.1243  }
  4.1244 \ No newline at end of file
     5.1 --- a/src/java/isac/gui/browser/example/ExampleBrowserPanel.java	Wed Apr 13 15:36:03 2005 +0200
     5.2 +++ b/src/java/isac/gui/browser/example/ExampleBrowserPanel.java	Fri Apr 15 18:46:34 2005 +0200
     5.3 @@ -1,11 +1,11 @@
     5.4  /****************************************************************** 
     5.5 -* Copyright (c) 2003, Mario Hochreiter, Student of 
     5.6 -* Software Engineering at FH-Hagenberg, Austria. 
     5.7 -* Project member of the isac team at the Institute for 
     5.8 -* Software-Technologie, Graz University of Technology, Austria. 
     5.9 -* 
    5.10 -* Use is subject to license terms.
    5.11 -******************************************************************/
    5.12 + * Copyright (c) 2003, Mario Hochreiter, Student of 
    5.13 + * Software Engineering at FH-Hagenberg, Austria. 
    5.14 + * Project member of the isac team at the Institute for 
    5.15 + * Software-Technologie, Graz University of Technology, Austria. 
    5.16 + * 
    5.17 + * Use is subject to license terms.
    5.18 + ******************************************************************/
    5.19  
    5.20  package isac.gui.browser.example;
    5.21  
    5.22 @@ -23,6 +23,7 @@
    5.23  
    5.24  import java.awt.event.MouseAdapter;
    5.25  import java.awt.event.MouseEvent;
    5.26 +import java.rmi.RemoteException;
    5.27  
    5.28  import javax.swing.JFrame;
    5.29  import javax.swing.tree.TreePath;
    5.30 @@ -35,40 +36,49 @@
    5.31   */
    5.32  
    5.33  public class ExampleBrowserPanel extends TabPanel {
    5.34 -  static Logger logger = Logger.getLogger(ExampleBrowserPanel.class.getName());
    5.35 -    
    5.36 -  public ExampleBrowserPanel(JFrame root, Hierarchy hierarchy) {
    5.37 -    super(root, hierarchy);
    5.38 -    this.initMouseListener();
    5.39 -  }
    5.40 -  
    5.41 -  protected void initMouseListener() {
    5.42 -    ml = new MouseAdapter() {
    5.43 -      public void mousePressed(MouseEvent e) {
    5.44 -        int selRow = viewTree.getRowForLocation(e.getX(), e.getY());
    5.45 -        TreePath selPath = viewTree.getPathForLocation(e.getX(), e.getY());
    5.46 -        if (selRow != -1) {
    5.47 -          if (e.getClickCount() == 2) {
    5.48 -            ExampleNode selNode = (ExampleNode)selPath.getLastPathComponent();
    5.49 -            ContentPanel cp = root.getContentPanel();
    5.50 -            if (selNode.getContentref() != null) {
    5.51 -              cp.setContent("exp", selNode.getContentref());
    5.52 -              root.showContentFrame();
    5.53 -            } else if (selNode.getExample() != null) {
    5.54 -              cp.setContent("exp", selNode.getExample());
    5.55 -              String xmlString = InformationProcessor.loadXML(
    5.56 -                     root.getSessionId(), "exp", selNode.getExample());
    5.57 -              logger.info(xmlString);
    5.58 -              FormalizationDigest fd = new FormalizationDigest();
    5.59 -              Formalization f = fd.parseFormalization(xmlString);
    5.60 -              logger.info(f.toSMLString());
    5.61 -              root.openNewWorksheetWithCalchead(f, DialogGuide.STARTFROM_EXAMPLE, 
    5.62 -                                    CalcHead.VIEWSTYLE_SIMPLE_SOLVE); //TODO WN040823 ask DG !
    5.63 -            }
    5.64 -          }
    5.65 -        }
    5.66 -      }
    5.67 -    };
    5.68 -    viewTree.addMouseListener(ml);
    5.69 -  }
    5.70 -}
    5.71 +	static Logger logger_ = Logger.getLogger(ExampleBrowserPanel.class
    5.72 +			.getName());
    5.73 +
    5.74 +	public ExampleBrowserPanel(JFrame root, Hierarchy hierarchy) {
    5.75 +		super(root, hierarchy);
    5.76 +		this.initMouseListener();
    5.77 +	}
    5.78 +
    5.79 +	protected void initMouseListener() {
    5.80 +		ml = new MouseAdapter() {
    5.81 +			public void mousePressed(MouseEvent e) {
    5.82 +				int selRow = viewTree.getRowForLocation(e.getX(), e.getY());
    5.83 +				TreePath selPath = viewTree.getPathForLocation(e.getX(), e
    5.84 +						.getY());
    5.85 +				if (selRow != -1) {
    5.86 +					if (e.getClickCount() == 2) {
    5.87 +						ExampleNode selNode = (ExampleNode) selPath
    5.88 +								.getLastPathComponent();
    5.89 +						ContentPanel cp = root.getContentPanel();
    5.90 +						if (selNode.getContentref() != null) {
    5.91 +							cp.setContent("exp", selNode.getContentref());
    5.92 +							root.showContentFrame();
    5.93 +						} else if (selNode.getExample() != null) {
    5.94 +							cp.setContent("exp", selNode.getExample());
    5.95 +							String xmlString = InformationProcessor.loadXML(
    5.96 +									root.getSessionId(), "exp", selNode
    5.97 +											.getExample());
    5.98 +							logger_.info(xmlString);
    5.99 +							FormalizationDigest fd = new FormalizationDigest();
   5.100 +							Formalization f = fd.parseFormalization(xmlString);
   5.101 +							logger_.info(f.toSMLString());
   5.102 +							try {
   5.103 +								root.openNewWorksheet(f,
   5.104 +										DialogGuide.STARTFROM_EXAMPLE);
   5.105 +							} catch (RemoteException e1) {
   5.106 +								// TODO Auto-generated catch block
   5.107 +								e1.printStackTrace();
   5.108 +							}
   5.109 +						}
   5.110 +					}
   5.111 +				}
   5.112 +			}
   5.113 +		};
   5.114 +		viewTree.addMouseListener(ml);
   5.115 +	}
   5.116 +}
   5.117 \ No newline at end of file