Search in sources :

Example 1 with PROP_SHOW_DOWN_ARROW

use of org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_SHOW_DOWN_ARROW in project yamcs-studio by yamcs.

the class MenuButtonEditPart method registerPropertyChangeHandlers.

@Override
protected void registerPropertyChangeHandlers() {
    setPropertyChangeHandler(PROP_PVNAME, (oldValue, newValue, figure) -> {
        registerLoadActionsListener();
        return false;
    });
    setPropertyChangeHandler(PROP_PVVALUE, (oldValue, newValue, refreshableFigure) -> {
        if ((newValue != null) && (newValue instanceof Scalar)) {
            ((MenuButtonFigure) refreshableFigure).setText(VTypeHelper.getString((VType) newValue));
        }
        return true;
    });
    setPropertyChangeHandler(PROP_LABEL, (oldValue, newValue, refreshableFigure) -> {
        ((MenuButtonFigure) refreshableFigure).setText(newValue.toString());
        return true;
    });
    setPropertyChangeHandler(PROP_TRANSPARENT, (oldValue, newValue, refreshableFigure) -> {
        ((MenuButtonFigure) refreshableFigure).setOpaque(!(Boolean) newValue);
        return true;
    });
    setPropertyChangeHandler(PROP_SHOW_DOWN_ARROW, (oldValue, newValue, refreshableFigure) -> {
        ((MenuButtonFigure) refreshableFigure).setDownArrowVisible((boolean) newValue);
        return true;
    });
    IWidgetPropertyChangeHandler handler = (oldValue, newValue, refreshableFigure) -> {
        updatePropSheet((Boolean) newValue);
        return false;
    };
    getWidgetModel().getProperty(PROP_ACTIONS_FROM_PV).addPropertyChangeListener(evt -> handler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure()));
}
Also used : PROP_PVVALUE(org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE) WidgetActionMenuAction(org.csstudio.opibuilder.actions.WidgetActionMenuAction) PROP_TRANSPARENT(org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_TRANSPARENT) PROP_ACTIONS(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_ACTIONS) AbstractWidgetModel(org.csstudio.opibuilder.model.AbstractWidgetModel) PROP_PVNAME(org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVNAME) RequestConstants(org.eclipse.gef.RequestConstants) CustomMediaFactory(org.csstudio.ui.util.CustomMediaFactory) IFigure(org.eclipse.draw2d.IFigure) ITextFigure(org.csstudio.swt.widgets.figures.ITextFigure) PROP_SHOW_DOWN_ARROW(org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_SHOW_DOWN_ARROW) IPV(org.yamcs.studio.data.IPV) Request(org.eclipse.gef.Request) RGB(org.eclipse.swt.graphics.RGB) IPVListener(org.yamcs.studio.data.IPVListener) ActionsInput(org.csstudio.opibuilder.widgetActions.ActionsInput) Scalar(org.yamcs.studio.data.vtype.Scalar) MouseMotionListener(org.eclipse.draw2d.MouseMotionListener) ExecutionMode(org.csstudio.opibuilder.editparts.ExecutionMode) VTypeHelper(org.yamcs.studio.data.VTypeHelper) PlatformUI(org.eclipse.ui.PlatformUI) Point(org.eclipse.draw2d.geometry.Point) MenuManager(org.eclipse.jface.action.MenuManager) VEnum(org.yamcs.studio.data.vtype.VEnum) MouseEvent(org.eclipse.draw2d.MouseEvent) PROP_ACTIONS_FROM_PV(org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_ACTIONS_FROM_PV) MouseListener(org.eclipse.draw2d.MouseListener) Display(org.eclipse.swt.widgets.Display) PROP_LABEL(org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_LABEL) MenuButtonFigure(org.csstudio.opibuilder.widgets.figures.MenuButtonFigure) List(java.util.List) WritePVAction(org.csstudio.opibuilder.widgetActions.WritePVAction) VType(org.yamcs.studio.data.vtype.VType) AbstractPVWidgetEditPart(org.csstudio.opibuilder.editparts.AbstractPVWidgetEditPart) MenuButtonModel(org.csstudio.opibuilder.widgets.model.MenuButtonModel) EditPolicy(org.eclipse.gef.EditPolicy) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) GraphicsUtil(org.csstudio.swt.widgets.util.GraphicsUtil) MenuButtonFigure(org.csstudio.opibuilder.widgets.figures.MenuButtonFigure) VType(org.yamcs.studio.data.vtype.VType) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) Scalar(org.yamcs.studio.data.vtype.Scalar)

Aggregations

List (java.util.List)1 WidgetActionMenuAction (org.csstudio.opibuilder.actions.WidgetActionMenuAction)1 AbstractPVWidgetEditPart (org.csstudio.opibuilder.editparts.AbstractPVWidgetEditPart)1 ExecutionMode (org.csstudio.opibuilder.editparts.ExecutionMode)1 AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)1 PROP_ACTIONS (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_ACTIONS)1 PROP_PVNAME (org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVNAME)1 PROP_PVVALUE (org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE)1 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 ActionsInput (org.csstudio.opibuilder.widgetActions.ActionsInput)1 WritePVAction (org.csstudio.opibuilder.widgetActions.WritePVAction)1 MenuButtonFigure (org.csstudio.opibuilder.widgets.figures.MenuButtonFigure)1 MenuButtonModel (org.csstudio.opibuilder.widgets.model.MenuButtonModel)1 PROP_ACTIONS_FROM_PV (org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_ACTIONS_FROM_PV)1 PROP_LABEL (org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_LABEL)1 PROP_SHOW_DOWN_ARROW (org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_SHOW_DOWN_ARROW)1 PROP_TRANSPARENT (org.csstudio.opibuilder.widgets.model.MenuButtonModel.PROP_TRANSPARENT)1 ITextFigure (org.csstudio.swt.widgets.figures.ITextFigure)1 GraphicsUtil (org.csstudio.swt.widgets.util.GraphicsUtil)1 CustomMediaFactory (org.csstudio.ui.util.CustomMediaFactory)1