diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/ant.xml b/.idea/ant.xml new file mode 100644 index 0000000..a2a4769 --- /dev/null +++ b/.idea/ant.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/cogtool-intellij2.iml b/.idea/cogtool-intellij2.iml new file mode 100644 index 0000000..a63dc2d --- /dev/null +++ b/.idea/cogtool-intellij2.iml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/build.xml b/.idea/libraries/build.xml new file mode 100644 index 0000000..d0ee774 --- /dev/null +++ b/.idea/libraries/build.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..422f135 --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e6bd007 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..901751d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/java/edu/cmu/cs/hcii/cogtool/model/Design.java b/java/edu/cmu/cs/hcii/cogtool/model/Design.java index 700a9ff..ff1be3b 100644 --- a/java/edu/cmu/cs/hcii/cogtool/model/Design.java +++ b/java/edu/cmu/cs/hcii/cogtool/model/Design.java @@ -666,7 +666,7 @@ public static class FrameSetChange extends EventObject * Initialize the semantic change representing an add or a remove. * * @param design the design that was modified - * @param frames the frames added or removed + * @param frameChg the frames added or removed * @param add a flag indicating whether the change is an add * or a remove * @author mlh diff --git a/java/edu/cmu/cs/hcii/cogtool/model/DesignTest.java b/java/edu/cmu/cs/hcii/cogtool/model/DesignTest.java new file mode 100644 index 0000000..23029ae --- /dev/null +++ b/java/edu/cmu/cs/hcii/cogtool/model/DesignTest.java @@ -0,0 +1,27 @@ +package edu.cmu.cs.hcii.cogtool.model; + +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + +import static org.junit.Assert.*; + +public class DesignTest { + + private String designName = "My First Design"; + Set deviceTypeSet = new HashSet(); + private Design aDesign = new Design(designName, deviceTypeSet); + + @Test + public void getName() { + assertEquals(designName, aDesign.getName()); + } + + @Test + public void setName() { + String designName = "My Second Design"; + aDesign.setName(designName); + assertEquals(designName, aDesign.name); + } +} \ No newline at end of file diff --git a/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUI.java b/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUI.java index 966ef57..99456d3 100644 --- a/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUI.java +++ b/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUI.java @@ -168,7 +168,7 @@ protected class FrameNameEditor extends SWTTextEditor { public FrameNameEditor() { - super(view.getEditor().getSWTEditorSubstrate(), CENTER_TEXT); + super(DesignEditorUI.this.view.getEditor().getSWTEditorSubstrate(), CENTER_TEXT); } @Override diff --git a/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUITest.java b/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUITest.java new file mode 100644 index 0000000..8bdda76 --- /dev/null +++ b/java/edu/cmu/cs/hcii/cogtool/ui/DesignEditorUITest.java @@ -0,0 +1,26 @@ +package edu.cmu.cs.hcii.cogtool.ui; + +import edu.cmu.cs.hcii.cogtool.model.Design; +import edu.cmu.cs.hcii.cogtool.model.DeviceType; +import edu.cmu.cs.hcii.cogtool.model.Project; +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + +import static org.junit.Assert.*; + +public class DesignEditorUITest { + + @Test + public void buildWindowMenuLabel() { + Project aProject = new Project("My First Project"); + + String designName = "My First Design"; + Set deviceTypeSet = new HashSet(); + Design aDesign = new Design(designName, deviceTypeSet); + + DesignEditorUI anEditorUI = new DesignEditorUI(aDesign,aProject, null); + assertEquals("Design: " + designName, anEditorUI.buildWindowMenuLabel(aDesign)); + } +} \ No newline at end of file diff --git a/java/edu/cmu/cs/hcii/cogtool/ui/FrameEditorUI.java b/java/edu/cmu/cs/hcii/cogtool/ui/FrameEditorUI.java index eb303bd..0a09feb 100644 --- a/java/edu/cmu/cs/hcii/cogtool/ui/FrameEditorUI.java +++ b/java/edu/cmu/cs/hcii/cogtool/ui/FrameEditorUI.java @@ -1055,7 +1055,7 @@ protected class WidgetTitleEditor extends SWTTextEditor { public WidgetTitleEditor() { - super(view.getEditor().getSWTEditorSubstrate(), LEFT_JUSTIFY); + super(FrameEditorUI.this.view.getEditor().getSWTEditorSubstrate(), LEFT_JUSTIFY); } @Override diff --git a/java/edu/cmu/cs/hcii/cogtool/ui/UI.java b/java/edu/cmu/cs/hcii/cogtool/ui/UI.java index 008b3b4..861fea3 100644 --- a/java/edu/cmu/cs/hcii/cogtool/ui/UI.java +++ b/java/edu/cmu/cs/hcii/cogtool/ui/UI.java @@ -671,7 +671,6 @@ public void setEnabled(CogToolLID id, Boolean availability, boolean enable) * @param newLabel if not null, the new label to use for the user interface * widgets associated with the given id that support labels * @author mlh - * @see ListenerIdentifierMap.getWidgets */ public void setEnabled(CogToolLID id, @@ -700,7 +699,6 @@ public void setEnabled(CogToolLID id, * widgets associated with the given id that support labels * @param selected for all associated widgets that are MenuItems set * their selection state to this - * @see ListenerIdentifierMap.getWidgets */ public void setEnabled(CogToolLID id, Boolean availability, @@ -1250,8 +1248,6 @@ protected boolean doesIDCommitChanges(ListenerIdentifier lid) * from the appropriate IUndoableEdit from the given undo manager. * * @param lid the CogTool command being queried - * @param undoMgr the window's undo manager in case the given LID is - * CogToolLID.Undo or CogToolLID.Redo * @return whether the given LID is a CogToolLID that * can cause selection */ diff --git a/java/edu/cmu/cs/hcii/cogtool/view/ActionPropertySet.java b/java/edu/cmu/cs/hcii/cogtool/view/ActionPropertySet.java index 1ea2aaf..652e2d8 100644 --- a/java/edu/cmu/cs/hcii/cogtool/view/ActionPropertySet.java +++ b/java/edu/cmu/cs/hcii/cogtool/view/ActionPropertySet.java @@ -1169,7 +1169,7 @@ protected void onFocus() { super.onFocus(); - view.getTransmuter().setLIDEnabledState(); + ActionPropertySet.this.view.getTransmuter().setLIDEnabledState(); } @Override @@ -1182,7 +1182,7 @@ protected boolean doChangeAction() labelSelection = null; } - if (view.performAction(DesignEditorLID.ChangeDelay)) { + if (ActionPropertySet.this.view.performAction(DesignEditorLID.ChangeDelay)) { if (labelSelection != null) { setSelection(labelSelection); } @@ -1208,7 +1208,7 @@ protected void onFocus() { super.onFocus(); - view.getTransmuter().setLIDEnabledState(); + ActionPropertySet.this.view.getTransmuter().setLIDEnabledState(); } @Override @@ -1229,7 +1229,7 @@ protected boolean doChangeAction() delaySelection = null; } - if (view.performAction(DesignEditorLID.ChangeDelay)) { + if (ActionPropertySet.this.view.performAction(DesignEditorLID.ChangeDelay)) { if (delaySelection != null) { setSelection(delaySelection); } @@ -1340,7 +1340,7 @@ protected void onFocus() { super.onFocus(); - view.getTransmuter().setLIDEnabledState(); + ActionPropertySet.this.view.getTransmuter().setLIDEnabledState(); } @Override @@ -1351,7 +1351,7 @@ protected boolean doChangeAction() DesignEditorUI.DesignRenameParameters parms = new DesignEditorUI.DesignRenameParameters(design, designName.getText()); - boolean changed = view.performAction(ProjectLID.RenameDesign, + boolean changed = ActionPropertySet.this.view.performAction(ProjectLID.RenameDesign, parms, true); diff --git a/java/edu/cmu/cs/hcii/cogtool/view/FramePropertiesPane.java b/java/edu/cmu/cs/hcii/cogtool/view/FramePropertiesPane.java index dabe5f1..9dad996 100644 --- a/java/edu/cmu/cs/hcii/cogtool/view/FramePropertiesPane.java +++ b/java/edu/cmu/cs/hcii/cogtool/view/FramePropertiesPane.java @@ -155,13 +155,17 @@ public class FramePropertiesPane extends Composite private TreeItemUpdater eltGroupUpdater; private TreeItemUpdater implicitGroupUpdater; + protected View view; + public FramePropertiesPane(Composite parent, int style, View view) { super(parent, style); setLayout(new FormLayout()); - createWidgets(view); + this.view = view; + + createWidgets(); layOutWidgets(); } @@ -234,7 +238,7 @@ protected void layOutWidgets() } } - protected void createWidgets(final View view) + protected void createWidgets() { ListenerIdentifierMap lidMap = view.getLIDMap(); @@ -249,7 +253,7 @@ protected void onFocus() { super.onFocus(); - view.getTransmuter().setLIDEnabledState(); + FramePropertiesPane.this.view.getTransmuter().setLIDEnabledState(); } @Override @@ -259,7 +263,7 @@ protected boolean doChangeAction() DesignEditorUI.FrameRenameParameters evt = new DesignEditorUI.FrameRenameParameters(frame, getText()); boolean changed = - view.performAction(DesignEditorLID.RenameFrame, + FramePropertiesPane.this.view.performAction(DesignEditorLID.RenameFrame, evt, true); diff --git a/java/edu/cmu/cs/hcii/cogtool/view/WidgetPropertiesPane.java b/java/edu/cmu/cs/hcii/cogtool/view/WidgetPropertiesPane.java index aa034d1..25e3558 100644 --- a/java/edu/cmu/cs/hcii/cogtool/view/WidgetPropertiesPane.java +++ b/java/edu/cmu/cs/hcii/cogtool/view/WidgetPropertiesPane.java @@ -164,7 +164,7 @@ public WidgetChangeText(Composite parent, * If no widgets are selected, suppresses the event. * * IE: raise an LID event. - * @param e + * @param focusRule */ @Override public boolean confirm(int focusRule) @@ -563,9 +563,9 @@ protected boolean doChangeAction() FrameEditorUI.SetRemoteLabelTypeParms setTypeParms = new FrameEditorUI.SetRemoteLabelTypeParms(widgetTypeChoices[selectedType], - view.selection.getSelectedIWidgets()[0]); + WidgetPropertiesPane.this.view.selection.getSelectedIWidgets()[0]); - return view.performAction(FrameEditorLID.SetRemoteLabelType, + return WidgetPropertiesPane.this.view.performAction(FrameEditorLID.SetRemoteLabelType, setTypeParms, true); }