Ejemplo n.º 1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
Ejemplo n.º 2
1
 public MapBuilder(String name, File toLoad, File toSave, String tileDir) {
   super(name);
   currTileImg = null;
   currTileLoc = "";
   try {
     System.out.println(tileDir);
     currTileImg = new ImageIcon(getTile(tileDir, 0, 0, DISPLAY_SCALE));
     currTileLoc = "0_0";
   } catch (IOException e) {
     System.out.println("Generating current tile failed.");
     System.out.println(e);
     System.exit(0);
   }
   currTileDisplay = new JLabel(new ImageIcon(scaleImage(currTileImg.getImage(), 2)));
   this.input = toLoad;
   output = toSave;
   this.tileDir = tileDir;
   if (toLoad != null) {
     try {
       backEnd = loadMap(toLoad);
     } catch (FileNotFoundException e) {
       System.err.println("Could not find input file.");
       System.exit(0);
     }
   } else {
     backEnd = emptyMap(DEFAULT_WIDTH, DEFAULT_HEIGHT);
   }
   mapWidth = backEnd.getWidth();
   mapHeight = backEnd.getHeight();
 }
  /** Start the background thread. */
  public void start() {
    // create a random list of cities

    cities = new City[TravelingSalesman.CITY_COUNT];
    for (int i = 0; i < TravelingSalesman.CITY_COUNT; i++) {
      cities[i] =
          new City(
              (int) (Math.random() * (getBounds().width - 10)),
              (int) (Math.random() * (getBounds().height - 60)));
    }

    // create the initial chromosomes

    chromosomes = new Chromosome[TravelingSalesman.POPULATION_SIZE];
    for (int i = 0; i < TravelingSalesman.POPULATION_SIZE; i++) {
      chromosomes[i] = new Chromosome(cities);
      chromosomes[i].setCut(cutLength);
      chromosomes[i].setMutation(TravelingSalesman.MUTATION_PERCENT);
    }
    Chromosome.sortChromosomes(chromosomes, TravelingSalesman.POPULATION_SIZE);

    // start up the background thread
    started = true;
    map.update(map.getGraphics());

    generation = 0;

    if (worker != null) worker = null;
    worker = new Thread(this);
    // worker.setPriority(Thread.MIN_PRIORITY);
    worker.start();
  }
Ejemplo n.º 4
0
 public Map<String, String> getOptionMap() {
   Map<String, String> ret = new HashMap<String, String>();
   for (OptionField opt : optionFields) {
     ret.put(opt.getName(), opt.getValue());
   }
   return ret;
 }
Ejemplo n.º 5
0
  private VirtualMachine connect(String bndlPrefix, AttachingConnector connector, Map args)
      throws DebuggerException {
    if (bndlPrefix != null) {
      if (connector.transport().name().equals("dt_shmem")) {
        Argument a = (Argument) args.get("name");
        if (a == null) println(bundle.getString(bndlPrefix + "_shmem_noargs"), ERR_OUT);
        else
          println(
              new MessageFormat(bundle.getString(bndlPrefix + "_shmem"))
                  .format(new Object[] {a.value()}),
              ERR_OUT);
      } else if (connector.transport().name().equals("dt_socket")) {
        Argument name = (Argument) args.get("hostname");
        Argument port = (Argument) args.get("port");
        if ((name == null) || (port == null))
          println(bundle.getString(bndlPrefix + "_socket_noargs"), ERR_OUT);
        else
          println(
              new MessageFormat(bundle.getString(bndlPrefix + "_socket"))
                  .format(new Object[] {name.value(), port.value()}),
              ERR_OUT);
      } else println(bundle.getString(bndlPrefix), ERR_OUT);
    }

    // launch VM
    try { // S ystem.out.println ("attach to:" + ac + " : " + password); // NOI18N
      return connector.attach(args);
    } catch (Exception e) {
      finishDebugger();
      throw new DebuggerException(
          new MessageFormat(bundle.getString("EXC_While_connecting_to_debuggee"))
              .format(new Object[] {e.toString()}),
          e);
    }
  }
