Search in sources :

Example 1 with TabProperty

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

the class TabEditPart method addTab.

/**
 *Add a TabItem to the index;
 * @param index
 * @param tabItem
 */
public synchronized void addTab(int index, TabItem tabItem) {
    if (index < 0 || index > getTabItemCount())
        throw new IllegalArgumentException();
    if (index >= TabModel.MAX_TABS_AMOUNT)
        return;
    GroupingContainerModel groupingContainerModel = tabItem.getGroupingContainerModel();
    getWidgetModel().addChild(index, groupingContainerModel);
    getTabFigure().addTab((String) tabItem.getPropertyValue(TabProperty.TITLE), index);
    tabItemList.add(index, tabItem);
    initTabLabel(index, tabItem);
    rightShiftTabProperties(index);
    // apply tab properties from TabItem to TabModel
    for (TabProperty tabProperty : TabProperty.values()) {
        String propID = TabModel.makeTabPropID(tabProperty.propIDPre, index);
        getWidgetModel().setPropertyValue(propID, tabItem.getPropertyValue(tabProperty));
    }
    // update property sheet
    getWidgetModel().setPropertyValue(TabModel.PROP_TAB_COUNT, getWidgetModel().getChildren().size(), false);
    for (TabProperty tabProperty : TabProperty.values()) {
        String propID = TabModel.makeTabPropID(tabProperty.propIDPre, getWidgetModel().getChildren().size() - 1);
        getWidgetModel().setPropertyVisible(propID, true);
    }
    // update active tab index to the new added tab
    updateTabAreaSize();
    setActiveTabIndex(index);
}
Also used : GroupingContainerModel(org.csstudio.opibuilder.widgets.model.GroupingContainerModel) TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)

Example 2 with TabProperty

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

the class TabEditPart method initTabLabel.

private void initTabLabel(int index, TabItem tabItem) {
    for (TabProperty tabProperty : TabProperty.values()) {
        Object propValue = tabItem.getPropertyValue(tabProperty);
        setTabFigureProperty(index, tabProperty, propValue);
    }
}
Also used : TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)

Example 3 with TabProperty

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

the class TabEditPart method registerTabPropertyChangeHandlers.

private void registerTabPropertyChangeHandlers() {
    // set prop handlers and init all the potential tabs
    for (int i = 0; i < TabModel.MAX_TABS_AMOUNT; i++) {
        for (TabProperty tabProperty : TabProperty.values()) {
            String propID = TabModel.makeTabPropID(tabProperty.propIDPre, i);
            IWidgetPropertyChangeHandler handler = new TabPropertyChangeHandler(i, tabProperty);
            setPropertyChangeHandler(propID, handler);
        }
    }
    for (int i = TabModel.MAX_TABS_AMOUNT - 1; i >= getWidgetModel().getTabsAmount(); i--) {
        for (TabProperty tabProperty : TabProperty.values()) {
            String propID = TabModel.makeTabPropID(tabProperty.propIDPre, i);
            getWidgetModel().setPropertyVisible(propID, false);
        }
    }
}
Also used : TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)

Example 4 with TabProperty

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

the class TabEditPart method rightShiftTabProperties.

private void rightShiftTabProperties(int index) {
    for (int j = getWidgetModel().getChildren().size() - 1; j > index; j--) {
        for (TabProperty tabProperty : TabProperty.values()) {
            String propID1 = TabModel.makeTabPropID(tabProperty.propIDPre, j - 1);
            String propID2 = TabModel.makeTabPropID(tabProperty.propIDPre, j);
            getWidgetModel().setPropertyValue(propID2, getWidgetModel().getPropertyValue(propID1));
        }
    }
}
Also used : TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)

Example 5 with TabProperty

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

the class TabItem method injectDefaultPropertiesValue.

/**
 *Copy the default properties value from TabModel to this tab item.
 * @param index the index of the tab item.
 */
public void injectDefaultPropertiesValue(int index) {
    TabModel tempModel = new TabModel();
    for (TabProperty tabProperty : TabProperty.values()) {
        String propID = TabModel.makeTabPropID(tabProperty.propIDPre, index);
        propertyMap.put(tabProperty, tempModel.getProperty(propID).getDefaultValue());
    }
}
Also used : TabProperty(org.csstudio.opibuilder.widgets.model.TabModel.TabProperty) TabModel(org.csstudio.opibuilder.widgets.model.TabModel)

Aggregations

TabProperty (org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)8 GroupingContainerModel (org.csstudio.opibuilder.widgets.model.GroupingContainerModel)3 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)2 TabModel (org.csstudio.opibuilder.widgets.model.TabModel)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Level (java.util.logging.Level)1 OPIBuilderPlugin (org.csstudio.opibuilder.OPIBuilderPlugin)1 AbstractBaseEditPart (org.csstudio.opibuilder.editparts.AbstractBaseEditPart)1 AbstractContainerEditpart (org.csstudio.opibuilder.editparts.AbstractContainerEditpart)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 OPIColor (org.csstudio.opibuilder.util.OPIColor)1 OPIFont (org.csstudio.opibuilder.util.OPIFont)1 BorderStyle (org.csstudio.opibuilder.visualparts.BorderStyle)1 PROP_TRANSPARENT (org.csstudio.opibuilder.widgets.model.GroupingContainerModel.PROP_TRANSPARENT)1 ITabItemHandler (org.csstudio.opibuilder.widgets.model.TabModel.ITabItemHandler)1 PROP_ACTIVE_TAB (org.csstudio.opibuilder.widgets.model.TabModel.PROP_ACTIVE_TAB)1