コード例 #1
0
  public PaletteElement createElement(String type, String name) {
    String prefix = type + "." + name;
    String command = getResourceString(prefix + ".command");
    String caption = getResourceString(prefix + ".caption");

    Icon icon = IconLoader.getInstance().getIcon(getResourceString(prefix + ".icon"));
    PaletteElement element = new PaletteElement(icon, caption, command, this, type);
    if (name.equals("derivation")) element.setEnabled(false);
    element.setToolTipText(getResourceString(prefix + ".tooltip"));

    elementMap.put(name, element);
    // content.add(element);
    // content.add(PaletteAccordion.getSpacer(0,1));
    return element;
  }
コード例 #2
0
  public void NotifySelection(PaletteElement item) {
    if (selectedElement != null) {
      if (item != selectedElement) {
        selectedElement.setSelected(false);
      }
    }

    if (parent.getFrame().getDiagramManager().getCurrentDiagramEditor() != null)
      parent
          .getFrame()
          .getDiagramManager()
          .getCurrentDiagramEditor()
          .setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    selectedElement = item;
    parent.NotifySelection(item);

    for (AppCommandListener listener : listeners) {
      listener.handleCommand(item.getCommand());
    }
  }
コード例 #3
0
 @Override
 public int compare(PaletteElement o1, PaletteElement o2) {
   if (o1.getType().contains("classes") && o2.getType().contains("relations")) {
     return -1;
   } else if (o1.getType().contains("relations") && o2.getType().contains("classes")) {
     return 1;
   } else return o1.getCaption().compareToIgnoreCase(o2.getCaption());
 }
コード例 #4
0
 public void unselectAllBut(PaletteElement item) {
   if (selectedElement != null && selectedElement != item) selectedElement.setSelected(false);
 }