Search in sources :

Example 1 with DesignEditorTransition

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);
    }
}
Also used : DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition) Transition(edu.cmu.cs.hcii.cogtool.model.Transition)

Example 2 with DesignEditorTransition

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();
}
Also used : DesignEditorFrame(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame) DoubleRectangle(edu.cmu.cs.hcii.cogtool.model.DoubleRectangle) Rectangle(org.eclipse.draw2d.geometry.Rectangle) DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition)

Example 3 with DesignEditorTransition

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();
    }
}
Also used : DesignEditorFrame(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame) Iterator(java.util.Iterator) DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition) IFigure(org.eclipse.draw2d.IFigure)

Example 4 with DesignEditorTransition

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;
}
Also used : DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition) Transition(edu.cmu.cs.hcii.cogtool.model.Transition) DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition)

Example 5 with DesignEditorTransition

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);
            }
        }
    };
}
Also used : AlertHandler(edu.cmu.cs.hcii.cogtool.util.AlertHandler) DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition) InteractionDrawingEditor(edu.cmu.cs.hcii.cogtool.view.InteractionDrawingEditor) EventObject(java.util.EventObject) TransitionSelectionChange(edu.cmu.cs.hcii.cogtool.ui.DesignEditorSelectionState.TransitionSelectionChange)

Aggregations

DesignEditorTransition (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition)6 DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)3 Transition (edu.cmu.cs.hcii.cogtool.model.Transition)2 IFigure (org.eclipse.draw2d.IFigure)2 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)1 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1 TransitionSelectionChange (edu.cmu.cs.hcii.cogtool.ui.DesignEditorSelectionState.TransitionSelectionChange)1 GraphicalSource (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalSource)1 AlertHandler (edu.cmu.cs.hcii.cogtool.util.AlertHandler)1 InteractionDrawingEditor (edu.cmu.cs.hcii.cogtool.view.InteractionDrawingEditor)1 ResizeThumb (edu.cmu.cs.hcii.cogtool.view.ResizeThumb)1 EventObject (java.util.EventObject)1 Iterator (java.util.Iterator)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1