Exemplo n.º 1
1
    // create from a dataset
    public VariableBean(Variable vs) {
      this.vs = vs;
      // vs = (v instanceof VariableEnhanced) ? (VariableEnhanced) v : new VariableStandardized( v);

      setName(vs.getShortName());
      setDescription(vs.getDescription());
      setUnits(vs.getUnitsString());
      setDataType(vs.getDataType().toString());

      // Attribute csAtt = vs.findAttribute("_coordSystems");
      // if (csAtt != null)
      //  setCoordSys( csAtt.getStringValue());

      // collect dimensions
      StringBuilder lens = new StringBuilder();
      StringBuilder names = new StringBuilder();
      java.util.List dims = vs.getDimensions();
      for (int j = 0; j < dims.size(); j++) {
        ucar.nc2.Dimension dim = (ucar.nc2.Dimension) dims.get(j);
        if (j > 0) {
          lens.append(",");
          names.append(",");
        }
        String name = dim.isShared() ? dim.getName() : "anon";
        names.append(name);
        lens.append(dim.getLength());
      }
      setDimensions(names.toString());
      setShape(lens.toString());
    }
Exemplo n.º 2
0
    public void actionPerformed(ActionEvent e) {
      JTextField tf = getTextField();
      final String text = tf.getText();
      final int caretIndex = tf.getCaretPosition();
      String pre = text.substring(0, caretIndex);
      java.util.List<TreeNode> nodes = null; // m_root.search(pre);
      // Collections.sort(nodes);
      if (nodes.isEmpty()) {
        return;
      }

      JPopupMenu jp = new JPopupMenu("options");

      JMenuItem lastItem = null;
      for (TreeNode node : nodes) {
        String nodeName = node.toString();
        String insertion = nodeName.substring(leaf(pre, ".").length());
        lastItem = createInsertAction(nodeName, caretIndex, insertion);
        jp.add(lastItem);
      }
      if (nodes.size() == 0) {
        return;
      }
      if (nodes.size() == 1) {
        lastItem.getAction().actionPerformed(null);
      } else {
        Point pos = tf.getCaret().getMagicCaretPosition();
        pos = pos != null ? pos : new Point(2, 2);
        jp.show(tf, pos.x, pos.y);
      }
    }
Exemplo n.º 3
0
  private void resetSemImEditor() {
    java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList();

    if (semEstimators.size() == 1) {
      SemEstimator estimatedSem = semEstimators.get(0);
      SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
      panel.removeAll();
      panel.add(editor, BorderLayout.CENTER);
      panel.revalidate();
      panel.repaint();

    } else {
      JTabbedPane tabs = new JTabbedPane();

      for (int i = 0; i < semEstimators.size(); i++) {
        SemEstimator estimatedSem = semEstimators.get(i);
        SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
        JPanel _panel = new JPanel();
        _panel.setLayout(new BorderLayout());
        _panel.add(editor, BorderLayout.CENTER);
        tabs.addTab(estimatedSem.getDataSet().getName(), _panel);
      }

      panel.removeAll();
      panel.add(tabs);
      panel.validate();
    }
  }
 private void clearDeleteRecord() {
   if (deleteList != null) {
     java.util.List list = deleteList.getSelection();
     if (list.size() > 0) {
       try {
         java.util.List dbIDs = new ArrayList(list.size());
         for (Iterator it = list.iterator(); it.hasNext(); ) {
           GKInstance instance = (GKInstance) it.next();
           dbIDs.add(instance.getDBID());
         }
         fileAdaptor.clearDeleteRecord(dbIDs);
       } catch (IOException e) {
         System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e);
         e.printStackTrace();
       }
       deleteList.deleteInstances(list);
       // Check if deleteList needs to be removed
       if (deleteList.getDisplayedInstances().size() == 0) {
         centerPane.remove(deleteList);
         centerPane.validate();
         centerPane.repaint();
       }
     }
   }
 }
Exemplo n.º 5
0
  public void testTest() throws Exception {
    java.util.List<Track> tracks = IGV.getInstance().getAllTracks();
    System.out.println("# tracks: " + tracks.size());
    for (Track track : tracks) {
      System.out.println(track.getName());
    }

    java.util.List<Track> featureTracks =
        IGV.getInstance().getTrackPanel(IGV.FEATURE_PANEL_NAME).getTracks();
    System.out.println(featureTracks.size());
  }
