use of edu.cmu.cs.hcii.cogtool.model.HandLocation in project cogtool by cogtool.
the class SEDemoController method createSetHandLocationAction.
protected IListenerAction createSetHandLocationAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return HandLocation.class;
}
public boolean performAction(Object prms) {
HandLocation handLoc = (HandLocation) prms;
if (handLoc != null) {
setHandLocationAction(handLoc);
return true;
}
interaction.protestNoHandLocation();
return false;
}
};
}
use of edu.cmu.cs.hcii.cogtool.model.HandLocation in project cogtool by cogtool.
the class SEDemoController method setHandLocationAction.
protected void setHandLocationAction(final HandLocation handLoc) {
final Demonstration demo = script.getDemonstration();
final boolean mouseHand = demo.getMouseHand();
final DefaultModelGeneratorState initialState = demo.getInitialState();
final HandLocation oldLoc = initialState.getHandLocation(mouseHand);
final DemoStateManager.IConformanceUndoRedo conformanceUndoRedo = demoStateMgr.restoreConformance(demo);
initialState.setHandLocation(mouseHand, handLoc);
demo.alertInitialStateChange();
final Collection<ComputationUndoRedo> scriptsUndoRedos = DemoScriptCmd.regenerateScripts(demo, 0, demo.getStepAt(0), interaction);
IUndoableEdit edit = new AUndoableEdit(SEDemoLID.SetHandLocation) {
@Override
public String getPresentationName() {
return SET_HAND_LOCATION;
}
@Override
public void redo() {
super.redo();
conformanceUndoRedo.redo();
initialState.setHandLocation(mouseHand, handLoc);
demo.alertInitialStateChange();
DemoScriptCmd.redoAllChanges(scriptsUndoRedos);
}
@Override
public void undo() {
super.undo();
conformanceUndoRedo.undo();
initialState.setHandLocation(mouseHand, oldLoc);
demo.alertInitialStateChange();
DemoScriptCmd.undoAllChanges(scriptsUndoRedos);
}
};
undoMgr.addEdit(edit);
}
use of edu.cmu.cs.hcii.cogtool.model.HandLocation in project cogtool by cogtool.
the class SEFrameChooserController method setHandLocationAction.
protected void setHandLocationAction(final HandLocation handLoc) {
final Demonstration demo = taskApp.getDemonstration();
final boolean mouseHand = demo.getMouseHand();
final DefaultModelGeneratorState initialState = demo.getInitialState();
final HandLocation oldLoc = initialState.getHandLocation(mouseHand);
initialState.setHandLocation(mouseHand, handLoc);
demo.alertInitialStateChange();
undoMgr.addEdit(new AUndoableEdit(SEFrameChooserLID.SetHandLocation) {
@Override
public String getPresentationName() {
return setHandLocation;
}
@Override
public void redo() {
super.redo();
initialState.setHandLocation(mouseHand, handLoc);
demo.alertInitialStateChange();
}
@Override
public void undo() {
super.undo();
initialState.setHandLocation(mouseHand, oldLoc);
demo.alertInitialStateChange();
}
});
}
use of edu.cmu.cs.hcii.cogtool.model.HandLocation in project cogtool by cogtool.
the class SEFrameChooserController method createSetHandLocationAction.
protected IListenerAction createSetHandLocationAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return HandLocation.class;
}
public boolean performAction(Object prms) {
HandLocation handLoc = (HandLocation) prms;
if (handLoc != null) {
setHandLocationAction(handLoc);
return true;
}
interaction.protestNoHandLocation();
return false;
}
};
}
use of edu.cmu.cs.hcii.cogtool.model.HandLocation in project cogtool by cogtool.
the class SEFrameChooserController method setMouseHandAction.
protected void setMouseHandAction(final boolean mouseHand) {
final Demonstration demo = taskApp.getDemonstration();
final boolean oldMouseHand = demo.getMouseHand();
final DefaultModelGeneratorState initialState = demo.getInitialState();
final HandLocation mouseHandLoc = initialState.getHandLocation(oldMouseHand);
demo.setMouseHand(mouseHand);
initialState.setHandLocation(mouseHand, mouseHandLoc);
initialState.setHandLocation(!mouseHand, HandLocation.OnKeyboard);
undoMgr.addEdit(new AUndoableEdit(SEFrameChooserLID.SetMouseHand) {
@Override
public String getPresentationName() {
return setMouseHand;
}
@Override
public void redo() {
super.redo();
initialState.setHandLocation(mouseHand, mouseHandLoc);
initialState.setHandLocation(!mouseHand, HandLocation.OnKeyboard);
// Do this last as it will alert
demo.setMouseHand(mouseHand);
}
@Override
public void undo() {
super.undo();
initialState.setHandLocation(oldMouseHand, mouseHandLoc);
initialState.setHandLocation(!oldMouseHand, HandLocation.OnKeyboard);
// Do this last as it will alert
demo.setMouseHand(oldMouseHand);
}
});
}
Aggregations