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();
   }
 }
示例#2
0
  /** draw the arrows between items */
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (_glist != null && _glist.size() > 1) {
      Graphics2D g2 = (Graphics2D) g;
      Arrow leftArrow = new Arrow();
      leftArrow.setColor(Color.BLACK);

      Arrow rightArrow = new Arrow();
      rightArrow.setColor(Color.RED);

      Iterator<GNode> iter = _glist.iterator();

      while (iter.hasNext()) {
        GNode nCur = iter.next();
        if (nCur.left != null) {
          leftArrow.setLine(nCur.getStart(), nCur.left.getEnd());
          leftArrow.draw(g2);
        }
        if (nCur.right != null) {
          rightArrow.setLine(nCur.getStart(), nCur.right.getEnd());
          rightArrow.draw(g2);
        }
      }
    }
  }
示例#3
0
 /**
  * Distributes the given file change event among all file change listeners.
  *
  * @param event the file change event to distribute
  */
 protected void distributeFileChangeEvent(FileChangeEvent event) {
   Iterator it = fileListeners.iterator();
   while (it.hasNext()) {
     FileChangeListener listener = (FileChangeListener) it.next();
     listener.fileChanged(event);
   }
 }
示例#4
0
 public boolean predicate2(Object dm, Designer dsgr) {
   if (!(dm instanceof MClassifier)) return NO_PROBLEM;
   MClassifier cls = (MClassifier) dm;
   String myName = cls.getName();
   //@ if (myName.equals(Name.UNSPEC)) return NO_PROBLEM;
   String myNameString = myName;
   if (myNameString.length() == 0) return NO_PROBLEM;
   Collection pkgs = cls.getElementImports2();
   if (pkgs == null) return NO_PROBLEM;
   for (Iterator iter = pkgs.iterator(); iter.hasNext();) {
     MElementImport imp = (MElementImport)iter.next();
     MNamespace ns = imp.getPackage();
     Collection siblings = ns.getOwnedElements();
     if (siblings == null) return NO_PROBLEM;
     Iterator enum = siblings.iterator();
     while (enum.hasNext()) {
       MElementImport eo = (MElementImport) enum.next();
       MModelElement me = (MModelElement) eo.getModelElement();
       if (!(me instanceof MClassifier)) continue;
       if (me == cls) continue;
       String meName = me.getName();
       if (meName == null || meName.equals("")) continue;
       if (meName.equals(myNameString)) return PROBLEM_FOUND;
     }
   };
   return NO_PROBLEM;
 }
  protected boolean refreshFeatureSelection(String layerName, String id) {

    try {
      if (id == null || geopistaEditor == null) return false;
      this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      geopistaEditor.getSelectionManager().clear();
      GeopistaLayer geopistaLayer =
          (GeopistaLayer) geopistaEditor.getLayerManager().getLayer(layerName);
      Collection collection = searchByAttribute(geopistaLayer, 0, id);
      Iterator it = collection.iterator();
      if (it.hasNext()) {
        Feature feature = (Feature) it.next();
        geopistaEditor.select(geopistaLayer, feature);
      }
      geopistaEditor.zoomToSelected();
      this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      return true;
    } catch (Exception ex) {
      this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      ex.printStackTrace(pw);
      logger.error("Exception: " + sw.toString());
      return false;
    }
  }
