@Override
 public IFigure doCreateFigure() {
   ActionButtonModel model = editpart.getWidgetModel();
   int style = SWT.None;
   style |= model.isToggleButton() ? SWT.TOGGLE : SWT.PUSH;
   style |= SWT.WRAP;
   final NativeButtonFigure buttonFigure = new NativeButtonFigure(editpart, style);
   button = buttonFigure.getSWTWidget();
   button.setText(model.getText());
   button.addTraverseListener(
       e -> {
         if (skipTraverse) return;
         e.doit = false;
         skipTraverse = true;
         if (e.stateMask == 0) {
           SingleSourceHelper.swtControlTraverse(button, SWT.TRAVERSE_TAB_PREVIOUS);
         } else {
           SingleSourceHelper.swtControlTraverse(button, SWT.TRAVERSE_TAB_NEXT);
         }
         skipTraverse = false;
       });
   buttonFigure.setImagePath(model.getImagePath());
   return buttonFigure;
 }
Ejemplo n.º 2
0
  @Override
  protected void configureProperties() {
    addPVProperty(
        new PVNameProperty(
            PROP_HORIZON_PROFILE_X_PV_NAME,
            "Horizon Profile X PV",
            WidgetPropertyCategory.Basic,
            ""),
        new PVValueProperty(PROP_HORIZON_PROFILE_X_PV_VALUE, null));

    addPVProperty(
        new PVNameProperty(
            PROP_VERTICAL_PROFILE_X_PV_NAME,
            "Vertical Profile X PV",
            WidgetPropertyCategory.Basic,
            ""),
        new PVValueProperty(PROP_VERTICAL_PROFILE_X_PV_VALUE, null));

    addPVProperty(
        new PVNameProperty(
            PROP_HORIZON_PROFILE_Y_PV_NAME,
            "Horizon Profile Y PV",
            WidgetPropertyCategory.Basic,
            ""),
        new PVValueProperty(PROP_HORIZON_PROFILE_Y_PV_VALUE, null));

    addPVProperty(
        new PVNameProperty(
            PROP_VERTICAL_PROFILE_Y_PV_NAME,
            "Vertical Profile Y PV",
            WidgetPropertyCategory.Basic,
            ""),
        new PVValueProperty(PROP_VERTICAL_PROFILE_Y_PV_VALUE, null));

    addProperty(
        new DoubleProperty(PROP_MIN, "Minimum", WidgetPropertyCategory.Behavior, DEFAULT_MIN),
        true);

    addProperty(
        new DoubleProperty(PROP_MAX, "Maximum", WidgetPropertyCategory.Behavior, DEFAULT_MAX),
        true);

    addProperty(
        new IntegerProperty(PROP_DATA_WIDTH, "Data Width", WidgetPropertyCategory.Behavior, 0),
        true);

    addProperty(
        new IntegerProperty(PROP_DATA_HEIGHT, "Data Height", WidgetPropertyCategory.Behavior, 0),
        true);

    addProperty(
        SingleSourceHelper.createColorMapProperty(
            PROP_COLOR_MAP,
            "Color Map",
            WidgetPropertyCategory.Display,
            new ColorMap(PredefinedColorMap.JET, true, true)),
        true);

    addProperty(
        new BooleanProperty(PROP_SHOW_RAMP, "Show Ramp", WidgetPropertyCategory.Display, true),
        true);

    addProperty(
        new IntegerProperty(
            PROP_GRAPH_AREA_WIDTH, "Graph Area Width", WidgetPropertyCategory.Position, 0),
        true);

    addProperty(
        new IntegerProperty(
            PROP_GRAPH_AREA_HEIGHT, "Graph Area Height", WidgetPropertyCategory.Position, 0),
        true);

    addProperty(
        new IntegerProperty(PROP_CROP_LEFT, "Crop Left", WidgetPropertyCategory.Behavior, 0));
    addProperty(
        new IntegerProperty(PROP_CROP_RIGHT, "Crop Right", WidgetPropertyCategory.Behavior, 0));
    addProperty(new IntegerProperty(PROP_CROP_TOP, "Crop Top", WidgetPropertyCategory.Behavior, 0));
    addProperty(
        new IntegerProperty(PROP_CROP_BOTTOM, "Crop BOTTOM", WidgetPropertyCategory.Behavior, 0));

    addProperty(
        new BooleanProperty(PROP_RGB_MODE, "RGB Mode", WidgetPropertyCategory.Behavior, false),
        false);

    addProperty(
        new ComboProperty(
            PROP_COLOR_DEPTH,
            "Color Depth",
            WidgetPropertyCategory.Behavior,
            ColorDepth.stringValues(),
            0),
        true);

    addProperty(
        new BooleanProperty(
            PROP_SINGLE_LINE_PROFILING,
            "Profile on Single Line",
            WidgetPropertyCategory.Behavior,
            false),
        true);

    addProperty(
        new ColorProperty(
            PROP_ROI_COLOR,
            "ROI Color",
            WidgetPropertyCategory.Display,
            CustomMediaFactory.COLOR_CYAN),
        true);

    addProperty(
        new IntegerProperty(
            PROP_ROI_COUNT, "ROI Count", WidgetPropertyCategory.Behavior, 0, 0, MAX_ROIS_AMOUNT));

    addAxisProperties();
    addROIProperties();
  }