public void setSwingDataCollection(Collection<ICFSecurityISOCountryObj> value) {
   final String S_ProcName = "setSwingDataCollection";
   swingDataCollection = value;
   if (swingDataCollection == null) {
     arrayOfISOCountry = new ICFSecurityISOCountryObj[0];
   } else {
     int len = value.size();
     arrayOfISOCountry = new ICFSecurityISOCountryObj[len];
     Iterator<ICFSecurityISOCountryObj> iter = swingDataCollection.iterator();
     int idx = 0;
     while (iter.hasNext() && (idx < len)) {
       arrayOfISOCountry[idx++] = iter.next();
     }
     if (idx < len) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Collection iterator did not fully populate the array copy");
     }
     if (iter.hasNext()) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Collection iterator had left over items when done populating array copy");
     }
     Arrays.sort(arrayOfISOCountry, compareISOCountryByQualName);
   }
   PickerTableModel tblDataModel = getDataModel();
   if (tblDataModel != null) {
     tblDataModel.fireTableDataChanged();
   }
 }
  protected void modelChanged() {
    super.modelChanged();
    MComponentInstance coi = (MComponentInstance) getOwner();
    if (coi == null) return;
    String nameStr = "";
    if (coi.getName() != null) {
      nameStr = coi.getName().trim();
    }

    // construct bases string (comma separated)
    String baseStr = "";
    Collection col = coi.getClassifiers();
    if (col != null && col.size() > 0) {
      Iterator it = col.iterator();
      baseStr = ((MClassifier) it.next()).getName();
      while (it.hasNext()) {
        baseStr += ", " + ((MClassifier) it.next()).getName();
      }
    }
    if (_readyToEdit) {
      if (nameStr == "" && baseStr == "") _name.setText("");
      else _name.setText(nameStr.trim() + " : " + baseStr);
    }
    Dimension nameMin = _name.getMinimumSize();
    Rectangle r = getBounds();
    setBounds(r.x, r.y, r.width, r.height);

    updateStereotypeText();
  }
 /** Inform all registered MeasureToolListeners that the distance is not valid anymore. */
 private void reportClearDistance() {
   Iterator iterator = this.listeners.iterator();
   while (iterator.hasNext()) {
     MeasureToolListener listener = (MeasureToolListener) iterator.next();
     listener.clearDistance();
   }
 }
    /**
     * Details have been retrieved.
     *
     * @param details the details retrieved if any.
     */
    public void detailsRetrieved(Iterator<GenericDetail> details) {
      // if treenode has changed ignore
      if (!source.equals(treeNode)) return;

      while (details.hasNext()) {
        GenericDetail d = details.next();

        if (d instanceof PhoneNumberDetail
            && !(d instanceof PagerDetail)
            && !(d instanceof FaxDetail)) {
          final PhoneNumberDetail pnd = (PhoneNumberDetail) d;
          if (pnd.getNumber() != null && pnd.getNumber().length() > 0) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    callButton.setEnabled(true);

                    if (pnd instanceof VideoDetail) {
                      callVideoButton.setEnabled(true);
                      desktopSharingButton.setEnabled(true);
                    }

                    treeContactList.refreshContact(uiContact);
                  }
                });

            return;
          }
        }
      }
    }
  /**
   * Initializes custom contact action buttons.
   *
   * @param contactActionButtons the list of buttons to initialize
   * @param gridX the X grid of the first button
   * @param xBounds the x bounds of the first button
   * @return the new grid X coordinate after adding all the buttons
   */
  private int initGroupActionButtons(
      Collection<SIPCommButton> contactActionButtons, int gridX, int xBounds) {
    // Reinit the labels to take the whole horizontal space.
    addLabels(gridX + contactActionButtons.size());

    Iterator<SIPCommButton> actionsIter = contactActionButtons.iterator();
    while (actionsIter.hasNext()) {
      final SIPCommButton actionButton = actionsIter.next();

      // We need to explicitly remove the buttons from the tooltip manager,
      // because we're going to manager the tooltip ourselves in the
      // DefaultTreeContactList class. We need to do this in order to have
      // a different tooltip for every button and for non button area.
      ToolTipManager.sharedInstance().unregisterComponent(actionButton);

      if (customActionButtonsUIGroup == null)
        customActionButtonsUIGroup = new LinkedList<JButton>();

      customActionButtonsUIGroup.add(actionButton);

      xBounds += addButton(actionButton, ++gridX, xBounds, false);
    }

    return gridX;
  }