示例#6
0
  /**
   * Adds resources for contact.
   *
   * @param tip the tool tip
   * @param protocolContact the protocol contact, which resources we're looking for
   */
  private void addContactResourceTooltipLines(ExtendedTooltip tip, Contact protocolContact) {
    Collection<ContactResource> contactResources = protocolContact.getResources();

    if (contactResources == null) return;

    Iterator<ContactResource> resourcesIter = contactResources.iterator();

    while (resourcesIter.hasNext()) {
      ContactResource contactResource = resourcesIter.next();

      // We only add the status icon if we have more than one resources,
      // otherwise it will always be identical to the contact status icon.
      ImageIcon protocolStatusIcon = null;
      if (contactResources.size() > 1) {
        protocolStatusIcon =
            ImageLoader.getIndexedProtocolIcon(
                ImageUtils.getBytesInImage(contactResource.getPresenceStatus().getStatusIcon()),
                protocolContact.getProtocolProvider());
      }

      String resourceName =
          (contactResource.getPriority() >= 0)
              ? contactResource.getResourceName() + " (" + contactResource.getPriority() + ")"
              : contactResource.getResourceName();

      if (protocolStatusIcon == null) tip.addSubLine(protocolStatusIcon, resourceName, 27);
      else tip.addSubLine(protocolStatusIcon, resourceName, 20);
    }

    tip.revalidate();
    tip.repaint();
  }
示例#7
0
 public void up(MessageBatch batch) {
   for (Iterator<Message> it = batch.iterator(); it.hasNext(); ) {
     Message msg = it.next();
     if (msg != null && shouldDropUpMessage(msg, msg.getSrc())) it.remove();
   }
   if (!batch.isEmpty()) up_prot.up(batch);
 }
示例#8
0
  public void setDefaultLiqLotForOutStanding(
      BuySellType buySellType,
      boolean isSelectedRelationOrder,
      boolean isSpotTrade,
      Boolean isMakeLimitOrder) {
    for (Iterator<RelationOrder> iterator = this._outstandingOrders.values().iterator();
        iterator.hasNext(); ) {
      RelationOrder relationOrder = iterator.next();

      relationOrder.set_IsSelected(isSelectedRelationOrder);
      BigDecimal liqLot =
          relationOrder.get_OpenOrder().getAvailableLotBanlance(isSpotTrade, isMakeLimitOrder);
      if (this._outstandingOrders.values().size() == 1) {
        TradePolicyDetail tradePolicyDetail = this.getTradePolicyDetail();
        liqLot = AppToolkit.fixCloseLot(liqLot, liqLot, tradePolicyDetail, this._account);
      }

      boolean isBuy = (buySellType == BuySellType.Buy);
      if (buySellType == BuySellType.Both) {
        relationOrder.set_LiqLot(liqLot);
        // Update Outstanding Order UI
        relationOrder.update(this._outstandingKey);
      } else if (relationOrder.get_IsBuy() != isBuy) {
        relationOrder.set_LiqLot(liqLot);
        // Update Outstanding Order UI
        // maybe not binding
        // if (this._isBuyForCurrent != isBuy)
        // {
        relationOrder.update(this._outstandingKey);
        // }
      }
    }
  }
示例#9
0
  public void attemptToFinishActiveJob(String caseID, String taskID) {
    Set workItems = _engineClient.getAllWorkItems();
    for (Iterator iterator = workItems.iterator(); iterator.hasNext(); ) {
      YWorkItem item = (YWorkItem) iterator.next();
      if (item.getCaseID().toString().equals(caseID) && item.getTaskID().equals(taskID)) {
        try {
          String outputData = _myActiveTasks.getOutputData(caseID, taskID);

          /** AJH: Write the output data into test data file */
          File testDataDir = YAdminGUI.getSpecTestDataDirectory(item.getSpecificationID().getKey());
          File taskInputData = new File(testDataDir, taskID + ".xml");
          if (!taskInputData.exists()) {
            logger.info("Creating task data file - " + taskInputData.getAbsolutePath());
            taskInputData.createNewFile();
          }
          StringUtil.stringToFile(taskInputData.getAbsolutePath(), outputData);

          //        _engineClient.completeWorkItem(item, outputData, inSequenceWorkitemIDs);
          _engineClient.completeWorkItem(item, outputData, null, YEngine.WorkItemCompletion.Normal);
        } catch (YDataStateException e) {
          String errors = e.getMessage();
          if (errors.indexOf("FAILED TO VALIDATE AGAINST SCHEMA =") != -1) {
            System.out.println(e.getMessage());
            new SpecificationQueryProcessingValidationErrorBox(_frame, item, e);
          } else {
            new UserInputValidationErrorBox(_frame, item, e);
            System.out.println(e.getMessage());
          }
        } catch (Exception e) {
          // todo AJH - Create defalut skeleton at this point????
          reportGeneralProblem(e);
        }
      }
    }
  }
