use of edu.cmu.cs.hcii.cogtool.model.DoubleRectangle in project cogtool by cogtool.
the class FrameEditorUI method getParameters.
/**
* The get parameters function returns the correct parameters needed for
* a particular LID.
*/
@Override
public Object getParameters(ListenerIdentifier originalLID, ListenerIdentifier transmutedLID, boolean isContextSelection) {
// Check the general LID, if it is to restore the parent, then
// return the super's get parameters
Object parameters = super.getParameters(originalLID, transmutedLID, isContextSelection);
if (parameters != UNSET) {
return parameters;
}
setUpPerformAction(transmutedLID);
FrameEditorSelectionState selnStateToUse = isContextSelection ? contextSelection : selection;
if (transmutedLID == CogToolLID.PasteBackgroundImage) {
return new FrameEditorUI.PasteBackgroundImageParms(selnStateToUse, ClipboardUtil.fetchImageData());
}
if (transmutedLID == FrameEditorLID.ChangeShapeProperty) {
return new FrameEditorUI.ShapeChangeParameters(view.getWidgetShape(), selnStateToUse);
}
if (transmutedLID == FrameEditorLID.ChangeTypeProperty) {
return new FrameEditorUI.TypeChangeParameters(view.getWidgetType(), selnStateToUse);
}
if (transmutedLID == FrameEditorLID.ChangeTitleProperty) {
String newTitle = view.getWidgetTitle();
boolean isSeparator = GraphicalWidgetRenderer.SEPARATOR_STRING.equals(newTitle);
return new FrameEditorUI.ActionStringParameters(newTitle, selnStateToUse, isSeparator);
}
if (transmutedLID == FrameEditorLID.ChangeAuxTextProperty) {
return new FrameEditorUI.ActionStringParameters(view.getElementAuxText(), selnStateToUse);
}
if (transmutedLID == FrameEditorLID.ChangeNameProperty) {
return new FrameEditorUI.ActionStringParameters(view.getWidgetName(), selnStateToUse);
}
if (transmutedLID == FrameEditorLID.SetRenderSkin) {
boolean renderState = view.getWidgetRendered();
boolean newRenderState = (originalLID == FrameEditorLID.ToggleRenderSkin) ^ renderState;
return new FrameEditorUI.SetRenderSkinParameters(newRenderState, selnStateToUse);
}
if (transmutedLID == FrameEditorLID.NewWidget) {
return new FrameEditorUI.NewWidgetParameters(new DoubleRectangle(Widget.DEFAULT_X, Widget.DEFAULT_Y, Widget.DEFAULT_WIDTH, Widget.DEFAULT_HEIGHT), null, getCurrentWidgetType(), view.isAutomaticCreation(), "", null, false);
}
if (transmutedLID == CogToolLID.Duplicate) {
return new FrameEditorUI.DuplicateParameters(16.0, 16.0, selnStateToUse);
}
if (transmutedLID == FrameEditorLID.SetRemoteLabelText) {
return new FrameEditorUI.SetRemoteLabelTextParms(view.getRemoteLabelText(), selnStateToUse.getSelectedIFrameElements()[0]);
}
return selnStateToUse;
}
Aggregations