Exemplo n.º 6
0
  /**
   * Adds the component of a specific <tt>PluginComponent</tt> to the associated <tt>Container</tt>.
   *
   * @param c the <tt>PluginComponent</tt> which is to have its component added to the
   *     <tt>Container</tt> associated with this <tt>PluginContainer</tt>
   */
  private synchronized void addPluginComponent(PluginComponent c) {
    /*
     * Try to respect positionIndex of PluginComponent to some extent:
     * PluginComponents with positionIndex equal to 0 go at the beginning,
     * these with positionIndex equal to -1 follow them and then go these
     * with positionIndex greater than 0.
     */
    int cIndex = c.getPositionIndex();
    int index = -1;
    int i = 0;

    for (PluginComponent pluginComponent : pluginComponents) {
      if (pluginComponent.equals(c)) return;

      if (-1 == index) {
        int pluginComponentIndex = pluginComponent.getPositionIndex();

        if ((0 == cIndex) || (-1 == cIndex)) {
          if ((0 != pluginComponentIndex) && (cIndex != pluginComponentIndex)) index = i;
        } else if (cIndex < pluginComponentIndex) index = i;
      }

      i++;
    }

    int pluginComponentCount = pluginComponents.size();

    if (-1 == index) index = pluginComponents.size();

    /*
     * The container may have added Components of its own apart from the
     * ones this PluginContainer has added to it. Since the common case for
     * the additional Components is to have them appear at the beginning,
     * adjust the index so it gets correct in the common case.
     */
    int containerComponentCount = getComponentCount(container);

    addComponentToContainer(
        (Component) c.getComponent(),
        container,
        (containerComponentCount > pluginComponentCount)
            ? (index + (containerComponentCount - pluginComponentCount))
            : index);
    pluginComponents.add(index, c);

    container.revalidate();
    container.repaint();
  }
 /** Retrieve item types and fill in the item types combo box. */
 private void init() {
   Response res = ClientUtils.getData("loadItemTypes", new GridParams());
   Domain d = new Domain("ITEM_TYPES");
   if (!res.isError()) {
     ItemTypeVO vo = null;
     list = ((VOListResponse) res).getRows();
     for (int i = 0; i < list.size(); i++) {
       vo = (ItemTypeVO) list.get(i);
       d.addDomainPair(vo.getProgressiveHie02ITM02(), vo.getDescriptionSYS10());
     }
   }
   controlHierarchy.setDomain(d);
   controlHierarchy
       .getComboBox()
       .addItemListener(
           new ItemListener() {
             public void itemStateChanged(ItemEvent e) {
               if (e.getStateChange() == e.SELECTED) {
                 ItemTypeVO typeVO = (ItemTypeVO) list.get(controlHierarchy.getSelectedIndex());
                 treePanel.setCompanyCode(typeVO.getCompanyCodeSys01ITM02());
                 treePanel.setProgressiveHIE02((BigDecimal) controlHierarchy.getValue());
                 DetailSupplierVO vo =
                     (DetailSupplierVO) supplierPanel.getVOModel().getValueObject();
                 treePanel.setCompanyCode(vo.getCompanyCodeSys01REG04());
                 treePanel.reloadTree();
                 itemsGrid.clearData();
               }
             }
           });
   if (d.getDomainPairList().length == 1) controlHierarchy.getComboBox().setSelectedIndex(0);
   else controlHierarchy.getComboBox().setSelectedIndex(-1);
 }
Exemplo n.º 8
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
  private void handleEntryAction(ActionEvent actionEvent)
      throws IOException, ParserConfigurationException, XPathExpressionException, SAXException,
          NoItemException {
    if (this.getGazetteer() == null) {
      Util.getLogger().severe("No gazeteer is registered");
      return;
    }

    String lookupString;

    JComboBox cmb = ((JComboBox) actionEvent.getSource());
    lookupString = cmb.getSelectedItem().toString();

    if (lookupString == null || lookupString.length() < 1) return;

    java.util.List<PointOfInterest> results = this.gazetteer.findPlaces(lookupString);
    if (results == null || results.size() == 0) return;

    this.controller.moveToLocation(results.get(0));

    // Add it to the list if not already there
    for (int i = 0; i < cmb.getItemCount(); i++) {
      Object oi = cmb.getItemAt(i);
      if (oi != null && oi.toString().trim().equals(lookupString)) return; // item exists
    }
    cmb.insertItemAt(lookupString, 0);
  }
