use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method setFrameChangeHandlers.
protected void setFrameChangeHandlers(final Design design) {
design.addHandler(this, NameChangeAlert.class, renameHandler);
AlertHandler frameChangeHandler = new AlertHandler() {
public void handleAlert(EventObject alert) {
Design.FrameChange chg = (Design.FrameChange) alert;
if (chg != null) {
updateView(false);
Frame frame = (Frame) chg.element;
if (chg.isAdd) {
DesignEditorFrame frameFigure = structureView.getFrameFigure(frame);
// A newly created frame should be selected.
delayedFrameSelection.addToSelection(frame, frameFigure);
} else {
delayedFrameSelection.removeFromSelection(frame);
}
delayedRepainting.requestRepaint(REPAINT_ALL);
}
}
};
design.addHandler(this, Design.FrameChange.class, frameChangeHandler);
frameChangeHandler = new AlertHandler() {
public void handleAlert(EventObject alert) {
Design.FrameSetChange chg = (Design.FrameSetChange) alert;
if (chg != null) {
updateView(false);
if (chg.isAdd) {
for (Frame frame : chg.frames) {
DesignEditorFrame frameFigure = structureView.getFrameFigure(frame);
// A newly created frame should be selected.
delayedFrameSelection.addToSelection(frameFigure.getFrame(), frameFigure);
}
delayedRepainting.requestRepaint(REPAINT_ALL);
} else {
for (Frame frame : chg.frames) {
delayedFrameSelection.removeFromSelection(frame);
}
}
}
}
};
design.addHandler(this, Design.FrameSetChange.class, frameChangeHandler);
design.addHandler(this, Design.DeviceTypeChange.class, new AlertHandler() {
public void handleAlert(EventObject alert) {
Set<DeviceType> deviceTypeSet = design.getDeviceTypes();
int deviceTypes = DeviceType.buildDeviceSet(deviceTypeSet);
view.resetDeviceTypes(deviceTypes);
}
});
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method getParameters.
@Override
public Object getParameters(ListenerIdentifier originalLID, ListenerIdentifier transmutedLID, boolean isContextSelection) {
Object parameters = super.getParameters(originalLID, transmutedLID, isContextSelection);
if (parameters != UNSET) {
return parameters;
}
setUpPerformAction(transmutedLID);
DesignEditorSelectionState selnStateToUse = isContextSelection ? contextSelection : selection;
if (transmutedLID == CogToolLID.PasteBackgroundImage) {
return new DesignEditorUI.PasteBackgroundImageParms(selnStateToUse, ClipboardUtil.fetchImageData());
}
// Merged paths for editing widgets, since GRAFFITI crosses both
if ((transmutedLID == DesignEditorLID.ChangeWidgetAction) || (transmutedLID == DesignEditorLID.ChangeDeviceAction)) {
return new DesignEditorUI.ChangeActionParameters(view.getActionProperties(), selnStateToUse);
}
if (transmutedLID == DesignEditorLID.ChangeDelay) {
ActionProperties properties = view.getActionProperties();
return new DesignEditorUI.ChangeDelayParameters(properties.delayInSecs, properties.delayLabel, selnStateToUse);
}
if (transmutedLID == DesignEditorLID.DuplicateFrame) {
return new DesignEditorUI.DuplicateParameters(16.0, 16.0, selnStateToUse);
}
if (transmutedLID == DesignEditorLID.EditTransition) {
return new DesignEditorUI.EditTransitionParameters(selnStateToUse, ActionProperties.UNSET);
}
if (transmutedLID == DesignEditorLID.AlignTop || transmutedLID == DesignEditorLID.AlignBottom || transmutedLID == DesignEditorLID.AlignLeft || transmutedLID == DesignEditorLID.AlignRight || transmutedLID == DesignEditorLID.AlignCenter || transmutedLID == DesignEditorLID.AlignHorizCenter || transmutedLID == DesignEditorLID.AlignVertCenter || transmutedLID == DesignEditorLID.SpaceHorizontally || transmutedLID == DesignEditorLID.SpaceVertically) {
Frame[] frames = selection.getSelectedFrames();
Map<Frame, DoubleRectangle> frameMap = new HashMap<Frame, DoubleRectangle>();
for (Frame frame : frames) {
DesignEditorFrame figure = structureView.getFrameFigure(frame);
Rectangle bounds = figure.getBounds();
frameMap.put(frame, new DoubleRectangle(bounds.x, bounds.y, bounds.width, bounds.height));
}
return frameMap;
}
return selnStateToUse;
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method initiateFrameRename.
/**
* Triggers the frame-renaming functionality in the UI on the given
* frame.
*/
public void initiateFrameRename(Frame frameToRename) {
DesignEditorFrame renameFrameFigure = structureView.getFrameFigure(frameToRename);
initiateFrameRename(renameFrameFigure);
}
Aggregations