use of org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_ENABLED 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_ENABLED in project yamcs-studio by yamcs.
the class AbstractBoolControlEditPart method registerCommonPropertyChangeHandlers.
/**
* Registers property change handlers for the properties defined in {@link AbstractBoolWidgetModel}. This method is
* provided for the convenience of subclasses, which can call this method in their implementation of
* {@link #registerPropertyChangeHandlers()}.
*/
@Override
protected void registerCommonPropertyChangeHandlers() {
configureButtonListener((AbstractBoolControlFigure) getFigure());
super.registerCommonPropertyChangeHandlers();
IWidgetPropertyChangeHandler toggleHandler = (oldValue, newValue, refreshableFigure) -> {
var figure = (AbstractBoolControlFigure) refreshableFigure;
figure.setToggle((Boolean) newValue);
return true;
};
getWidgetModel().getProperty(PROP_TOGGLE_BUTTON).addPropertyChangeListener(evt -> toggleHandler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure()));
setPropertyChangeHandler(PROP_CONFIRM_DIALOG, (oldValue, newValue, refreshableFigure) -> {
var figure = (AbstractBoolControlFigure) refreshableFigure;
figure.setShowConfirmDialog(getWidgetModel().getShowConfirmDialog());
return true;
});
setPropertyChangeHandler(PROP_CONFIRM_TIP, (oldValue, newValue, refreshableFigure) -> {
var figure = (AbstractBoolControlFigure) refreshableFigure;
figure.setConfirmTip((String) newValue);
return true;
});
setPropertyChangeHandler(PROP_PASSWORD, (oldValue, newValue, refreshableFigure) -> {
var figure = (AbstractBoolControlFigure) refreshableFigure;
figure.setPassword((String) newValue);
return true;
});
// enabled. WidgetBaseEditPart will force the widget as disabled in edit model,
// which is not the case for the bool control widget
setPropertyChangeHandler(PROP_ENABLED, (oldValue, newValue, refreshableFigure) -> {
var figure = (AbstractBoolControlFigure) refreshableFigure;
figure.setEnabled((Boolean) newValue);
return true;
});
}
Aggregations