Exemplo n.º 10
0
 public void setTablaPrincipal(java.util.List val) {
   DefaultTableModel modelo = ((DefaultTableModel) this.tablaPrincipal.getModel());
   for (int i = 0; i < val.size(); i++) {
     modelo.addRow(((java.util.ArrayList) val.get(i)).toArray());
   }
   this.calculaSumas();
 }
Exemplo n.º 11
0
 private void showInfoActionPerformed() {
   java.util.List itemList = grid.getCheckedRows();
   if (itemList.size() > 0) {
     ViewRecordScreen screen = new ViewRecordScreen(getSubsystemApp());
     List selectedRows = new ArrayList();
     for (int i = 0; i < itemList.size(); i++) {
       CopyRightReportRowData data = (CopyRightReportRowData) itemList.get(i);
       TempCopyrightRecord copyrightRecord = (TempCopyrightRecord) data.getEntity();
       selectedRows.add(copyrightRecord);
     }
     screen.setData(selectedRows);
     screen.showModal();
   } else {
     MessagePanes.showWarningDialog(
         this, props.getProperty(StandardActionNames.SELECT_ONE_ROW), local);
   }
 }
Exemplo n.º 12
0
 public void assignRobotRepresent(VivaeRobotRepresent repr) {
   int activePositionsCnt = positions.size();
   PositionMark pattern = positions.get(actives.size() % activePositionsCnt);
   repr.getBody().setPosition((float) pattern.getX(), (float) pattern.getY());
   repr.setArena(this);
   repr.setWorld(getWorld());
   addActive((Active) repr);
 }
Exemplo n.º 13
0
  private void mRemoveNode() {
    String old_node = (String) lstNodes.getSelectedValue();

    java.util.List remove_list =
        ConfigUtilities.getElementsWithDefinition(mBroker.getElements(mContext), old_node);
    for (int i = 0; i < remove_list.size(); i++) {
      mBroker.remove(mContext, (ConfigElement) remove_list.get(i));
    }
  }
Exemplo n.º 14
0
 public List<Pair<String, TextWithImports>> getExpressions() {
   final ArrayList<Pair<String, TextWithImports>> pairs =
       new ArrayList<Pair<String, TextWithImports>>(myData.size());
   for (Iterator<Row> it = myData.iterator(); it.hasNext(); ) {
     final Row row = it.next();
     pairs.add(new Pair<String, TextWithImports>(row.name, row.value));
   }
   return pairs;
 }
Exemplo n.º 15
0
  public static DefaultPieDataset getPieDataset(String chartName, DBSeerDataSet dataset) {
    StatisticalPackageRunner runner = DBSeerGUI.runner;

    runner.eval(
        "[title legends Xdata Ydata Xlabel Ylabel timestamp] = plotter.plot" + chartName + ";");

    String title = runner.getVariableString("title");
    Object[] legends = (Object[]) runner.getVariableCell("legends");
    Object[] xCellArray = (Object[]) runner.getVariableCell("Xdata");
    Object[] yCellArray = (Object[]) runner.getVariableCell("Ydata");
    String xLabel = runner.getVariableString("Xlabel");
    String yLabel = runner.getVariableString("Ylabel");
    timestamp = runner.getVariableDouble("timestamp");

    DefaultPieDataset pieDataSet = new DefaultPieDataset();

    int numLegends = legends.length;
    int numXCellArray = xCellArray.length;
    int numYCellArray = yCellArray.length;
    int dataCount = 0;

    if (numXCellArray != numYCellArray) {
      JOptionPane.showMessageDialog(
          null,
          "The number of X dataset and Y dataset does not match.",
          "The number of X dataset and Y dataset does not match.",
          JOptionPane.ERROR_MESSAGE);
      return null;
    }

    final java.util.List<String> transactionTypeNames = dataset.getTransactionTypeNames();

    for (int i = 0; i < numYCellArray; ++i) {
      double[] xArray = (double[]) xCellArray[i];
      runner.eval("yArraySize = size(Ydata{" + (i + 1) + "});");
      runner.eval("yArray = Ydata{" + (i + 1) + "};");
      double[] yArraySize = runner.getVariableDouble("yArraySize");
      double[] yArray = runner.getVariableDouble("yArray");

      int xLength = xArray.length;
      int row = (int) yArraySize[0];
      int col = (int) yArraySize[1];

      for (int c = 0; c < col; ++c) {
        if (c < transactionTypeNames.size()) {
          String name = transactionTypeNames.get(c);
          if (!name.isEmpty()) {
            pieDataSet.setValue(name, yArray[c]);
          } else {
            pieDataSet.setValue("Transaction Type " + (c + 1), yArray[c]);
          }
        }
      }
    }

    return pieDataSet;
  }
