use of org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_VISIBLE in project yamcs-studio by yamcs.
the class GroupingContainerEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_TRANSPARENT, (oldValue, newValue, figure) -> {
figure.setOpaque(!(Boolean) newValue);
return true;
});
setPropertyChangeHandler(PROP_ENABLED, (oldValue, newValue, figure) -> {
for (var child : getWidgetModel().getChildren()) {
child.setEnabled((Boolean) newValue);
}
return true;
});
setPropertyChangeHandler(PROP_LOCK_CHILDREN, (oldValue, newValue, figure) -> {
lockChildren((Boolean) newValue);
return true;
});
lockChildren(getWidgetModel().isLocked());
if (getWidgetModel().getParent() instanceof TabModel) {
removeAllPropertyChangeHandlers(PROP_VISIBLE);
setPropertyChangeHandler(PROP_VISIBLE, (oldValue, newValue, refreshableFigure) -> {
boolean visible = (Boolean) newValue;
var figure = getFigure();
figure.setVisible(visible);
return true;
});
}
setPropertyChangeHandler(PROP_SHOW_SCROLLBAR, (oldValue, newValue, refreshableFigure) -> {
((GroupingContainerFigure) refreshableFigure).setShowScrollBar((Boolean) newValue);
return true;
});
IWidgetPropertyChangeHandler fowardColorHandler = (oldValue, newValue, refreshableFigure) -> {
if (getWidgetModel().isForwardColors()) {
forwardColors();
}
return true;
};
setPropertyChangeHandler(PROP_FORWARD_COLORS, fowardColorHandler);
setPropertyChangeHandler(PROP_COLOR_BACKGROUND, fowardColorHandler);
setPropertyChangeHandler(PROP_COLOR_FOREGROUND, fowardColorHandler);
// use property listener because it doesn't need to be queued in GUIRefreshThread.
getWidgetModel().getProperty(PROP_WIDTH).addPropertyChangeListener(evt -> resizeChildren((Integer) (evt.getNewValue()), (Integer) (evt.getOldValue()), true));
getWidgetModel().getProperty(PROP_HEIGHT).addPropertyChangeListener(evt -> resizeChildren((Integer) (evt.getNewValue()), (Integer) (evt.getOldValue()), false));
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_VISIBLE 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();
}
Aggregations