use of org.csstudio.swt.widgets.figures.GroupingContainerFigure in project yamcs-studio by yamcs.
the class GroupingContainerEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
figure.setOpaque(!(Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(GroupingContainerModel.PROP_TRANSPARENT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
for (AbstractWidgetModel child : getWidgetModel().getChildren()) {
child.setEnabled((Boolean) newValue);
}
return true;
}
};
setPropertyChangeHandler(AbstractWidgetModel.PROP_ENABLED, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
lockChildren((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(GroupingContainerModel.PROP_LOCK_CHILDREN, handler);
lockChildren(getWidgetModel().isLocked());
if (getWidgetModel().getParent() instanceof TabModel) {
removeAllPropertyChangeHandlers(AbstractWidgetModel.PROP_VISIBLE);
IWidgetPropertyChangeHandler visibilityHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
boolean visible = (Boolean) newValue;
final IFigure figure = getFigure();
figure.setVisible(visible);
return true;
}
};
setPropertyChangeHandler(AbstractWidgetModel.PROP_VISIBLE, visibilityHandler);
}
IWidgetPropertyChangeHandler showBarHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
((GroupingContainerFigure) refreshableFigure).setShowScrollBar((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(GroupingContainerModel.PROP_SHOW_SCROLLBAR, showBarHandler);
IWidgetPropertyChangeHandler fowardColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
if (getWidgetModel().isForwardColors())
forwardColors();
return true;
}
};
setPropertyChangeHandler(GroupingContainerModel.PROP_FORWARD_COLORS, fowardColorHandler);
setPropertyChangeHandler(GroupingContainerModel.PROP_COLOR_BACKGROUND, fowardColorHandler);
setPropertyChangeHandler(GroupingContainerModel.PROP_COLOR_FOREGROUND, fowardColorHandler);
// use property listener because it doesn't need to be queued in GUIRefreshThread.
getWidgetModel().getProperty(AbstractWidgetModel.PROP_WIDTH).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
resizeChildren((Integer) (evt.getNewValue()), (Integer) (evt.getOldValue()), true);
}
});
getWidgetModel().getProperty(AbstractWidgetModel.PROP_HEIGHT).addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
resizeChildren((Integer) (evt.getNewValue()), (Integer) (evt.getOldValue()), false);
}
});
}
use of org.csstudio.swt.widgets.figures.GroupingContainerFigure in project yamcs-studio by yamcs.
the class GroupingContainerEditPart method doCreateFigure.
@Override
protected IFigure doCreateFigure() {
GroupingContainerFigure f = new GroupingContainerFigure();
f.setOpaque(!getWidgetModel().isTransparent());
f.setShowScrollBar(getWidgetModel().isShowScrollbar());
return f;
}
Aggregations