Exemplo n.º 16
0
 @Override
 public void run() {
   if (myTreeView != null && myCommandsProcessedCount < myLog.size()) {
     if (!myIsOutputPaused) {
       new OutputFlusher().doFlush();
       myTreeView.scrollToLastMessage();
     }
   }
 }
 private JPanel createDisplayMapPane() {
   centerPane = new JPanel();
   centerPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
   cellRenderer = new SyncListCellRenderer();
   selectionListener =
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent e) {
           ensureSingleListSelection(e);
           validateActions();
         }
       };
   centerPane.setLayout(new BoxLayout(centerPane, BoxLayout.Y_AXIS));
   java.util.List list = (java.util.List) syncMap.get(CHANGED_KEY);
   if (list != null && list.size() > 0) {
     changedList =
         initInstanceListPane(
             list,
             "Instances different between the local and the db repositories: " + list.size());
   }
   list = (java.util.List) syncMap.get(NEW_KEY);
   if (list != null && list.size() > 0) {
     // Double click to show the Instance in the local repository
     newList = initInstanceListPane(list, "Instances created locally: " + list.size());
   }
   list = (java.util.List) syncMap.get(DELETE_IN_DB_KEY);
   if (list != null && list.size() > 0) {
     // Double click to show the Instance in the local repository
     deleteInDBList =
         initInstanceListPane(list, "Instances deleted in the database: " + list.size());
   }
   list = (java.util.List) syncMap.get(DELETE_KEY);
   if (list != null && list.size() > 0) {
     // Double click to show the Instance in the db repository
     deleteList = initInstanceListPane(list, "Instances deleted locally: " + list.size());
   }
   list = (java.util.List) syncMap.get(LOCAL_HAS_MORE_IE_KEY);
   if (list != null && list.size() > 0) {
     localHasMoreIEList =
         initInstanceListPane(
             list, "Local instances having unexpected InstanceEdits: " + list.size());
   }
   return centerPane;
 }
Exemplo n.º 18
0
    /**
     * Removes specific rows from the list of reading lists.
     *
     * @param aRows rows to remove.
     */
    public void removeRows(int[] aRows) {
      Arrays.sort(aRows);

      java.util.List<ReadingList> newLists = new ArrayList<ReadingList>(Arrays.asList(lists));
      for (int i = aRows.length - 1; i >= 0; i--) {
        newLists.remove(aRows[i]);
      }

      setLists(newLists.toArray(new ReadingList[newLists.size()]));
    }
Exemplo n.º 19
0
    public BGnodeFrame(
        String name,
        java.util.List<SingleProducer> producers,
        java.util.List<SingleConsumer> consumers,
        NodeID nid,
        ScatterGather sg) {
      super(name);

      BGnodePanel b = new BGnodePanel(nid, producers, consumers, sg);
      getContentPane().add(b);
      getContentPane().setLayout(new FlowLayout());

      for (int i = 0; i < consumers.size(); i++)
        b.addConsumer(consumers.get(i), null); // null means autolabel
      for (int i = 0; i < producers.size(); i++)
        b.addProducer(producers.get(i), null); // null means autolabel

      this.setLocation(hPos, vPos);
      vPos += 200;
    }
Exemplo n.º 20
0
 private void moveItemDown() {
   int index = menuItemsTable.getSelectedRow();
   // Return if nothing was selected.
   if (index == -1) return;
   java.util.List<Parameter.MenuItem> items = parameter.getMenuItems();
   // Return if the last item is selected.
   if (index >= items.size() - 1) return;
   nodeAttributesDialog.moveParameterItemDown(parameter, index);
   // TODO: Changing the selection doesn't have any effect on Mac.
   menuItemsTable.changeSelection(index + 1, 1, false, false);
 }
Exemplo n.º 21
0
  /**
   * Gets the data from the <tt>ConfigurationService</tt> that will construct the
   * <tt>PropsTableModel</tt> for the properties table.
   *
   * @return The data necessary to initialize the <tt>PropsTableModel</tt>
   */
  private Object[][] initTableModel() {
    ConfigurationService confService = PropertiesEditorActivator.getConfigurationService();
    java.util.List<String> properties = confService.getAllPropertyNames();
    Object[][] data = new Object[properties.size()][];
    int i = 0;

    for (String property : properties) {
      data[i++] = new Object[] {property, confService.getProperty(property)};
    }

    return data;
  }