Ejemplo n.º 6
0
  private void ListSubDirectorySizes(File file) {
    File[] files;
    files =
        file.listFiles(
            new FileFilter() {
              @Override
              public boolean accept(File file) {
                //                if (!file.isDirectory()){
                //                    return false;  //To change body of implemented methods use
                // File | Settings | File Templates.
                //                }else{
                //                    return true;
                //                }
                return true;
              }
            });
    Map<String, Long> dirListing = new HashMap<String, Long>();
    for (File dir : files) {
      DiskUsage diskUsage = new DiskUsage();
      diskUsage.accept(dir);
      //            long size = diskUsage.getSize() / (1024 * 1024);
      long size = diskUsage.getSize();
      dirListing.put(dir.getName(), size);
    }

    ValueComparator bvc = new ValueComparator(dirListing);
    TreeMap<String, Long> sorted_map = new TreeMap<String, Long>(bvc);
    sorted_map.putAll(dirListing);

    PrettyPrint(file, sorted_map);
  }
 boolean registruotiAuto(String autoNr) {
   if (regAuto.containsKey(autoNr)) return false;
   Automobilis a = neregAuto.poll();
   if (a == null) return false; // kai neregistruotų jau nėra
   regAuto.put(autoNr, a);
   return true;
 }
Ejemplo n.º 8
0
 // Note: this comparator imposes orderings that are inconsistent with equals.
 public int compare(String a, String b) {
   if (base.get(a) >= base.get(b)) {
     return -1;
   } else {
     return 1;
   } // returning 0 would merge keys
 }
Ejemplo n.º 9
0
 public void setColumnComparator(Class type, Comparator comparator) {
   if (comparator == null) {
     columnComparators.remove(type);
   } else {
     columnComparators.put(type, comparator);
   }
 }
Ejemplo n.º 10
0
  void install() {
    Vector components = new Vector();
    Vector indicies = new Vector();
    int size = 0;

    JPanel comp = selectComponents.comp;
    Vector ids = selectComponents.filesets;

    for (int i = 0; i < comp.getComponentCount(); i++) {
      if (((JCheckBox) comp.getComponent(i)).getModel().isSelected()) {
        size += installer.getIntegerProperty("comp." + ids.elementAt(i) + ".real-size");
        components.addElement(installer.getProperty("comp." + ids.elementAt(i) + ".fileset"));
        indicies.addElement(new Integer(i));
      }
    }

    String installDir = chooseDirectory.installDir.getText();

    Map osTaskDirs = chooseDirectory.osTaskDirs;
    Iterator keys = osTaskDirs.keySet().iterator();
    while (keys.hasNext()) {
      OperatingSystem.OSTask osTask = (OperatingSystem.OSTask) keys.next();
      String dir = ((JTextField) osTaskDirs.get(osTask)).getText();
      if (dir != null && dir.length() != 0) {
        osTask.setEnabled(true);
        osTask.setDirectory(dir);
      } else osTask.setEnabled(false);
    }

    InstallThread thread =
        new InstallThread(installer, progress, installDir, osTasks, size, components, indicies);
    progress.setThread(thread);
    thread.start();
  }
 private synchronized void startAnimation(
     JComponent component, Part part, State startState, State endState, long millis) {
   boolean isForwardAndReverse = false;
   if (endState == State.DEFAULTED) {
     isForwardAndReverse = true;
   }
   Map<Part, AnimationState> map = animationStateMap.get(component);
   if (millis <= 0) {
     if (map != null) {
       map.remove(part);
       if (map.size() == 0) {
         animationStateMap.remove(component);
       }
     }
     return;
   }
   if (map == null) {
     map = new EnumMap<Part, AnimationState>(Part.class);
     animationStateMap.put(component, map);
   }
   map.put(part, new AnimationState(startState, millis, isForwardAndReverse));
   if (!timer.isRunning()) {
     timer.start();
   }
 }
