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