Search in sources :

Example 6 with GroupingContainerModel

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

the class SashContainerEditPart method createGroupingContainerModel.

private GroupingContainerModel createGroupingContainerModel(boolean isPanel1) {
    GroupingContainerModel groupingContainerModel = new GroupingContainerModel();
    groupingContainerModel.setName(isPanel1 ? "Panel 1" : "Panel 2");
    groupingContainerModel.setBorderStyle(BorderStyle.NONE);
    groupingContainerModel.setPropertyValue(GroupingContainerModel.PROP_TRANSPARENT, true);
    return groupingContainerModel;
}
Also used : GroupingContainerModel(org.csstudio.opibuilder.widgets.model.GroupingContainerModel)

Example 7 with GroupingContainerModel

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

the class TabEditPart method createGroupingContainer.

/**
 * @return
 */
public static GroupingContainerModel createGroupingContainer() {
    GroupingContainerModel groupingContainerModel = new GroupingContainerModel();
    groupingContainerModel.setName("Tab");
    groupingContainerModel.setLocation(1, 1);
    groupingContainerModel.setBorderStyle(BorderStyle.NONE);
    groupingContainerModel.setPropertyValue(GroupingContainerModel.PROP_TRANSPARENT, true);
    groupingContainerModel.setPropertyValue(AbstractWidgetModel.PROP_VISIBLE, false);
    return groupingContainerModel;
}
Also used : GroupingContainerModel(org.csstudio.opibuilder.widgets.model.GroupingContainerModel)

Example 8 with GroupingContainerModel

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

the class TabEditPart method registerPropertyChangeHandlers.

@Override
protected void registerPropertyChangeHandlers() {
    // init tabs
    var i = 0;
    for (var child : getWidgetModel().getChildren()) {
        if (child instanceof GroupingContainerModel) {
            child.setPropertyValue(PROP_VISIBLE, true);
            child.setPropertyValue(PROP_VISIBLE, false);
            getTabFigure().addTab((String) getWidgetModel().getPropertyValue(TabModel.makeTabPropID(TabProperty.TITLE.propIDPre, i)));
            tabItemList.add(i, new TabItem(getWidgetModel(), i, (GroupingContainerModel) child));
            for (var tabProperty : TabProperty.values()) {
                setTabProperty(i, tabProperty, getWidgetModel().getPropertyValue(TabModel.makeTabPropID(tabProperty.propIDPre, i)));
            }
            i++;
        }
    }
    IWidgetPropertyChangeHandler relocContainerHandler = (oldValue, newValue, figure) -> {
        updateTabAreaSize();
        refreshVisuals();
        return false;
    };
    setPropertyChangeHandler(PROP_WIDTH, relocContainerHandler);
    setPropertyChangeHandler(PROP_HEIGHT, relocContainerHandler);
    setPropertyChangeHandler(PROP_HORIZONTAL_TABS, (oldValue, newValue, figure) -> {
        ((TabFigure) figure).setHorizontal((Boolean) newValue);
        updateTabAreaSize();
        refreshVisuals();
        return false;
    });
    setPropertyChangeHandler(PROP_ACTIVE_TAB, (oldValue, newValue, figure) -> {
        ((TabFigure) figure).setActiveTabIndex((Integer) newValue);
        updateTabAreaSize();
        refreshVisuals();
        return false;
    });
    setPropertyChangeHandler(PROP_MINIMUM_TAB_HEIGHT, (oldValue, newValue, figure) -> {
        ((TabFigure) figure).setMinimumTabHeight((Integer) newValue);
        return false;
    });
    setPropertyChangeHandler(PROP_BORDER_WIDTH, (oldValue, newValue, figure) -> {
        updateTabAreaSize();
        return false;
    });
    registerTabPropertyChangeHandlers();
    registerTabsAmountChangeHandler();
}
Also used : PROP_BORDER_WIDTH(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_BORDER_WIDTH) Dimension(org.eclipse.draw2d.geometry.Dimension) PROP_HEIGHT(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_HEIGHT) CustomMediaFactory(org.csstudio.ui.util.CustomMediaFactory) IFigure(org.eclipse.draw2d.IFigure) Level(java.util.logging.Level) TabFigure(org.csstudio.swt.widgets.figures.TabFigure) PROP_HORIZONTAL_TABS(org.csstudio.opibuilder.widgets.model.TabModel.PROP_HORIZONTAL_TABS) UIBundlingThread(org.csstudio.ui.util.thread.UIBundlingThread) PROP_ACTIVE_TAB(org.csstudio.opibuilder.widgets.model.TabModel.PROP_ACTIVE_TAB) OPIColor(org.csstudio.opibuilder.util.OPIColor) GroupingContainerModel(org.csstudio.opibuilder.widgets.model.GroupingContainerModel) LinkedList(java.util.LinkedList) PROP_VISIBLE(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_VISIBLE) OPIBuilderPlugin(org.csstudio.opibuilder.OPIBuilderPlugin) TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty) PROP_TAB_COUNT(org.csstudio.opibuilder.widgets.model.TabModel.PROP_TAB_COUNT) AbstractBaseEditPart(org.csstudio.opibuilder.editparts.AbstractBaseEditPart) PROP_TRANSPARENT(org.csstudio.opibuilder.widgets.model.GroupingContainerModel.PROP_TRANSPARENT) PROP_MINIMUM_TAB_HEIGHT(org.csstudio.opibuilder.widgets.model.TabModel.PROP_MINIMUM_TAB_HEIGHT) TabModel(org.csstudio.opibuilder.widgets.model.TabModel) AbstractContainerEditpart(org.csstudio.opibuilder.editparts.AbstractContainerEditpart) Path(org.eclipse.core.runtime.Path) OPIFont(org.csstudio.opibuilder.util.OPIFont) ITabItemHandler(org.csstudio.opibuilder.widgets.model.TabModel.ITabItemHandler) Label(org.eclipse.draw2d.Label) EditPolicy(org.eclipse.gef.EditPolicy) BorderStyle(org.csstudio.opibuilder.visualparts.BorderStyle) EditPart(org.eclipse.gef.EditPart) PROP_WIDTH(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_WIDTH) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) GroupingContainerModel(org.csstudio.opibuilder.widgets.model.GroupingContainerModel) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) TabFigure(org.csstudio.swt.widgets.figures.TabFigure)

Aggregations

GroupingContainerModel (org.csstudio.opibuilder.widgets.model.GroupingContainerModel)8 TabProperty (org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Level (java.util.logging.Level)1 OPIBuilderPlugin (org.csstudio.opibuilder.OPIBuilderPlugin)1 AddWidgetCommand (org.csstudio.opibuilder.commands.AddWidgetCommand)1 OrphanChildCommand (org.csstudio.opibuilder.commands.OrphanChildCommand)1 SetWidgetPropertyCommand (org.csstudio.opibuilder.commands.SetWidgetPropertyCommand)1 WidgetCreateCommand (org.csstudio.opibuilder.commands.WidgetCreateCommand)1 AbstractBaseEditPart (org.csstudio.opibuilder.editparts.AbstractBaseEditPart)1 AbstractContainerEditpart (org.csstudio.opibuilder.editparts.AbstractContainerEditpart)1 AbstractContainerModel (org.csstudio.opibuilder.model.AbstractContainerModel)1 AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)1 PROP_BORDER_WIDTH (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_BORDER_WIDTH)1 PROP_HEIGHT (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_HEIGHT)1 PROP_VISIBLE (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_VISIBLE)1 PROP_WIDTH (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_WIDTH)1 DisplayModel (org.csstudio.opibuilder.model.DisplayModel)1