Ejemplo n.º 12
0
 {
   cmdmap.put(
       "sz",
       new Console.Command() {
         public void run(Console cons, String[] args) {
           if (args.length == 3) {
             int w = Integer.parseInt(args[1]), h = Integer.parseInt(args[2]);
             p.setSize(w, h);
             pack();
             Utils.setprefc("wndsz", new Coord(w, h));
           } else if (args.length == 2) {
             if (args[1].equals("dyn")) {
               setResizable(true);
               Utils.setprefb("wndlock", false);
             } else if (args[1].equals("lock")) {
               setResizable(false);
               Utils.setprefb("wndlock", true);
             }
           }
         }
       });
   cmdmap.put(
       "fsmode",
       new Console.Command() {
         public void run(Console cons, String[] args) throws Exception {
           if (args.length == 3) {
             DisplayMode mode = findmode(Integer.parseInt(args[1]), Integer.parseInt(args[2]));
             if (mode == null) throw (new Exception("No such mode is available"));
             fsmode = mode;
             Utils.setprefc("fsmode", new Coord(mode.getWidth(), mode.getHeight()));
           }
         }
       });
   cmdmap.put(
       "fs",
       new Console.Command() {
         public void run(Console cons, String[] args) {
           if (args.length >= 2) {
             Runnable r;
             if (Utils.atoi(args[1]) != 0) {
               r =
                   new Runnable() {
                     public void run() {
                       setfs();
                     }
                   };
             } else {
               r =
                   new Runnable() {
                     public void run() {
                       setwnd();
                     }
                   };
             }
             getToolkit().getSystemEventQueue().invokeLater(r);
           }
         }
       });
 }
 static synchronized PartUIClientPropertyKey getKey(Part part) {
   PartUIClientPropertyKey rv = map.get(part);
   if (rv == null) {
     rv = new PartUIClientPropertyKey(part);
     map.put(part, rv);
   }
   return rv;
 }
Ejemplo n.º 14
0
  public Map loadMap(File input) throws FileNotFoundException {
    Scanner s = new Scanner(input);
    tileDir = s.nextLine();
    int width = s.nextInt();
    int height = s.nextInt();
    Map toReturn = new Map(width, height, tileDir);
    s.nextLine(); // eat up rest of line.
    for (int y = 0; y < height; y++) {
      String line = s.nextLine();
      Scanner lineReader = new Scanner(line);
      List<Tile> tList = new ArrayList<Tile>();
      for (int x = 0; x < width; x++) {
        String[] values = lineReader.next().split("/");
        String name = values[0];
        int[] picLocation = new int[2];
        for (int i = 0; i < picLocation.length; i++) {
          picLocation[i] = Integer.parseInt(values[1].split("_")[i]);
        }
        ImageIcon img = null;
        try {
          img = new ImageIcon(getTile(tileDir, picLocation[0], picLocation[1], DISPLAY_SCALE));
        } catch (IOException e) {
          System.out.println("Could not find image.");
          img =
              new ImageIcon(
                  new BufferedImage(
                      TILE_SIZE * DISPLAY_SCALE,
                      TILE_SIZE * DISPLAY_SCALE,
                      BufferedImage.TYPE_INT_RGB));
        }
        int avoid = Integer.parseInt(values[2]);
        int def = Integer.parseInt(values[3]);
        String[] movString = values[4].split(",");
        int[] moveCost = new int[movString.length];
        for (int i = 0; i < moveCost.length; i++) {
          moveCost[i] = Integer.parseInt(movString[i]);
        }
        String special = values[5];

        Tile t =
            new Tile(
                img,
                name,
                avoid,
                def,
                moveCost,
                special,
                true,
                "" + picLocation[0] + "_" + picLocation[1]);
        tList.add(t);
        t.setMaximumSize(new Dimension(TILE_SIZE * DISPLAY_SCALE, TILE_SIZE * DISPLAY_SCALE));
        t.setPreferredSize(new Dimension(TILE_SIZE * DISPLAY_SCALE, TILE_SIZE * DISPLAY_SCALE));
        t.addMouseListener(new MapButtonListener());
      }
      toReturn.addRow(tList);
    }
    return toReturn;
  }
 /** highlight a route (maybe to show it's in use...) */
 public void highlightRoute(String src, String dst) {
   Iterator i = rows.iterator();
   while (i.hasNext()) {
     Map temp = (Map) i.next();
     if (temp.get("Address").equals(dst) && temp.get("Pivot").equals(src)) {
       temp.put("Active", Boolean.TRUE);
     }
   }
 }
