Ejemplo n.º 1
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);
           }
         }
       });
 }
Ejemplo n.º 2
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);
 }
 {
   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.º 4
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);
 }
 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.º 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);
  }
Ejemplo n.º 7
0
 public void setColumnComparator(Class type, Comparator comparator) {
   if (comparator == null) {
     columnComparators.remove(type);
   } else {
     columnComparators.put(type, comparator);
   }
 }
Ejemplo n.º 8
0
 {
   cmdmap.put(
       "hz",
       new Console.Command() {
         public void run(Console cons, String[] args) {
           fd = 1000 / Integer.parseInt(args[1]);
         }
       });
   cmdmap.put(
       "bghz",
       new Console.Command() {
         public void run(Console cons, String[] args) {
           bgfd = 1000 / Integer.parseInt(args[1]);
         }
       });
 }
Ejemplo n.º 9
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;
 }
 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();
   }
 }
 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.º 12
0
 /**
  * Adds a single row to the {@link #reviewPanel}.
  *
  * @param gbl The layout to add the row to.
  * @param gbc The layout constraints to use.
  * @param title The title of the top-level project.
  * @param hours The amount of hours spent on the project.
  */
 private void addRow(GridBagLayout gbl, GridBagConstraints gbc, String title, double hours) {
   Row row = new Row();
   addLeftLabel(gbl, gbc, title);
   addMiddleField(gbl, gbc, row, hours);
   addRightLabel(gbl, gbc);
   addPercentLabel(gbl, gbc, row);
   rows.put(title, row);
   gbc.gridy++;
 }
 /** 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.º 14
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.º 15
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());
     }
   }
 }
Ejemplo n.º 17
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.º 18
0
 /**
  * Adds pixel to queue and calls repaint() whenever we have MAX_ITEMS pixels in the queue or
  * when MAX_TIME msecs have elapsed (whichever comes first). The advantage compared to just
  * calling repaint() after adding a pixel to the queue is that repaint() can most often draw
  * multiple points at the same time.
  */
 public void drawPoint(DrawCommand c) {
   if (c == null || gr == null) return;
   Color col = new Color(c.rgb);
   gr.setColor(col);
   gr.fillOval(c.x, c.y, 10, 10);
   repaint();
   if (state != null) {
     synchronized (state) {
       state.put(new Point(c.x, c.y), col);
     }
   }
 }
Ejemplo n.º 19
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.º 20
0
 private void init() {
   panels = new LinkedHashMap<String, JPanel>();
   panels.put("General", new General());
   panels.put("Computer Name", new ComputerName());
   panels.put("Hardware", new Hardware());
   panels.put("Advanced", new Advanced());
   panels.put("System Restore", new SystemRestore());
   panels.put("Automatic Updates", new AutomaticUpdates());
   panels.put("Remote", new Remote());
 }
 public UsageNode doAppendUsage(@NotNull Usage usage) {
   // invoke in ReadAction to be be sure that usages are not invalidated while the tree is being
   // built
   ApplicationManager.getApplication().assertReadAccessAllowed();
   if (!usage.isValid()) {
     // because the view is built incrementally, the usage may be already invalid, so need to
     // filter such cases
     return null;
   }
   UsageNode node = myBuilder.appendUsage(usage);
   myUsageNodes.put(usage, node == null ? NULL_NODE : node);
   if (!myIsFirstVisibleUsageFound && node != null) { // first visible usage found;
     myIsFirstVisibleUsageFound = true;
     showNode(node);
   }
   return node;
 }
  /*
   *  Update the TableColumn with the newly calculated width
   */
  private void updateTableColumn(int column, int width) {
    final TableColumn tableColumn = table.getColumnModel().getColumn(column);

    if (!tableColumn.getResizable()) return;

    width += spacing;

    //  Don't shrink the column width

    if (isOnlyAdjustLarger) {
      width = Math.max(width, tableColumn.getPreferredWidth());
    }

    columnSizes.put(tableColumn, new Integer(tableColumn.getWidth()));
    table.getTableHeader().setResizingColumn(tableColumn);
    tableColumn.setWidth(width);
  }
Ejemplo n.º 23
0
    /**
     * Read State (color dots) from input stream
     *
     * @param instream
     * @throws IOException
     */
    public void readState(InputStream instream) throws IOException {
      DataInputStream in = new DataInputStream(new BufferedInputStream(instream));
      Map<Point, Color> new_state = new LinkedHashMap<Point, Color>();
      int num = in.readInt();
      for (int i = 0; i < num; i++) {
        Point point = new Point(in.readInt(), in.readInt());
        Color col = new Color(in.readInt());
        new_state.put(point, col);
      }

      synchronized (state) {
        state.clear();
        state.putAll(new_state);
        System.out.println("read " + state.size() + " elements");
        createOffscreenImage(true);
      }
    }
