use of edu.cmu.cs.hcii.cogtool.view.ActionPropertySet in project cogtool by cogtool.
the class DesignEditorUI method createFrameSelectionHandler.
protected AlertHandler createFrameSelectionHandler() {
return new AlertHandler() {
public void handleAlert(EventObject alert) {
FrameSelectionChange evt = (FrameSelectionChange) alert;
ActionPropertySet actionProps = view.getActionPropertySet();
if (evt != null) {
if (evt.changedFrameFigure != null) {
evt.changedFrameFigure.setSelected(evt.selected);
// Handle property sheet selection
Frame[] selectedFrames = selection.getSelectedFrames();
int selectedFrameCount = selectedFrames.length;
if (selectedFrameCount > 0) {
actionProps.setComposite(ActionPropertySet.FRAME);
if (selectedFrameCount == 1) {
actionProps.setFrameName(selectedFrames[0]);
}
} else {
actionProps.setComposite(ActionSet.USE_NONE);
}
actionProps.enableFrameName(selectedFrameCount == 1);
} else {
actionProps.setComposite(ActionSet.USE_NONE);
Iterator<DesignEditorFrame> frameFigures = selection.getSelectedFrameFigures();
while (frameFigures.hasNext()) {
DesignEditorFrame frameFigure = frameFigures.next();
frameFigure.setSelected(evt.selected);
}
}
// Repaint the frame contents
delayedRepainting.requestRepaint(REPAINT_ALL);
}
}
};
}
use of edu.cmu.cs.hcii.cogtool.view.ActionPropertySet in project cogtool by cogtool.
the class DesignEditorUI method updateView.
protected void updateView(boolean deselectAll) {
if (view.isDisposed()) {
return;
}
ActionPropertySet actionProps = view.getActionPropertySet();
int selectedTransitionCount = selection.getSelectedTransitionCount();
int selectedFrameCount = selection.getSelectedFrameCount();
if (deselectAll || (selectedFrameCount + selectedTransitionCount == 0)) {
actionProps.useParameters(ActionSet.USE_NONE);
} else if (selectedTransitionCount == 1) {
Transition transition = selection.getSelectedTransitions()[0];
AAction action = transition.getAction();
DeviceType type = action.getDefaultDeviceType();
int device = ActionSet.USE_NONE;
if (action instanceof GraffitiAction) {
device = ActionSet.USE_GRAFFITI_WIDGET;
} else if (type == DeviceType.Mouse) {
device = ActionSet.USE_MOUSE;
} else if (type == DeviceType.Touchscreen) {
device = ActionSet.USE_TOUCHSCREEN;
} else if (type == DeviceType.Keyboard) {
device = ActionSet.USE_KEYBOARD;
} else if (type == DeviceType.Voice) {
device = ActionSet.USE_VOICE;
} else if (type == null) {
// Generally, a hover action; pick whichever is active
if (actionProps.isMouseSelected()) {
device = ActionSet.USE_MOUSE;
} else if (actionProps.isTouchSelected()) {
device = ActionSet.USE_TOUCHSCREEN;
}
}
actionProps.setComposite(device);
ActionProperties properties = view.getActionProperties();
view.getDefaultProperties(properties);
properties.updateProperties(transition, transition.getAction(), transition.getSource());
int limitMode = ActionProperties.determineChangeActionMode(transition.getSource());
actionProps.setLimitMode(limitMode, properties.useWhichParts);
actionProps.setProperties(properties, properties.useWhichParts);
} else if (selectedTransitionCount > 1) {
actionProps.useParameters(ActionPropertySet.MULT_TRANS);
}
if (selectedFrameCount == 1) {
actionProps.updateFrameComposite(selection.getSelectedFrames()[0]);
} else if ((selectedFrameCount == 0) && (selectedTransitionCount == 0)) {
actionProps.updateEmptyComposite(design, false);
}
}
Aggregations