Ejemplo n.º 16
0
 public List getModifierActionList(Object device, Integer modifier) {
   Map<Object, ArrayList> deviceModActionMap = this.getModifierActionMap(device);
   if (deviceModActionMap == null) {
     String message = Logging.getMessage("nullValue.DeviceKeyIsNull");
     Logging.logger().severe(message);
     throw new IllegalArgumentException(message);
   }
   return (deviceModActionMap.get(modifier));
 }
Ejemplo n.º 17
0
 void initialize(Map m) {
   System.out.println("Initializing");
   if (m.containsKey("wordList")) {
     System.out.println("SettingWordList");
     setWordList((Properties) m.get("wordList"));
   } else {
     setWordList(new Properties());
   }
 }
Ejemplo n.º 18
0
 static {
   HEADING_LIST.put("H1 head line", 35);
   HEADING_LIST.put("H2 head line", 30);
   HEADING_LIST.put("H3 head line", 25);
   HEADING_LIST.put("H4 head line", 20);
   HEADING_LIST.put("H5 head line", 15);
   HEADING_LIST.put("Paragraph", 10);
   HEADING_LIST.put("Quote", 10);
 }
Ejemplo n.º 19
0
  public void showTask(String sTaskClass) {

    m_appview.waitCursorBegin();

    if (m_appuser.hasPermission(sTaskClass)) {

      JPanelView m_jMyView = (JPanelView) m_aCreatedViews.get(sTaskClass);

      // cierro la antigua
      if (m_jLastView == null || (m_jMyView != m_jLastView && m_jLastView.deactivate())) {

        // Construct the new view
        if (m_jMyView == null) {

          // Is the view prepared
          m_jMyView = m_aPreparedViews.get(sTaskClass);
          if (m_jMyView == null) {
            // The view is not prepared. Try to get as a Bean...
            try {
              m_jMyView = (JPanelView) m_appview.getBean(sTaskClass);
            } catch (BeanFactoryException e) {
              m_jMyView = new JPanelNull(m_appview, e);
            }
          }

          m_jPanelContainer.add(m_jMyView.getComponent(), sTaskClass);
          m_aCreatedViews.put(sTaskClass, m_jMyView);
        }

        // ejecuto la tarea
        try {
          m_jMyView.activate();
        } catch (BasicException e) {
          JMessageDialog.showMessage(
              this,
              new MessageInf(
                  MessageInf.SGN_WARNING, AppLocal.getIntString("message.notactive"), e));
        }

        // se tiene que mostrar el panel
        m_jLastView = m_jMyView;

        showView(sTaskClass);
        // Y ahora que he cerrado la antigua me abro yo
        String sTitle = m_jMyView.getTitle();
        m_jPanelTitle.setVisible(sTitle != null);
        m_jTitle.setText(sTitle);
      }
    } else {
      // No hay permisos para ejecutar la accion...
      JMessageDialog.showMessage(
          this,
          new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.notpermissions")));
    }
    m_appview.waitCursorEnd();
  }
Ejemplo n.º 20
0
 public void loadPuzzle(ActionEvent e) throws NoSuchMethodException {
   int returnVal = fc.showOpenDialog(this);
   if (returnVal != JFileChooser.APPROVE_OPTION) {
     return;
   }
   file = fc.getSelectedFile();
   Map m = new HashMap();
   m.put("file", file);
   mgr.switchScreens(m);
 }
 /** show the meterpreter routes . :) */
 public void setRoutes(Route[] routes) {
   Iterator i = rows.iterator();
   while (i.hasNext()) {
     Map temp = (Map) i.next();
     for (int x = 0; x < routes.length; x++) {
       Route r = routes[x];
       if (r.shouldRoute(temp.get("Address") + "")) temp.put("Pivot", r.getGateway());
     }
   }
 }
 {
   cursors.put(1, Cursor.N_RESIZE_CURSOR);
   cursors.put(2, Cursor.W_RESIZE_CURSOR);
   cursors.put(4, Cursor.S_RESIZE_CURSOR);
   cursors.put(8, Cursor.E_RESIZE_CURSOR);
   cursors.put(3, Cursor.NW_RESIZE_CURSOR);
   cursors.put(9, Cursor.NE_RESIZE_CURSOR);
   cursors.put(6, Cursor.SW_RESIZE_CURSOR);
   cursors.put(12, Cursor.SE_RESIZE_CURSOR);
 }
Ejemplo n.º 23
0
  private Map<String, ObjectType> getColumnTypes() {
    Map<String, ObjectType> columnTypes = new HashMap<String, ObjectType>();
    for (int i = 0; i < this.rowsTable.getRowCount(); i++) {
      String columnName = (String) this.rowsTable.getValueAt(i, 0);
      ObjectType columnType = (ObjectType) this.rowsTable.getValueAt(i, 1);

      columnTypes.put(columnName, columnType);
    }
    return columnTypes;
  }
Ejemplo n.º 24
0
  /**
   * Loads the list of enabled and disabled encryption protocols with their priority.
   *
   * @param enabledEncryptionProtocols The list of enabled encryption protocol available for this
   *     account.
   * @param disabledEncryptionProtocols The list of disabled encryption protocol available for this
   *     account.
   */
  private void loadEncryptionProtocols(
      Map<String, Integer> encryptionProtocols, Map<String, Boolean> encryptionProtocolStatus) {
    int nbEncryptionProtocols = ENCRYPTION_PROTOCOLS.length;
    String[] encryptions = new String[nbEncryptionProtocols];
    boolean[] selectedEncryptions = new boolean[nbEncryptionProtocols];

    // Load stored values.
    int prefixeLength = ProtocolProviderFactory.ENCRYPTION_PROTOCOL.length() + 1;
    String encryptionProtocolPropertyName;
    String name;
    int index;
    boolean enabled;
    Iterator<String> encryptionProtocolNames = encryptionProtocols.keySet().iterator();
    while (encryptionProtocolNames.hasNext()) {
      encryptionProtocolPropertyName = encryptionProtocolNames.next();
      index = encryptionProtocols.get(encryptionProtocolPropertyName);
      // If the property is set.
      if (index != -1) {
        name = encryptionProtocolPropertyName.substring(prefixeLength);
        if (isExistingEncryptionProtocol(name)) {
          enabled =
              encryptionProtocolStatus.get(
                  ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS + "." + name);
          encryptions[index] = name;
          selectedEncryptions[index] = enabled;
        }
      }
    }

    // Load default values.
    String encryptionProtocol;
    boolean set;
    int j = 0;
    for (int i = 0; i < ENCRYPTION_PROTOCOLS.length; ++i) {
      encryptionProtocol = ENCRYPTION_PROTOCOLS[i];
      // Specify a default value only if there is no specific value set.
      if (!encryptionProtocols.containsKey(
          ProtocolProviderFactory.ENCRYPTION_PROTOCOL + "." + encryptionProtocol)) {
        set = false;
        // Search for the first empty element.
        while (j < encryptions.length && !set) {
          if (encryptions[j] == null) {
            encryptions[j] = encryptionProtocol;
            // By default only ZRTP is set to true.
            selectedEncryptions[j] = encryptionProtocol.equals("ZRTP");
            set = true;
          }
          ++j;
        }
      }
    }

    this.encryptionConfigurationTableModel.init(encryptions, selectedEncryptions);
  }
Ejemplo n.º 25
0
 public NewBotDialog(DarkBotMCUI ui) {
   super(ui);
   this.ui = ui;
   optionsUIs = new HashMap<String, BotOptionsUI>();
   optionsUIs.put("Regular", new RegularBotOptionsUI());
   optionsUIs.put("Spambot", new SpamBotOptionsUI());
   initComponents();
   updateSelectedBotType();
   typeComboBox.setModel(new DefaultComboBoxModel(optionsUIs.keySet().toArray()));
   setVisible(true);
 }
Ejemplo n.º 26
0
  public boolean postProcessKeyEvent(KeyEvent e) {
    // Processing events only if we are in the focused window but
    // we are not focus owner since otherwise we will get
    // duplicate shortcut events in the client - one is from
    // activate_accelerator, another from forwarded event
    // FIXME: This is probably an incompatibility, protocol
    // doesn't say anything about disable accelerators when client
    // is focused.

    XWindowPeer parent = getToplevelXWindow();
    if (parent == null || !((Window) parent.getTarget()).isFocused() || target.isFocusOwner()) {
      return false;
    }

    boolean result = false;

    if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Post-processing event " + e);

    // Process ACCELERATORS
    AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
    long accel_id = 0;
    boolean exists = false;
    synchronized (ACCEL_LOCK) {
      exists = accel_lookup.containsKey(stroke);
      if (exists) {
        accel_id = accel_lookup.get(stroke).longValue();
      }
    }
    if (exists) {
      if (xembedLog.isLoggable(PlatformLogger.FINE))
        xembedLog.fine("Activating accelerator " + accel_id);
      xembed.sendMessage(
          xembed.handle,
          XEMBED_ACTIVATE_ACCELERATOR,
          accel_id,
          0,
          0); // FIXME: How about overloaded?
      result = true;
    }

    // Process Grabs, unofficial GTK feature
    exists = false;
    GrabbedKey key = new GrabbedKey(e);
    synchronized (GRAB_LOCK) {
      exists = grabbed_keys.contains(key);
    }
    if (exists) {
      if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding grabbed key " + e);
      forwardKeyEvent(e);
      result = true;
    }

    return result;
  }
Ejemplo n.º 27
0
 /** Remove a given manipulator from a given window. The window must be registered. */
 public synchronized void removeManipFromWindow(Manip manip, AWTGLAutoDrawable window) {
   WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
   if (info == null) {
     throw new RuntimeException("Window not registered");
   }
   if (!info.manips.remove(manip)) {
     throw new RuntimeException("Manip not registered in window");
   }
   Set windows = (Set) manipToWindowMap.get(manip);
   assert windows != null;
   windows.remove(window);
 }
Ejemplo n.º 28
0
 /**
  * Make a given manipulator visible and active in a given window. The window must be registered.
  */
 public synchronized void showManipInWindow(Manip manip, AWTGLAutoDrawable window) {
   WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
   if (info == null) {
     throw new RuntimeException("Window not registered");
   }
   info.manips.add(manip);
   Set windows = (Set) manipToWindowMap.get(manip);
   if (windows == null) {
     windows = new HashSet();
     manipToWindowMap.put(manip, windows);
   }
   windows.add(window);
 }
Ejemplo n.º 29
0
 /** Remove all references to a given window, including removing all manipulators from it. */
 public synchronized void unregisterWindow(AWTGLAutoDrawable window) {
   if (window == null) {
     return;
   }
   WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
   if (info != null) {
     Object[] manips = info.manips.toArray();
     for (int i = 0; i < manips.length; i++) {
       removeManipFromWindow((Manip) manips[i], window);
     }
     windowToInfoMap.remove(window);
     removeMouseListeners(window);
   }
 }
Ejemplo n.º 30
0
  public static void setEntity(ConcreteAgent ent, Map attributes) {
    Map currentMap =
        (Map)
            RenderComponentManager.retrieveIDs("ConcreteAgent", ent.getPrefs(attributes).getView());
    current = ent.getPrefs(attributes).getView();
    if (ent != null
        && currentMap.get("_attributes_") != null
        && currentMap.get("_attributes_") instanceof ingenias.editor.rendererxml.AttributesPanel) {

      ((ingenias.editor.rendererxml.AttributesPanel) currentMap.get("_attributes_")).setEntity(ent);
    }

    if (currentMap.get("Id") != null) {
      if (ent != null && ent.getId() != null) {
        if (currentMap.get("Id") instanceof javax.swing.JLabel) {
          ((javax.swing.JLabel) (currentMap).get("Id")).setText(ent.getId().toString());
        } else {
          if (currentMap.get("Id") instanceof javax.swing.text.JTextComponent)
            ((javax.swing.text.JTextComponent) (currentMap).get("Id"))
                .setText(ent.getId().toString());
        }
      } else {
        if (currentMap.get("Id") instanceof javax.swing.JLabel)
          ((javax.swing.JLabel) (currentMap).get("Id")).setText("");
        else {
          if (!(currentMap.get("Id") instanceof ingenias.editor.rendererxml.CollectionPanel))
            ((javax.swing.text.JTextComponent) (currentMap).get("Id")).setText("");
        }
      }
    }
  }