Beispiel #1
0
  private void setupAttributes() {
    Color frameColor = (Color) AttributeFigure.getDefaultAttribute("FrameColor");
    Color fillColor = (Color) AttributeFigure.getDefaultAttribute("FillColor");
    Color textColor = (Color) AttributeFigure.getDefaultAttribute("TextColor");
    Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute("ArrowMode");
    String fontName = (String) AttributeFigure.getDefaultAttribute("FontName");

    FigureEnumeration k = view().selectionElements();
    while (k.hasMoreElements()) {
      Figure f = k.nextFigure();
      frameColor = (Color) f.getAttribute("FrameColor");
      fillColor = (Color) f.getAttribute("FillColor");
      textColor = (Color) f.getAttribute("TextColor");
      arrowMode = (Integer) f.getAttribute("ArrowMode");
      fontName = (String) f.getAttribute("FontName");
    }

    fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor));
    fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor));
    // fTextColor.select(ColorMap.colorIndex(textColor));
    if (arrowMode != null) {
      fArrowChoice.setSelectedIndex(arrowMode.intValue());
    }
    if (fontName != null) {
      fFontChoice.setSelectedItem(fontName);
    }
  }
Beispiel #2
0
 /** Creates the color choice for the given attribute. */
 protected JComboBox createColorChoice(String attribute) {
   CommandChoice choice = new CommandChoice();
   for (int i = 0; i < ColorMap.size(); i++)
     choice.addItem(
         new ChangeAttributeCommand(ColorMap.name(i), attribute, ColorMap.color(i), this));
   return choice;
 }
Beispiel #3
0
 private void setupAttributes() {
   Color frameColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR);
   Color fillColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR);
   Integer arrowMode =
       (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE);
   String fontName =
       (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME);
   FigureEnumeration fe = view().selection();
   while (fe.hasNextFigure()) {
     Figure f = fe.nextFigure();
     frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR);
     fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR);
     arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE);
     fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME);
   }
   fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor));
   fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor));
   if (arrowMode != null) {
     fArrowChoice.setSelectedIndex(arrowMode.intValue());
   }
   if (fontName != null) {
     fFontChoice.setSelectedItem(fontName);
   }
 }
 /** Creates the color menu. */
 protected JMenu createColorMenu(String title, String attribute) {
   CommandMenu menu = new CommandMenu(title);
   for (int i = 0; i < ColorMap.size(); i++)
     menu.add(
         new UndoableCommand(
             new ChangeAttributeCommand(ColorMap.name(i), attribute, ColorMap.color(i), this)));
   return menu;
 }
Beispiel #5
0
 /**
  * Utility to call apply properties to a list of ColorMap-s This will return the ones that
  * actually have a pattern. This way the properties dialog for the symbol can prune out the ones
  * that the user removed.
  *
  * @param mappings List of ColorMap-s
  * @return The list of ColorMaps-s that actually have a pattern.
  */
 public static List applyProperties(List mappings) {
   List goodMappings = new ArrayList();
   for (int i = 0; i < mappings.size(); i++) {
     ColorMap colorMap = (ColorMap) mappings.get(i);
     colorMap.applyProperties();
     if (colorMap.hasPattern()) {
       goodMappings.add(colorMap);
     }
   }
   return goodMappings;
 }