Search in sources :

Example 6 with DesignEditorFrame

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();
}
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 7 with DesignEditorFrame

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();
    }
}
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 8 with DesignEditorFrame

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

Example 9 with DesignEditorFrame

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

Example 10 with DesignEditorFrame

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

Aggregations

DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)18 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)8 IFigure (org.eclipse.draw2d.IFigure)5 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 DesignEditorTransition (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition)4 EventObject (java.util.EventObject)4 DoublePoint (edu.cmu.cs.hcii.cogtool.model.DoublePoint)3 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)3 GraphicalSource (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalSource)3 AlertHandler (edu.cmu.cs.hcii.cogtool.util.AlertHandler)3 Iterator (java.util.Iterator)3 Point (org.eclipse.draw2d.geometry.Point)3 ActionPropertySet (edu.cmu.cs.hcii.cogtool.view.ActionPropertySet)2 InteractionFigure (edu.cmu.cs.hcii.cogtool.view.InteractionFigure)2 Design (edu.cmu.cs.hcii.cogtool.model.Design)1 Transition (edu.cmu.cs.hcii.cogtool.model.Transition)1 TransitionSource (edu.cmu.cs.hcii.cogtool.model.TransitionSource)1 FrameSelectionChange (edu.cmu.cs.hcii.cogtool.ui.DesignEditorSelectionState.FrameSelectionChange)1 GraphicalChildWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalChildWidget)1 GraphicalParentWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalParentWidget)1