Exemplo n.º 22
0
  @Override
  protected void paintComponent(Graphics g) {
    java.util.List<Network> networks = getNetworkParts();
    positions = new int[networks.size()];
    Graphics2D g2 = (Graphics2D) g;

    g2.setFont(SMALL_BOLD_FONT);

    g2.setPaint(addressGradientPaint);
    g2.fill(g2.getClipBounds());
    // g2.drawImage(addressGradient, 0, 0, getWidth(), 26, null);

    int x = 14;

    for (int i = 0; i < networks.size(); i++) {
      Network part = networks.get(i);
      if (i == armed) {
        g2.setColor(TEXT_ARMED_COLOR);
      } else {
        g2.setColor(TEXT_NORMAL_COLOR);
      }
      String displayName = part.getDisplayName();
      SwingUtils.drawShadowText(g2, displayName, x, 16);

      int width = (int) g2.getFontMetrics().stringWidth(displayName);
      x += width + 5;
      positions[i] = x + 10;
      g2.drawImage(addressArrow, x, 0, null);
      x += 15;
    }

    String version = Application.getInstance().getVersion();
    int versionX = getWidth() - g2.getFontMetrics().stringWidth(version) - 10;
    SwingUtils.drawShadowText(g2, version, versionX, 16);

    if (renderException != null) {
      g2.drawImage(addressExclamation, versionX - 30, 0, null);
    }
  }
 public void start() {
   int i = 0;
   while (true) {
     lbl_rollNo.setFont(fonts.get(i));
     i = (i + 1) % fonts.size();
     // Code to sleep for 3 seconds
     try {
       Thread.currentThread().sleep(3000);
     } catch (InterruptedException iex) {
       iex.printStackTrace();
     }
   }
 }
Exemplo n.º 24
0
 public void jButton9_actionPerformed(ActionEvent e) {
   java.util.List OutList = new LinkedList();
   if (rtc != null) {
     OutList = rtc.GetTerminalOnLineStatus(TerminalInfoList);
   } else {
     System.out.println("no object,create it first");
   }
   if (OutList != null) {
     for (int i = 0; i < OutList.size(); i++) {
       TerminalOnLineStatus to = (TerminalOnLineStatus) OutList.get(i);
       memo1.append(to.TerminalAddress + " OnLineStatus is " + to.OnLineStatus + "\r\n");
     }
   }
 }
Exemplo n.º 25
0
 void drawScribbles(Graphics g) {
   if ((scribbles == null) || (scribbles.size() == 0)) {
     return;
   }
   DrawObject L = (DrawObject) scribbles.get(0);
   int scribbleCounter = L.scribbleNum;
   g.setColor(scribbleColor);
   ((Graphics2D) g).setStroke(new BasicStroke(2f));
   int prevX = L.scribbleX;
   int prevY = L.scribbleY;
   for (int i = 1; i < scribbles.size(); i++) {
     L = (DrawObject) scribbles.get(i);
     if (L.scribbleNum == scribbleCounter) {
       // Keep drawing.
       g.drawLine(prevX, prevY, L.scribbleX, L.scribbleY);
       prevX = L.scribbleX;
       prevY = L.scribbleY;
     } else {
       scribbleCounter = L.scribbleNum;
       prevX = L.scribbleX;
       prevY = L.scribbleY;
     }
   }
 }
