use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method getSelectedRegion.
/**
* Support for centering selection when zooming
*/
@Override
protected Rectangle getSelectedRegion() {
Iterator<DesignEditorFrame> selectedFigs = selection.getSelectedFrameFigures();
Rectangle r = computeUnion(selectedFigs);
if (r != null) {
return r;
}
if (selection.getSelectedTransitionCount() > 0) {
Iterator<DesignEditorTransition> transitionFigs = selection.getSelectedTransitionFigures();
return computeUnion(transitionFigs);
}
return super.getSelectedRegion();
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method showContextMenu.
// Context menu stuff
@Override
public void showContextMenu(int x, int y) {
// Check which region was hit
IFigure fig = structureView.getFigureAtXY(x, y, StructureViewUIModel.NO_SOURCE);
// Invocation in empty space
if (fig == null) {
contextSelection.deselectAll();
showContextMenu(contextSelection, View.CONTEXT);
} else // Invocation on a Transition
if (fig instanceof DesignEditorTransition) {
DesignEditorTransition transitionFig = (DesignEditorTransition) fig;
//fig.setToolTip(null);
if (transitionFig.isSelected()) {
showContextMenu();
} else {
// Populate the context selection
contextSelection.setSelectedTransition(transitionFig);
showContextMenu(contextSelection, View.CONTEXT);
}
} else // Invocation on a Frame
{
// fig instanceof DesignEditorFrame
DesignEditorFrame frameFig = (DesignEditorFrame) fig;
if (frameFig.isSelected()) {
// Indicate the selection to be used visually
Iterator<DesignEditorFrame> figs = selection.getSelectedFrameFigures();
while (figs.hasNext()) {
frameFig = figs.next();
frameFig.dynamicHighlight(true);
}
showContextMenu();
} else {
// Indicate the context selection visually
frameFig.dynamicHighlight(true);
// Populate the context selection
contextSelection.setSelectedFrame(frameFig);
showContextMenu(contextSelection, View.CONTEXT);
}
view.getEditor().getLWS().getUpdateManager().performUpdate();
}
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method cleanup.
/**
* Allows the interfaces to clean up any feedback provided to the
* user before and during a performAction.
*
* @param okToContinue the return value from performAction
* @param menuHidden whether or not the context menu is dismissed
* without selecting an operation to perform
* @author mlh
*/
@Override
public void cleanup(boolean okToContinue, boolean menuHidden) {
if (menuHidden) {
Iterator<DesignEditorFrame> frameFigs;
if (selection.getSelectedFrameCount() > 0) {
frameFigs = selection.getSelectedFrameFigures();
while (frameFigs.hasNext()) {
DesignEditorFrame fig = frameFigs.next();
fig.dynamicHighlight(false);
}
}
if (contextSelection.getSelectedFrameCount() > 0) {
frameFigs = contextSelection.getSelectedFrameFigures();
while (frameFigs.hasNext()) {
DesignEditorFrame fig = frameFigs.next();
fig.dynamicHighlight(false);
}
}
}
super.cleanup(okToContinue, menuHidden);
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method confirmRenameFrame.
protected boolean confirmRenameFrame() {
boolean success = true;
if ((editor != null) && editor.inUse()) {
String newName = editor.getText();
DesignEditorFrame frameFigure = (DesignEditorFrame) editor.getData();
Frame frameToRename = frameFigure.getFrame();
cleanupFrameEditor(frameFigure);
success = performAction(DesignEditorLID.RenameFrame, new DesignEditorUI.FrameRenameParameters(frameToRename, newName), false);
}
return success;
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame in project cogtool by cogtool.
the class DesignEditorUI method selectAllFrames.
public void selectAllFrames() {
// deselect any selected transitions
selection.deselectAllTransitions();
Iterator<DesignEditorFrame> frameFigures = structureView.getAllFrameFigures();
while (frameFigures.hasNext()) {
DesignEditorFrame frameFigure = frameFigures.next();
selection.selectFrame(frameFigure);
}
}
Aggregations