Search in sources :

Example 1 with AbstractWidgetModel

use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.

the class AbstractLayoutEditpart method layout.

/**
 *Layout widgets.
 * @param widgetModelList
 * @param containerBounds
 */
public void layout(List<AbstractWidgetModel> widgetModelList, Rectangle containerBounds) {
    int i = 0;
    List<Rectangle> newBounds = getNewBounds(widgetModelList, containerBounds);
    for (AbstractWidgetModel model : widgetModelList) {
        model.setBounds(newBounds.get(i));
        i++;
    }
}
Also used : AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 2 with AbstractWidgetModel

use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.

the class GraphicalFeedbackChildEditPolicy method createSelectionHandles.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
protected List<?> createSelectionHandles() {
    // get default handles
    List<Handle> handleList = super.createSelectionHandles();
    // add contributed handles
    GraphicalEditPart hostEP = (GraphicalEditPart) getHost();
    List<Handle> contributedHandles = feedbackFactory.createCustomHandles(hostEP);
    if (contributedHandles != null) {
        handleList.addAll(contributedHandles);
    }
    if (hostEP.getModel() instanceof IPVWidgetModel && ((AbstractWidgetModel) (hostEP.getModel())).getProperty(IPVWidgetModel.PROP_PVNAME).isVisibleInPropSheet()) {
        handleList.add(new PVWidgetSelectionHandle((GraphicalEditPart) hostEP));
    }
    return handleList;
}
Also used : AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) IPVWidgetModel(org.csstudio.opibuilder.model.IPVWidgetModel) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Handle(org.eclipse.gef.Handle)

Example 3 with AbstractWidgetModel

use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.

the class WidgetComponentEditPolicy method createDeleteCommand.

@Override
protected Command createDeleteCommand(GroupRequest deleteRequest) {
    Object containerModel = getHost().getParent().getModel();
    Object widget = getHost().getModel();
    if (containerModel instanceof AbstractContainerModel && widget instanceof AbstractWidgetModel)
        return new WidgetDeleteCommand((AbstractContainerModel) containerModel, (AbstractWidgetModel) widget);
    return super.createDeleteCommand(deleteRequest);
}
Also used : AbstractContainerModel(org.csstudio.opibuilder.model.AbstractContainerModel) AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) WidgetDeleteCommand(org.csstudio.opibuilder.commands.WidgetDeleteCommand)

Example 4 with AbstractWidgetModel

use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.

the class WidgetNodeEditPolicy method getConnectionCreateCommand.

@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    AbstractWidgetModel source = getWidgetEditPart().getWidgetModel();
    ConnectionAnchor anchor = getWidgetEditPart().getSourceConnectionAnchor(request);
    String sourceTerminal = getWidgetEditPart().getTerminalNameFromAnchor(anchor);
    ConnectionCreateCommand cmd = new ConnectionCreateCommand(source, sourceTerminal);
    request.setStartCommand(cmd);
    return cmd;
}
Also used : ConnectionAnchor(org.eclipse.draw2d.ConnectionAnchor) AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) ConnectionCreateCommand(org.csstudio.opibuilder.commands.ConnectionCreateCommand)

Example 5 with AbstractWidgetModel

use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.

the class WidgetTreeContainerEditPolicy method getCreateCommand.

@Override
protected Command getCreateCommand(CreateRequest request) {
    AbstractWidgetModel widgetModel = (AbstractWidgetModel) request.getNewObject();
    int index = findIndexOfTreeItemAt(request.getLocation());
    return createCreateCommand(widgetModel, null, index, "Create Widget");
}
Also used : AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)50 AbstractContainerModel (org.csstudio.opibuilder.model.AbstractContainerModel)15 ArrayList (java.util.ArrayList)11 AbstractBaseEditPart (org.csstudio.opibuilder.editparts.AbstractBaseEditPart)10 Point (org.eclipse.draw2d.geometry.Point)7 Rectangle (org.eclipse.draw2d.geometry.Rectangle)7 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)7 EditPart (org.eclipse.gef.EditPart)6 ConnectionModel (org.csstudio.opibuilder.model.ConnectionModel)5 DisplayModel (org.csstudio.opibuilder.model.DisplayModel)5 IFigure (org.eclipse.draw2d.IFigure)5 PropertyChangeListener (java.beans.PropertyChangeListener)4 ExecutionMode (org.csstudio.opibuilder.editparts.ExecutionMode)4 AddWidgetCommand (org.csstudio.opibuilder.commands.AddWidgetCommand)3 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)3 ITextFigure (org.csstudio.swt.widgets.figures.ITextFigure)3 EditPolicy (org.eclipse.gef.EditPolicy)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 List (java.util.List)2 WidgetCreateCommand (org.csstudio.opibuilder.commands.WidgetCreateCommand)2