Exemplo n.º 1
0
 public static RGB convertRGB(String key, String value) {
   if (Styles.NONE.equals(value)) return null;
   if (Styles.SYSTEM.equals(value)) {
     return getSystemRGB(key, null);
   }
   return ColorUtils.toRGB(value);
 }
Exemplo n.º 2
0
 public static Color convertColor(String key, String value) {
   if (Styles.NONE.equals(value)) {
     return null;
   } else if (Styles.SYSTEM.equals(value)) {
     return getSystemColor(key, null);
   }
   return ColorUtils.getColor(value);
 }
Exemplo n.º 3
0
 private void setValueToText(Object value) {
   if (value instanceof String) {
     text.setText((String) value);
   } else if (value instanceof RGB) {
     text.setText(ColorUtils.toString((RGB) value));
   } else if (value == null) {
     text.setText(""); // $NON-NLS-1$
   } else {
     text.setText(value.toString());
   }
 }
Exemplo n.º 4
0
 public static Color getBranchConnectionColor(
     final IBranchPart branch,
     final IStyleSelector ss,
     final IBranchPart child,
     final int childIndex,
     Color defaultColor) {
   if (child != null) {
     IStyleSelector childSS = getStyleSelector(child);
     String shapeId = getString(child, childSS, Styles.LineClass, null);
     String defaultValue = defaultColor == null ? null : ColorUtils.toString(defaultColor);
     return getColor(child, childSS, Styles.LineColor, shapeId, defaultValue);
   }
   return defaultColor;
 }
  public void createControl(Composite parent) {
    viewer = new GalleryViewer();

    EditDomain editDomain = new EditDomain();
    editDomain.installTool(GEF.TOOL_SELECT, new TemplateGallerySelectTool());
    viewer.setEditDomain(editDomain);

    Properties properties = viewer.getProperties();
    properties.set(GalleryViewer.Horizontal, Boolean.TRUE);
    properties.set(GalleryViewer.Wrap, Boolean.TRUE);
    properties.set(GalleryViewer.TitlePlacement, GalleryViewer.TITLE_BOTTOM);
    properties.set(GalleryViewer.SingleClickToOpen, Boolean.TRUE);
    properties.set(GalleryViewer.SolidFrames, true);
    properties.set(GalleryViewer.FlatFrames, true);
    properties.set(GalleryViewer.ImageConstrained, true);
    properties.set(GalleryViewer.ImageStretched, true);
    properties.set(
        GalleryViewer.Layout,
        new GalleryLayout(
            GalleryLayout.ALIGN_CENTER,
            GalleryLayout.ALIGN_TOPLEFT,
            10,
            10,
            new Insets(5, 15, 5, 15)));
    properties.set(GalleryViewer.FrameContentSize, new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
    properties.set(GalleryViewer.ContentPaneBorderWidth, 1);
    properties.set(GalleryViewer.ContentPaneBorderColor, ColorUtils.getColor("#cccccc"));

    Control control = viewer.createControl(parent);
    control.setBackground(parent.getBackground());
    control.setForeground(parent.getForeground());

    viewer.setLabelProvider(new TemplateLabelProvider());

    viewer.setInput(getViewerInput());

    viewer.addOpenListener(
        new IOpenListener() {
          public void open(OpenEvent event) {
            if (normalOrEditMode) {
              if (!templateOpening) handleTemplateSelected(event.getSelection());
            }
          }
        });

    MindMapUI.getResourceManager().addResourceManagerListener(this);

    setControl(control);
  }
Exemplo n.º 6
0
 protected void onMoving(Point currentPos, MouseDragEvent me) {
   super.onMoving(currentPos, me);
   ITopicPart newParent = findTopicPart(me.target);
   if (newParent != targetParent) {
     if (feedbackService != null) {
       if (targetParent != null) {
         feedbackService.removeSelection(targetParent.getFigure());
       }
       if (newParent != null) {
         SelectionFigure selection = feedbackService.addSelection(newParent.getFigure());
         selection.setPreselectionColor(ColorUtils.getColor(MindMapUI.COLOR_WARNING));
         selection.setPreselectionFillAlpha(0);
         selection.setPreselectionFillColor(null);
         selection.setPreselected(true);
       }
     }
   }
   targetParent = newParent;
 }
Exemplo n.º 7
0
 private void setValueToPicker(Object value) {
   ISelection selection;
   if (configurer.isNoneValueSet()
       && (configurer.getNoneValue() == value
           || (configurer.getNoneValue() != null && configurer.getNoneValue().equals(value)))) {
     selection = new ColorSelection(ColorSelection.NONE);
   } else if (configurer.isAutoValueSet()
       && (configurer.getAutoValue() == value
           || (configurer.getAutoValue() != null && configurer.getAutoValue().equals(value)))) {
     selection = new ColorSelection(ColorSelection.AUTO);
   } else if (value instanceof String) {
     RGB color = ColorUtils.toRGB((String) value);
     selection = color == null ? ColorSelection.EMPTY : new ColorSelection(color);
   } else if (value instanceof RGB) {
     selection = new ColorSelection((RGB) value);
   } else {
     selection = ColorSelection.EMPTY;
   }
   picker.setSelection(selection);
 }