Esempio n. 1
0
  @Override
  public void valueChanged(TreeSelectionEvent e) {
    if (e.getSource() == colors && !locked) {
      TreeSelectionModel tsm = colors.getSelectionModel();
      TreePath tp[] = tsm.getSelectionPaths();
      if (tp == null) return;
      Vector<ClassedItem> tmp = new Vector<ClassedItem>();
      for (TreePath element : tp) {
        try {
          Object[] path = element.getPath();
          ClassedItem ci = new ClassedItem(path[1].toString(), path[2].toString());
          tmp.add(ci);
        } catch (Exception exp) {
          // User did not select a leafnode
        }
      }

      if (sceneElement instanceof NenyaImageSceneElement) {
        ((NenyaImageSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaTileSceneElement) {
        ((NenyaTileSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaComponentSceneElement) {
        ((NenyaComponentSceneElement) sceneElement)
            .getComponents()[itemList.getSelectedIndex()].setColorList(
                tmp.toArray(new ClassedItem[0]));
      }

      submitElement(sceneElement, null);
    } else {
      super.valueChanged(e);
    }
  }
Esempio n. 2
0
 // Interface: SceneTrackerListener
 @Override
 public void trackerUpdated(SceneTrackerEvent e) {
   super.trackerUpdated(e);
   if (activeScene == null) {
     enableEditor(false);
   }
 }
Esempio n. 3
0
 @Override
 public void setSystemManager(SystemManager sm) {
   super.setSystemManager(sm);
   sm.getIoService().addIOServiceListener(this);
   filter.addCaretListener(lumberjack);
   filter.setAction(lumberjackAction);
   colors.addTreeSelectionListener(this);
   itemList.addActionListener(this);
   sceneElement = null;
 }