Exemplo n.º 26
0
  public static JTable createErrorTable(PredictionCenter center) {
    JTable errorTable = null;
    DefaultTableModel errorTableModel = null;
    StatisticalPackageRunner runner = DBSeerGUI.runner;

    Object[] maeList = (Object[]) runner.getVariableCell("meanAbsError");
    Object[] mreList = (Object[]) runner.getVariableCell("meanRelError");
    Object[] headers = (Object[]) runner.getVariableCell("errorHeader");

    if (maeList.length > 0 || mreList.length > 0) {
      errorTableModel =
          new DefaultTableModel() {
            @Override
            public boolean isCellEditable(int row, int column) {
              return false;
            }
          };
      // errorTable = new JTable();
      errorTableModel.addColumn(null, new String[] {"", "MAE", "MRE"}); // first empty column

      final java.util.List<String> transactionNames =
          center.getTrainConfig().getDataset(0).getTransactionTypeNames();
      for (int i = 0; i < maeList.length; ++i) {
        Object maeObj = maeList[i];
        Object mreObj = mreList[i];

        double[] mae = (double[]) maeObj;
        double[] mre = (double[]) mreObj;

        String header = (String) headers[i];
        for (int j = 0; j < transactionNames.size(); ++j) {
          if (header.contains("Type " + (j + 1))) {
            headers[i] = header.replace("Type " + (j + 1), transactionNames.get(j));
            break;
          }
        }

        errorTableModel.addColumn(
            null,
            new Object[] {
              headers[i], String.format("%.3f", mae[0]), String.format("%.3f", mre[0])
            });
      }
      errorTable = new JTable(errorTableModel);
    }

    return errorTable;
  }
 public synchronized void actionPerformed(ActionEvent e) {
   java.util.List<JComponent> componentsToRemove = null;
   java.util.List<Part> partsToRemove = null;
   for (JComponent component : animationStateMap.keySet()) {
     component.repaint();
     if (partsToRemove != null) {
       partsToRemove.clear();
     }
     Map<Part, AnimationState> map = animationStateMap.get(component);
     if (!component.isShowing() || map == null || map.size() == 0) {
       if (componentsToRemove == null) {
         componentsToRemove = new ArrayList<JComponent>();
       }
       componentsToRemove.add(component);
       continue;
     }
     for (Part part : map.keySet()) {
       if (map.get(part).isDone()) {
         if (partsToRemove == null) {
           partsToRemove = new ArrayList<Part>();
         }
         partsToRemove.add(part);
       }
     }
     if (partsToRemove != null) {
       if (partsToRemove.size() == map.size()) {
         // animation is done for the component
         if (componentsToRemove == null) {
           componentsToRemove = new ArrayList<JComponent>();
         }
         componentsToRemove.add(component);
       } else {
         for (Part part : partsToRemove) {
           map.remove(part);
         }
       }
     }
   }
   if (componentsToRemove != null) {
     for (JComponent component : componentsToRemove) {
       animationStateMap.remove(component);
     }
   }
   if (animationStateMap.size() == 0) {
     timer.stop();
   }
 }
Exemplo n.º 28
0
  private static JRadioButton[] buildLangButtons() {
    java.util.List<JRadioButton> btns = new java.util.ArrayList<JRadioButton>();

    for (Language lng : LANGS) {
      JRadioButton btn = new JRadioButton(lng.toString());
      btn.setText(lng.toString());
      btns.add(btn);
    }

    final ButtonGroup group = new ButtonGroup();
    for (final JRadioButton jrb : btns) {
      group.add(jrb);
    }

    JRadioButton[] res = new JRadioButton[btns.size()];
    return btns.toArray(res);
  }
Exemplo n.º 29
0
  private void mAddNodeBtn_actionPerformed(ActionEvent e) {
    String host_name = mHostnameField.getText().trim();
    String element_name = "Node(" + host_name + ")";
    java.util.List elts = mBroker.getElements(mContext);
    java.util.List matches = ConfigUtilities.getElementsWithDefinition(elts, element_name);

    if (!host_name.equals("") && matches.size() == 0) {
      // Create a cluster_node element for the node
      ConfigElementFactory factory =
          new ConfigElementFactory(mBroker.getRepository().getAllLatest());
      ConfigElement element = factory.create(element_name, CLUSTER_NODE_TYPE);
      mBroker.add(mContext, element);
      element.setProperty("host_name", 0, host_name);
      element.setProperty("listen_port", 0, "7000");
    }
    mHostnameField.setText("");
  }
  /**
   * Creates a single Style from the passed in styles. The passed in List is reverse sorted, that is
   * the most recently added style found to match will be first.
   */
  private SynthStyle mergeStyles(java.util.List styles) {
    int size = styles.size();

    if (size == 0) {
      return null;
    } else if (size == 1) {
      return (SynthStyle) ((DefaultSynthStyle) styles.get(0)).clone();
    }
    // NOTE: merging is done backwards as DefaultSynthStyleFactory reverses
    // order, that is, the most specific style is first.
    DefaultSynthStyle style = (DefaultSynthStyle) styles.get(size - 1);

    style = (DefaultSynthStyle) style.clone();
    for (int counter = size - 2; counter >= 0; counter--) {
      style = ((DefaultSynthStyle) styles.get(counter)).addTo(style);
    }
    return style;
  }