示例#10
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);
    }
  }
示例#11
0
    public void actionPerformed(ActionEvent e) {
      Object source = e.getSource();

      // Predetermine which method to call so that
      // we don't traverse if statements for each iteration.
      int idx = -1;
      if (source == _next) {
        idx = 0;
      } else if (source == _back) {
        idx = 1;
      } else if (source == _cancel) {
        idx = 2;
      } else if (source == _finish) {
        idx = 3;
      }

      Iterator it = _listeners.iterator();
      while (it.hasNext()) {
        NavigatorListener l = (NavigatorListener) it.next();
        switch (idx) {
          case 0:
            l.nextStep();
            break;
          case 1:
            l.backStep();
            break;
          case 2:
            l.cancel();
            break;
          case 3:
            l.finish();
            break;
        }
      }
    }
示例#12
0
文件: Viewer3D.java 项目: psava/cwp12
 public void saveView(String filename) {
   BoundingSphere bs = _ipg.getBoundingSphere(true);
   Vector3 tvec = _view.getTranslate();
   try {
     FileWriter fw = new FileWriter(filename);
     PrintWriter out = new PrintWriter(fw);
     out.println(bs.getRadius());
     Point3 center = bs.getCenter();
     out.printf("%f %f %f \n", center.x, center.y, center.z);
     out.println(_view.getAzimuth());
     out.println(_view.getElevation());
     out.println(_view.getScale());
     out.printf("%f %f %f \n", tvec.x, tvec.y, tvec.z);
     Iterator<ImagePanel> itr = _ipg.getImagePanels();
     while (itr.hasNext()) {
       ImagePanel ip = itr.next();
       AxisAlignedFrame aaf = ip.getFrame();
       Point3 min = aaf.getCornerMin();
       Point3 max = aaf.getCornerMax();
       out.printf("%f %f %f %f %f %f\n", min.x, min.y, min.z, max.x, max.y, max.z);
     }
     out.println(_pmax);
     out.println(_color.getCode());
     out.close();
   } catch (Exception e) {
     System.out.println(e);
   }
 }
  public String toString() {
    StringBuffer b = new StringBuffer();
    b.append("ID:" + id);
    b.append("\tName:" + name);
    b.append("\tSex:" + sex + "\n");
    b.append("\tAffected:" + affection + "\n");

    if (mother == null) {
      b.append("\tMother: null");
    } else {
      b.append("\tMother:" + mother.id);
    }

    if (father == null) {
      b.append("\tFather: null");
    } else {
      b.append("\tFather:" + father.id);
    }

    b.append("\tChildren:");
    Vector<PelicanPerson> children = getChildren();
    if (children.size() > 0) {
      Iterator<PelicanPerson> it = children.iterator();
      while (it.hasNext()) {
        PelicanPerson p = it.next();
        b.append(p.id + ",");
      }
      b.deleteCharAt(b.length() - 1);
    } else {
      b.append("none");
    }
    b.append("\n");
    return b.toString();
  }
