*** empty log message ***
authormhochrei
Thu, 25 Sep 2003 13:20:40 +0200
changeset 906b4887a244e2c
parent 905 327abf822a1e
child 907 0ca545b2df63
*** empty log message ***
src/java/isac/bridge/CalcIterator.java
src/java/isac/gui/treetable/CalculationModel.java
src/java/isac/gui/worksheet/Worksheet.java
src/java/isac/util/ModSpec.java
src/java/isac/wsdialog/DialogGuide.java
     1.1 --- a/src/java/isac/bridge/CalcIterator.java	Wed Sep 24 23:26:51 2003 +0200
     1.2 +++ b/src/java/isac/bridge/CalcIterator.java	Thu Sep 25 13:20:40 2003 +0200
     1.3 @@ -3,13 +3,13 @@
     1.4   */
     1.5  package isac.bridge;
     1.6  
     1.7 -import isac.util.Formula;
     1.8 -import isac.util.Tactic;
     1.9 +import isac.util.CalcElement;
    1.10 +import isac.wsdialog.ICalcIterator;
    1.11  
    1.12  /**
    1.13   * @author rgradisc
    1.14   */
    1.15 -public class CalcIterator {
    1.16 +public class CalcIterator implements ICalcIterator {
    1.17  	
    1.18    private CalcTree calcTree;
    1.19    private int ID;
    1.20 @@ -20,7 +20,7 @@
    1.21    reference the root element of the attached calculation tree 
    1.22    * @param calcTree calculation tree
    1.23    */
    1.24 -  CalcIterator(CalcTree calcTree) {
    1.25 +  public CalcIterator(CalcTree calcTree) {
    1.26    	this.calcTree = calcTree;  	
    1.27    }
    1.28  
    1.29 @@ -102,22 +102,16 @@
    1.30    	return true;
    1.31    }
    1.32  
    1.33 -  /**
    1.34 -  ??? SDD refFormula
    1.35 -  * @return 
    1.36 -  */ 
    1.37 +  /* /**
    1.38    public Formula getFormula() {
    1.39      return new Formula();
    1.40    }
    1.41  
    1.42 -  /**
    1.43 -  ??? SDD refTactic
    1.44 -  * @return 
    1.45 -  */ 
    1.46    public Tactic getTactic() {
    1.47      return new Tactic();
    1.48    }
    1.49 -
    1.50 +   */
    1.51 +   
    1.52    /**
    1.53    The current level of nesting into subcalculations.
    1.54    * @return An int representing level of nesting (higher == more detailed)
    1.55 @@ -127,4 +121,12 @@
    1.56    public int getLevel() {
    1.57      return 0;
    1.58    }
    1.59 +
    1.60 +  /* (non-Javadoc)
    1.61 +   * @see isac.wsdialog.ICalcIterator#getElement()
    1.62 +   */
    1.63 +  public CalcElement getElement() {
    1.64 +    // TODO Auto-generated method stub
    1.65 +    return null;
    1.66 +  }
    1.67  }
     2.1 --- a/src/java/isac/gui/treetable/CalculationModel.java	Wed Sep 24 23:26:51 2003 +0200
     2.2 +++ b/src/java/isac/gui/treetable/CalculationModel.java	Thu Sep 25 13:20:40 2003 +0200
     2.3 @@ -8,6 +8,8 @@
     2.4  ******************************************************************/
     2.5  package isac.gui.treetable;
     2.6  
     2.7 +import isac.wsdialog.ICalcIterator;
     2.8 +
     2.9  import java.io.Serializable;
    2.10  
    2.11  /**
    2.12 @@ -17,19 +19,30 @@
    2.13   */
    2.14  public class CalculationModel extends AbstractTreeTableModel 
    2.15                                implements Serializable {
    2.16 -
    2.17 -	/**
    2.18 +   /**
    2.19  	 * @param root the root element of the <code>CalculationModel</code>
    2.20  	 */
    2.21  	public CalculationModel(Object root) {
    2.22 -		super(root);
    2.23 +    super(root);
    2.24  	}
    2.25  
    2.26  	/**
    2.27 +	 * @return The root element of the <code>CalculationTree</code>
    2.28 +   * @throws IllegalArgumenException
    2.29 +	 */
    2.30 +	public Object getRoot() {
    2.31 +		if (root instanceof ICalcIterator) {
    2.32 +      return ((ICalcIterator)root).getElement();           
    2.33 +		}
    2.34 +    throw new IllegalArgumentException("CalculationModel can only handle objects" +
    2.35 +                                       "that implement ICalciterator");
    2.36 +	}
    2.37 +	
    2.38 +	/**
    2.39  	* @see isac.gui.JTreeTable.TreeTableModel#getColumnCount()
    2.40  	*/
    2.41  	public int getColumnCount() {
    2.42 -		return 0;
    2.43 +		return 0;				
    2.44  	}
    2.45  
    2.46  	/**
    2.47 @@ -50,13 +63,13 @@
    2.48  	* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
    2.49  	*/
    2.50  	public int getChildCount(Object parent) {
    2.51 -		return 0;
    2.52 +		return 0;						
    2.53  	}
    2.54  
    2.55  	/**
    2.56  	* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
    2.57  	*/
    2.58  	public Object getChild(Object parent, int index) {
    2.59 -		return null;
    2.60 +	  return null;
    2.61  	}	
    2.62  }
     3.1 --- a/src/java/isac/gui/worksheet/Worksheet.java	Wed Sep 24 23:26:51 2003 +0200
     3.2 +++ b/src/java/isac/gui/worksheet/Worksheet.java	Thu Sep 25 13:20:40 2003 +0200
     3.3 @@ -3,16 +3,15 @@
     3.4  * Software Engineering at FH-Hagenberg, Austria. 
     3.5  * Project member of the isac team at the Institute for 
     3.6  * Software-Technologie, Graz University of Technology, Austria. 
     3.7 -* 
     3.8 +* * 
     3.9  * Use is subject to license terms.
    3.10  ******************************************************************/
    3.11  package isac.gui.worksheet;
    3.12  
    3.13 -import isac.bridge.CalcTree;
    3.14 -import isac.gui.JTreeTable.JTreeTable;
    3.15 -import isac.gui.JTreeTable.TreeTableModel;
    3.16 +import isac.gui.treetable.*;
    3.17 +import isac.wsdialog.*;
    3.18  
    3.19 -import javax.swing.JPanel;
    3.20 +import javax.swing.*;
    3.21  
    3.22  /**
    3.23   * <code>Worksheet</code> is the component that is responsible for the
    3.24 @@ -29,13 +28,24 @@
    3.25   * @author Mario Hochreiter
    3.26   * @version 0.1 15/09/2003
    3.27   */
    3.28 -public class Worksheet extends JPanel {
    3.29 +public class Worksheet extends JPanel implements IToUser {
    3.30  	/** Model for the JTreeTable */
    3.31  	protected TreeTableModel model;		
    3.32  	/** Used to represent the model. */
    3.33  	protected JTreeTable treeTable;
    3.34 -			
    3.35 -	public Worksheet(CalcTree tree) {
    3.36 -		
    3.37 +  /** Dialog which is responsible for the communication with the KI*/					
    3.38 +	protected DialogGuide dialog;				
    3.39 +					
    3.40 +	public Worksheet(DialogGuide dialogGuide) {
    3.41 +    dialog = dialogGuide;
    3.42 +    ICalcIterator calcIterator = dialog.iterator();
    3.43 +    model = new CalculationModel(calcIterator);
    3.44 +		treeTable = new JTreeTable(model);
    3.45 +	  this.add(new JScrollPane(treeTable));
    3.46  	}
    3.47 +	
    3.48 +	//------------- Implementation of IToUser -----------------------
    3.49 +	public void calcChanged(CalcChangedEvent event) {
    3.50 +	
    3.51 +	}		
    3.52  }
    3.53 \ No newline at end of file
     4.1 --- a/src/java/isac/util/ModSpec.java	Wed Sep 24 23:26:51 2003 +0200
     4.2 +++ b/src/java/isac/util/ModSpec.java	Thu Sep 25 13:20:40 2003 +0200
     4.3 @@ -38,7 +38,7 @@
     4.4  	 * @see isac.util.CalcElement#getType()
     4.5  	 */
     4.6  	public int getType() {
     4.7 -		return CALCEL_MODSPEC;
     4.8 +		return CALCEL_MODSPEC;		
     4.9  	}
    4.10  	
    4.11  	protected ModSpecFormulaListEl given_, where_, find_, relate_; 
     5.1 --- a/src/java/isac/wsdialog/DialogGuide.java	Wed Sep 24 23:26:51 2003 +0200
     5.2 +++ b/src/java/isac/wsdialog/DialogGuide.java	Thu Sep 25 13:20:40 2003 +0200
     5.3 @@ -1,7 +1,8 @@
     5.4  package isac.wsdialog;
     5.5  
     5.6 -import isac.bridge.*;
     5.7 -import isac.util.*;
     5.8 +import isac.bridge.CalcIterator;
     5.9 +import isac.bridge.CalcTree;
    5.10 +import isac.util.ModSpec;
    5.11  
    5.12  /**
    5.13   * @autor Alan Krempler
    5.14 @@ -33,7 +34,7 @@
    5.15  	 */
    5.16  	public ICalcIterator iterator() {
    5.17  		// TODO Auto-generated method stub
    5.18 -		return null;
    5.19 +		return new CalcIterator(new CalcTree());
    5.20  	}
    5.21  
    5.22  	/* (non-Javadoc)