Example #6
0
 private void fireUpdate(Manip manip) {
   Set windows = (Set) manipToWindowMap.get(manip);
   assert windows != null;
   for (Iterator iter = windows.iterator(); iter.hasNext(); ) {
     windowListener.update((AWTGLAutoDrawable) iter.next());
   }
 }
Example #7
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();
  }
    public int compareTo(Object o) {
      int row1 = modelIndex;
      int row2 = ((Row) o).modelIndex;

      for (Iterator it = sortingColumns.iterator(); it.hasNext(); ) {
        Directive directive = (Directive) it.next();
        int column = directive.column;
        Object o1 = tableModel.getValueAt(row1, column);
        Object o2 = tableModel.getValueAt(row2, column);

        int comparison = 0;
        // Define null less than everything, except null.
        if (o1 == null && o2 == null) {
          comparison = 0;
        } else if (o1 == null) {
          comparison = -1;
        } else if (o2 == null) {
          comparison = 1;
        } else {
          comparison = getComparator(column).compare(o1, o2);
        }
        if (comparison != 0) {
          return directive.direction == DESCENDING ? -comparison : comparison;
        }
      }
      return 0;
    }
Example #9
0
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
    /** Displays the labels and the values for the panel. */
    protected void displayPnlFields(HashMap hmPnl) {
      if (hmPnl == null || hmPnl.isEmpty()) return;

      Iterator keySetItr = hmPnl.keySet().iterator();
      String strLabel = "";
      String strValue = "";

      // if the file is empty, then create an empty set of textfields.
      if (hmPnl == null || hmPnl.isEmpty()) {
        displayNewTxf("", "");
        return;
      }

      Container container = getParent();
      if (container != null) container.setVisible(false);
      try {
        // Get each set of label and value, and display them.
        while (keySetItr.hasNext()) {
          strLabel = (String) keySetItr.next();
          strValue = (String) hmPnl.get(strLabel);

          displayNewTxf(strLabel, strValue);
        }

        if (container != null) container.setVisible(true);
        revalidate();
        repaint();
      } catch (Exception e) {
        Messages.writeStackTrace(e);
        // e.printStackTrace();
        Messages.postDebug(e.toString());
      }
    }
Example #11
0
  public void updateConnectionStatus(boolean connected) {
    if (connected == true) {
      headerPanel.setLogoutText();
      loginMenuItem.setText("Logout");
    } else {
      headerPanel.setLoginText();
      loginMenuItem.setText("Login...");
    }
    mainCommandPanel.updateConnectionStatus(connected);
    propertiePanel.updateConnectionStatus(connected);
    cmdConsole.updateConnectionStatus(connected);
    Iterator iterator = plugins.iterator();
    PluginPanel updatePluginPanel = null;
    while (iterator.hasNext()) {
      updatePluginPanel = (PluginPanel) iterator.next();
      updatePluginPanel.updateConnectionStatus(connected);
    }

    if (connected == true) {
      int selected = tabbedPane.getSelectedIndex();
      if (selected >= 2) {
        ((PluginPanel) pluginPanelMap.get("" + selected)).activated();
      }
    }
  }
 public void windowClosing(WindowEvent e) // write file on finish
     {
   FileOutputStream out = null;
   ObjectOutputStream data = null;
   try {
     // open file for output
     out = new FileOutputStream(DB);
     data = new ObjectOutputStream(out);
     // write Person objects to file using iterator class
     Iterator<Person> itr = persons.iterator();
     while (itr.hasNext()) {
       data.writeObject((Person) itr.next());
     }
     data.flush();
     data.close();
   } catch (Exception ex) {
     JOptionPane.showMessageDialog(
         objUpdate.this,
         "Error processing output file" + "\n" + ex.toString(),
         "Output Error",
         JOptionPane.ERROR_MESSAGE);
   } finally {
     System.exit(0);
   }
 }