示例#14
0
 /** Redraw ell shapes currently on the Canvas. */
 private void redraw() {
   erase();
   for (Iterator i = objects.iterator(); i.hasNext(); ) {
     shapes.get(i.next()).draw(graphic);
   }
   canvas.repaint();
 }
    /** 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());
      }
    }
示例#16
0
 private void createPainToTree3true(
     final DefaultTreeModel treeModel, DefaultMutableTreeNode root, Collection paintCollection) {
   ArrayList a = (ArrayList) paintCollection;
   Iterator i = a.iterator();
   Person p = null;
   Person parent = null;
   DefaultMutableTreeNode parentNode = root;
   DefaultMutableTreeNode newNode;
   while (i.hasNext()) {
     p = (Person) i.next();
     int ves, ves2;
     if (parent != null) {
       parent = (Person) parentNode.getUserObject();
       ves = comparePerson(p, (Person) parentNode.getUserObject());
       ves2 = comparePersonAsString(p, (Person) parentNode.getUserObject()) + 1;
       System.out.println("ves = " + ves + " ves2= " + ves2);
       switch (ves) {
         case 0:
           {
             parentNode = root;
             parent = null;
             break;
           }
         case 1:
           {
           }
       }
     }
     newNode = new DefaultMutableTreeNode(p);
     parentNode.add(newNode);
     parent = p;
     parentNode = newNode;
   }
 }
 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);
   }
 }
示例#18
0
  /**
   * Return the XML test data for a specified task
   *
   * @param caseID
   * @param taskID
   * @return testData
   */
  public String getTaskTestData(String caseID, String taskID) {
    String testData = null;
    File taskInputData = null;

    Set workItems = _engineClient.getAllWorkItems();
    for (Iterator iterator = workItems.iterator(); iterator.hasNext(); ) {
      YWorkItem item = (YWorkItem) iterator.next();
      if (item.getCaseID().toString().equals(caseID) && item.getTaskID().equals(taskID)) {
        try {
          File testDataDir = YAdminGUI.getSpecTestDataDirectory(item.getSpecificationID().getKey());
          taskInputData = new File(testDataDir, taskID + ".xml");
          if (taskInputData.exists()) {
            testData = StringUtil.fileToString(taskInputData);
          }
        } catch (Exception e) {
          reportGeneralProblem(e);
        }
      }
    }

    if (testData == null) {
      return testData;
    } else if (testData.startsWith(xmlCommentHeader)) {
      return testData;
    } else {
      return xmlCommentHeader + taskInputData.getName() + " -->\n" + testData;
    }
  }
示例#19
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;
    }
 public void readXMLData() {
   energy = new double[0];
   magnetization = new double[0];
   numberOfPoints = 0;
   String filename = "ising_data.xml";
   JFileChooser chooser = OSPFrame.getChooser();
   int result = chooser.showOpenDialog(null);
   if (result == JFileChooser.APPROVE_OPTION) {
     filename = chooser.getSelectedFile().getAbsolutePath();
   } else {
     return;
   }
   XMLControlElement xmlControl = new XMLControlElement(filename);
   if (xmlControl.failedToRead()) {
     control.println("failed to read: " + filename);
   } else {
     // gets the datasets in the xml file
     Iterator it = xmlControl.getObjects(Dataset.class, false).iterator();
     while (it.hasNext()) {
       Dataset dataset = (Dataset) it.next();
       if (dataset.getName().equals("magnetization")) {
         magnetization = dataset.getYPoints();
       }
       if (dataset.getName().equals("energy")) {
         energy = dataset.getYPoints();
       }
     }
     numberOfPoints = magnetization.length;
     control.println("Reading: " + filename);
     control.println("Number of points = " + numberOfPoints);
   }
   calculate();
   plotFrame.repaint();
 }
示例#22
0
  /**
   * Set the object to be edited.
   *
   * @param value The object to be edited.
   */
  public void setObject(Object value) {
    if (!(_type.isInstance(value))) {
      throw new IllegalArgumentException(value.getClass() + " is not of type " + _type);
    }
    _value = value;

    // Disable event generation.
    _squelchChangeEvents = true;

    // Iterate over each property, doing a lookup on the associated editor
    // and setting the editor's value to the value of the property.
    Iterator it = _prop2Editor.keySet().iterator();
    while (it.hasNext()) {
      PropertyDescriptor desc = (PropertyDescriptor) it.next();
      PropertyEditor editor = (PropertyEditor) _prop2Editor.get(desc);
      Method reader = desc.getReadMethod();
      if (reader != null) {
        try {
          Object val = reader.invoke(_value, null);
          editor.setValue(val);
        } catch (IllegalAccessException ex) {
          ex.printStackTrace();
        } catch (InvocationTargetException ex) {
          ex.getTargetException().printStackTrace();
        }
      }
    }

    // Enable event generation.
    _squelchChangeEvents = false;
  }
