use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition in project cogtool by cogtool.
the class DesignEditorSelectionState method deselectTransition.
public void deselectTransition(DesignEditorTransition singleTransition) {
Transition t = singleTransition.getTransition();
if (selectedTransitions.remove(t) != null) {
transitionChangeAlert.selected = false;
transitionChangeAlert.changedTransitionFigure = singleTransition;
raiseAlert(transitionChangeAlert);
}
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition 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.DesignEditorTransition 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.DesignEditorTransition in project cogtool by cogtool.
the class DesignEditorSelectionState method getSelectedTransitions.
public Transition[] getSelectedTransitions() {
Transition[] transitions = new Transition[selectedTransitions.size()];
Iterator<DesignEditorTransition> transitionIterator = selectedTransitions.values().iterator();
int i = 0;
while (transitionIterator.hasNext()) {
DesignEditorTransition transitionHolder = transitionIterator.next();
transitions[i++] = transitionHolder.getTransition();
}
return transitions;
}
use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition in project cogtool by cogtool.
the class DesignEditorUI method createTransitionSelectionHandler.
// createFrameSelectionHandler
protected AlertHandler createTransitionSelectionHandler() {
return new AlertHandler() {
public void handleAlert(EventObject alert) {
TransitionSelectionChange evt = (TransitionSelectionChange) alert;
if (evt != null) {
InteractionDrawingEditor editor = view.getEditor();
if (evt.changedTransitionFigure != null) {
evt.changedTransitionFigure.setSelected(editor, evt.selected);
} else {
Iterator<DesignEditorTransition> transitionFigures = selection.getSelectedTransitionFigures();
while (transitionFigures.hasNext()) {
DesignEditorTransition transitionFigure = transitionFigures.next();
transitionFigure.setSelected(editor, evt.selected);
}
}
// Repaint the contents
delayedRepainting.requestRepaint(REPAINT_ALL);
updateView(evt.changedTransitionFigure == null);
}
}
};
}
Aggregations