Example #13
0
 private FigureElement findFigureElement(int x, int y) {
   Point2D p = new Point2D.Float((float) x, (float) y);
   for (Iterator i = canvas.members(); i.hasNext(); ) {
     FigureElement fe = (FigureElement) i.next();
     if (fe.contains(p)) return fe;
   }
   return null;
 }
Example #14
0
  protected void control(List nodes) {
    Iterator sel_nodes = nodes.iterator();
    double mid = (X_min + ((X_max - X_min) / 2));

    while (sel_nodes.hasNext()) {
      ((NodeView) sel_nodes.next()).setXPosition(mid);
    }
  }
 InstanceListModel(ASDGrammar grammar, String word) {
   ArrayList instanceList = grammar.lookupWord(word);
   for (Iterator it = instanceList.iterator(); it.hasNext(); ) {
     ASDGrammarNode n = (ASDGrammarNode) it.next();
     String instance = (String) n.instance();
     this.addElement(instance);
   }
 }
Example #16
0
 /**
  * Cause the manipulators for a given window to be drawn. The drawing occurs immediately; this
  * routine must be called when an OpenGL context is valid, i.e., from within the display() method
  * of a GLEventListener.
  */
 public synchronized void render(AWTGLAutoDrawable window, GL2 gl) {
   WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
   if (info == null) {
     throw new RuntimeException("Window not registered");
   }
   for (Iterator iter = info.manips.iterator(); iter.hasNext(); ) {
     ((Manip) iter.next()).render(gl);
   }
 }
 public void addListener(DMoteModelListener listener) {
   if (listeners == null) listeners = new ArrayList();
   Iterator it = listeners.iterator();
   while (it.hasNext()) {
     if (it.next() == listener) return;
   }
   ;
   listeners.add(listener);
 }
 /** Refreshes the drawing if there is some accumulated damage */
 public synchronized void checkDamage() {
   Iterator each = drawing().drawingChangeListeners();
   while (each.hasNext()) {
     Object l = each.next();
     if (l instanceof DrawingView) {
       ((DrawingView) l).repairDamage();
     }
   }
 }
 /** 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);
     }
   }
 }
 /** 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());
     }
   }
 }
Example #21
0
 public void initAgents(ArrayList machineAgentArray) {
   fUGeneralStrategy = new UBaseAgent("su", "supasswd", "Super User", 0);
   fServer.appendStrategy(fUGeneralStrategy);
   fCProtocol = fUGeneralStrategy.getUmcp();
   fCommandHashMap = fCProtocol.getCommandHashMap();
   Iterator iter = machineAgentArray.iterator();
   while (iter.hasNext()) {
     fServer.appendStrategy((UBaseAgent) iter.next());
   }
 }
  public static JMenu getJMenu() {
    JMenu menu = new JMenu("copy to DeploymentDiagram as ComponentInstance");
    Project p = ProjectBrowser.TheInstance.getProject();
    for (Iterator it = p.getDiagrams().iterator(); it.hasNext(); ) {
      Object d = it.next();
      if (d instanceof UMLDeploymentDiagram) menu.add(new CopyAction((UMLDeploymentDiagram) d));
    }

    return menu;
  }
Example #23
0
  // Do a O(n) pass through the motes updating the given moteSender's
  // connectivity to and from each other mote
  public void updateLossRates(MoteSimObject moteSender) {
    Iterator it = state.getMoteSimObjects().iterator();
    while (it.hasNext()) {
      MoteSimObject moteReceiver = (MoteSimObject) it.next();
      if (moteReceiver.getID() == moteSender.getID()) continue;

      updateLossRate(moteSender, moteReceiver);
      updateLossRate(moteReceiver, moteSender);
    }
  }
 public void actionPerformed(ActionEvent e) {
   JMenuItem jmi = (JMenuItem) e.getSource();
   Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText());
   if (marks.hasNext()) {
     ChronicleMarker marker = (ChronicleMarker) marks.next();
     Instant to = marker.getWhen();
     Instant from = mediator.getMajorMoment();
     viper.api.impl.Util.shiftDescriptors(new Descriptor[] {desc}, from, to);
   }
 }
 public void removeListener(DMoteModelListener listener) {
   if (listeners == null) return;
   Iterator it = listeners.iterator();
   while (it.hasNext()) {
     if (it.next() == listener) {
       it.remove();
       return;
     }
   }
 }
Example #26
0
  public ShowComp() throws InterruptedException, IOException {
    super("CONNECTED COMPUTERS");
    int x = 0, d = 20;
    mb = new JMenuBar();
    File = new JMenu("File");
    mb.add(File);
    exit = new JMenuItem("Exit");
    exit.addActionListener(this);
    File.add(exit);
    ta = new JTextArea();
    ta.setBounds(20, 30, 315, 470);
    ta.setEditable(false);
    add(ta);

    setJMenuBar(mb);

    sel = new JLabel("The connected computers are..");
    sel.setBounds(15, 5, 300, 30);
    add(sel);
    b1 = new JButton("<< BACK");
    b1.setBounds(140, 510, 100, 30);
    b1.setToolTipText("Back to main page");
    b1.addActionListener(this);
    add(b1);
    setLayout(null);
    while (x < 360) {
      x = x + d;
      setBounds(675, 50, x, 600);
      this.show();
    }
    // setVisible(true);
    String s = "192.168.0.", temp = null;
    Printer printer = new Printer();
    printer.start();
    Connector connector = new Connector(printer);
    connector.start();

    LinkedList targets = new LinkedList();
    for (int i = 1; i <= 255; i++) {
      temp = s + Integer.toString(i);
      Target t = new Target(temp);
      targets.add(t);
      connector.add(t);
    }
    Thread.sleep(2000);
    connector.shutdown();
    connector.join();

    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target t = (Target) i.next();
      if (!t.shown) t.show();
    }

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  }
Example #27
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);
  }
 public void actionPerformed(ActionEvent e) {
   Iterator toInterp = Collections.singleton(desc).iterator();
   JMenuItem jmi = (JMenuItem) e.getSource();
   Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText());
   if (marks.hasNext()) {
     ChronicleMarker marker = (ChronicleMarker) marks.next();
     Instant to = marker.getWhen();
     Instant from = mediator.getMajorMoment();
     mediator.getPropagator().interpolateDescriptors(toInterp, from, to);
   }
 }
Example #29
0
  private boolean containInstance(Instance sel, Slot slot, Instance instance) {
    if (itsInstance == null) return false;
    Collection instances = sel.getOwnSlotValues(slot);
    Iterator i = instances.iterator();
    while (i.hasNext()) {

      Instance tmpInstance = (Instance) i.next();
      if (tmpInstance.equals(instance)) return true;
    }
    return false;
  }
Example #30
0
 // This is used for Query test
 public Collection search(Collection instances, Slot slot, String operation, Object obj) {
   ArrayList resultInstances = new ArrayList();
   Iterator i = instances.iterator();
   String value = (String) (((Instance) obj).getBrowserText());
   while (i.hasNext()) {
     Instance instance = (Instance) i.next();
     if (testInstance(getTestIndex(operation), instance, slot, value))
       resultInstances.add(instance);
   }
   return resultInstances;
 }