示例#23
0
 public static void hidePopups(Component comp) {
   if (comp != null) {
     label0:
     for (Component c = comp; c != null; c = c.getParent()) {
       if (!(c instanceof ZPopupGallery)) continue;
       do {
         if (currShownList.size() <= 0) continue label0;
         if (currShownList.getLast() == c) return;
         ZPopupGallery jpg = (ZPopupGallery) currShownList.removeLast();
         Popup popup = (Popup) popupGalleryHM.get(jpg);
         popup.hide();
         popupGalleryHM.remove(jpg);
       } while (true);
     }
   }
   Iterator iterator = popupGalleryHM.keySet().iterator();
   do {
     if (!iterator.hasNext()) break;
     ZPopupGallery gallery = (ZPopupGallery) iterator.next();
     ((Popup) popupGalleryHM.get(gallery)).hide();
     if (gallery.getActionListener() != null)
       gallery.getActionListener().actionPerformed(new ActionEvent(gallery, 1, "Hidden"));
   } while (true);
   popupGalleryHM.clear();
 }
示例#24
0
  private void update(int card, int count) {
    this.cardIndex = card;

    if (cardIndex < count) {
      float mb = ((count - card) * cardImageSource.getAverageSize()) / 1024;
      bar.setString(
          String.format("%d of %d cards finished! Please wait! [%.1f Mb]", card, count, mb));
    } else {
      Iterator<CardDownloadData> cardsIterator = DownloadPictures.this.cards.iterator();
      while (cardsIterator.hasNext()) {
        CardDownloadData cardDownloadData = cardsIterator.next();
        TFile file = new TFile(CardImageUtils.generateImagePath(cardDownloadData));
        if (file.exists()) {
          cardsIterator.remove();
        }
      }
      count = DownloadPictures.this.cards.size();

      if (count == 0) {
        bar.setString("0 cards remaining! Please close!");
      } else {
        bar.setString(String.format("%d cards remaining! Please choose another source!", count));
        // executor = Executors.newFixedThreadPool(10);
        startDownloadButton.setEnabled(true);
      }
    }
  }
示例#25
0
 private static void retainOnlyJarsAndDirectories(List<VirtualFile> woSdk) {
   for (Iterator<VirtualFile> iterator = woSdk.iterator(); iterator.hasNext(); ) {
     VirtualFile file = iterator.next();
     final VirtualFile local = ArchiveVfsUtil.getVirtualFileForJar(file);
     final boolean dir = file.isDirectory();
     final String name = file.getName();
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Considering: "
               + file.getPath()
               + "; local="
               + local
               + "; dir="
               + dir
               + "; name="
               + name);
     }
     if (dir || local != null) {
       continue;
     }
     if (name.endsWith(".jar")) {
       continue;
     }
     LOG.debug("Removing");
     iterator.remove();
   }
 }
    /**
     * 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;
          }
        }
      }
    }
 /**
  * Notifies the listeners to refresh the screen
  *
  * @param ne the edge that has been removed
  */
 protected void notifyListenersOfRemove(NamedEdge ne) {
   Iterator i = listeners.iterator();
   while (i.hasNext()) {
     WorkingMemoryListener wml = (WorkingMemoryListener) i.next();
     wml.WMERemoved(new WorkingMemoryEvent(ne));
   }
 }
  /**
   * 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;
  }
  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();
  }
示例#30
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();
      }
    }
  }