Ejemplo n.º 24
0
  public static synchronized EncodeFileBrowser getInstance(String genomeId) throws IOException {

    String encodeGenomeId = getEncodeGenomeId(genomeId);
    EncodeFileBrowser instance = instanceMap.get(encodeGenomeId);
    if (instance == null) {
      Pair<String[], List<EncodeFileRecord>> records = getEncodeFileRecords(encodeGenomeId);
      if (records == null) {
        return null;
      }
      Frame parent = IGV.hasInstance() ? IGV.getMainFrame() : null;
      instance =
          new EncodeFileBrowser(
              parent, new EncodeTableModel(records.getFirst(), records.getSecond()));
      instanceMap.put(encodeGenomeId, instance);
    }

    return instance;
  }
Ejemplo n.º 25
0
  private static Pair<String[], List<EncodeFileRecord>> getEncodeFileRecords(String genomeId)
      throws IOException {

    InputStream is = null;

    try {

      is = EncodeFileBrowser.class.getResourceAsStream("encode." + genomeId + ".txt");
      if (is == null) {
        return null;
      }
      BufferedReader reader = new BufferedReader(new InputStreamReader(is));

      String[] headers = Globals.tabPattern.split(reader.readLine());

      List<EncodeFileRecord> records = new ArrayList<EncodeFileRecord>(20000);
      String nextLine;
      while ((nextLine = reader.readLine()) != null) {
        if (!nextLine.startsWith("#")) {

          String[] tokens = Globals.tabPattern.split(nextLine, -1);
          String path = tokens[0];

          Map<String, String> attributes = new HashMap<String, String>();
          for (int i = 0; i < headers.length; i++) {
            String value = i < tokens.length ? tokens[i] : "";
            if (value.length() > 0) {
              attributes.put(headers[i], value);
            }
          }
          records.add(new EncodeFileRecord(path, attributes));
        }
      }
      return new Pair(headers, records);
    } finally {
      if (is != null) is.close();
    }
  }
Ejemplo n.º 26
0
 boolean tryDir(String d) {
   ClassLoader L = getClass().getClassLoader();
   File p = new File(d, PACKAGE);
   System.out.println("Try " + p);
   if (!p.exists() || !p.isDirectory()) return false;
   for (File f : p.listFiles()) {
     String s = f.getName();
     if (!s.endsWith(".class")) continue;
     String name = s.substring(0, s.length() - 6);
     try {
       Class<?> c = L.loadClass(PACKAGE + "." + name);
       if (!Animator.class.isAssignableFrom(c)) continue;
       Animator a = (Animator) c.newInstance();
       a.container().setPreferredSize(DIM);
       map.put(name, a);
       System.out.println("  " + name);
       // ClassNotFoundException InstantiationException IllegalAccessException
     } catch (Exception e) {
       continue;
     }
   }
   return map.size() > 0;
 }
Ejemplo n.º 27
0
  public void selectEntityFrame(DustEntity entity, boolean createIfMissing) {
    EntityFrame iFrm = mapEntityFrames.get(entity);

    if (null == iFrm) {
      if (createIfMissing) {
        iFrm = new EntityFrame(entity);

        mapEntityFrames.put(entity, iFrm);
        desktop.add(iFrm);
      }
    }

    if (null != iFrm) {
      iFrm.show();
      iFrm.toFront();
      try {
        iFrm.setSelected(true);
      } catch (PropertyVetoException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Ejemplo n.º 28
0
    ChooseDirectory() {
      super(new BorderLayout());

      osTaskDirs = new HashMap();

      JPanel directoryPanel =
          new JPanel(new VariableGridLayout(VariableGridLayout.FIXED_NUM_COLUMNS, 3, 12, 12));

      installDir =
          addField(
              directoryPanel,
              "Install program in:",
              OperatingSystem.getOperatingSystem().getInstallDirectory(appName));

      for (int i = 0; i < osTasks.length; i++) {
        OperatingSystem.OSTask osTask = osTasks[i];
        String label = osTask.getLabel();
        if (label != null) {
          JTextField field = addField(directoryPanel, label, osTask.getDirectory());
          osTaskDirs.put(osTask, field);
        }
      }
      ChooseDirectory.this.add(BorderLayout.NORTH, directoryPanel);
    }
Ejemplo n.º 29
0
  private void updateNodes() {
    nodes = spauldingApp.getNodesSorted();
    nodeIDToRow = Collections.synchronizedMap(new HashMap<Integer, Integer>());

    for (int r = 0; r < nodes.size(); ++r) nodeIDToRow.put(nodes.get(r).getNodeID(), r);
  }
Ejemplo n.º 30
0
 private void showPuzzle(File f) {
   Map m = new HashMap();
   m.put("file", f);
   showPuzzle(m);
 }