Search in sources :

Example 1 with ITabItemHandler

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

the class TabEditPart method activate.

@Override
public void activate() {
    getWidgetModel().setTabItemHandler(new ITabItemHandler() {

        @Override
        public void addTab(int index, TabItem tabItem) {
            TabEditPart.this.addTab(index, tabItem);
        }

        @Override
        public void removeTab(int index) {
            TabEditPart.this.removeTab(index);
        }
    });
    super.activate();
    UIBundlingThread.getInstance().addRunnable(() -> {
        // add initial tab
        var j = getTabFigure().getTabAmount();
        while (j < getWidgetModel().getTabsAmount()) {
            addTab();
            j++;
        }
    });
    UIBundlingThread.getInstance().addRunnable(() -> {
        var index = getWidgetModel().getActiveTab();
        getTabFigure().setActiveTabIndex(index);
        getWidgetModel().getChildren().get(index).setPropertyValue(PROP_VISIBLE, true);
    });
}
Also used : ITabItemHandler(org.csstudio.opibuilder.widgets.model.TabModel.ITabItemHandler)

Aggregations

ITabItemHandler (org.csstudio.opibuilder.widgets.model.TabModel.ITabItemHandler)1