Ejemplo n.º 1
0
  /**
   * Constructs a <code>VariabilityRecordTable</code> with a list of variability records.
   *
   * @param record_list the list of variability records.
   * @param desktop the parent desktop.
   */
  public VariabilityRecordTable(Vector record_list, net.aerith.misao.gui.Desktop desktop) {
    this.record_list = record_list;
    this.desktop = desktop;

    index = new ArrayIndex(record_list.size());

    model = new DefaultTableModel(column_names, 0);
    Object[] objects = new Object[column_names.length];
    objects[0] = new Boolean(true);
    for (int i = 1; i < column_names.length; i++) objects[i] = "";
    for (int i = 0; i < record_list.size(); i++) model.addRow(objects);
    setModel(model);

    column_model = (DefaultTableColumnModel) getColumnModel();
    for (int i = 1; i < column_names.length; i++)
      column_model
          .getColumn(i)
          .setCellRenderer(
              new StringRenderer(column_names[i], LabelTableCellRenderer.MODE_MULTIPLE_SELECTION));

    initializeCheckColumn();

    setTableHeader(new TableHeader(column_model));

    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    initializeColumnWidth();

    pane = this;

    initPopupMenu();
  }
 /** Get row count (part of table model interface) */
 public int getRowCount() {
   int count = data.size();
   if (filter_data != null) {
     count = filter_data.size();
   }
   return count;
 }
 /** Sets the pins list's contents with the given vector of PartPinInfo objects. */
 public void setContents(Vector newPins) {
   partPins = new PartPinInfo[newPins.size()];
   valuesStr = new String[newPins.size()];
   newPins.toArray(partPins);
   for (int i = 0; i < partPins.length; i++)
     valuesStr[i] = Format.translateValueToString(partPins[i].value, dataFormat);
   pinsTable.clearSelection();
   pinsTable.revalidate();
   repaint();
 }
 /** Add data to the table as a new row */
 public void addData(SOAPMonitorData soap) {
   int row = data.size();
   data.addElement(soap);
   if (filter_data != null) {
     if (filterMatch(soap)) {
       row = filter_data.size();
       filter_data.addElement(soap);
       fireTableRowsInserted(row, row);
     }
   } else {
     fireTableRowsInserted(row, row);
   }
 }
Ejemplo n.º 5
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {

      if (JTable1.getSelectedRowCount() != 1) {

        Utilities.errorMessage(resourceBundle.getString("Please select a view to edit"));
        return;
      }

      views = new ViewsWizard(ViewConfig.this, applet);
      views.setSecurityModel(model);
      Point p = JLabel1.getLocationOnScreen();
      views.setLocation(p);
      views.init();

      views.setState(false);
      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          views.setValues((AuthViewWithOperations) viewvec.elementAt(i));
        }
      }

      disableButtons();
      views.setVisible(true);
    }
Ejemplo n.º 6
0
 public void setValueAt(Object value, int row, int col) {
   if (rowData.size() > row && row >= 0) {
     Object[] data = (Object[]) rowData.get(row);
     data[col] = value;
   }
   fireTableCellUpdated(row, col);
 }
Ejemplo n.º 7
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {
      if (JTable1.getSelectedRowCount() != 1) {
        Utilities.errorMessage(resourceBundle.getString("Please select a view to delete"));
        return;
      }

      if (JOptionPane.showConfirmDialog(
              null,
              resourceBundle.getString("Are you sure you want to delete the selected view "),
              resourceBundle.getString("Warning!"),
              JOptionPane.YES_NO_OPTION,
              JOptionPane.WARNING_MESSAGE,
              null)
          == JOptionPane.NO_OPTION) return;

      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          AuthViewWithOperations avop = (AuthViewWithOperations) viewvec.elementAt(i);

          model.delViewOp(
              avop.getAuthorizedViewName(), avop.getViewProperties(), avop.getOperations());
        }
      }

      disableButtons();
    }
Ejemplo n.º 8
0
 // add new Chef
 public void add(Chef chef) {
   _entries.addElement(chef);
   int index = _entries.size() - 1;
   _chefsByName.put(chef.getName(), new Integer(index));
   // tell TableView to update
   fireTableRowsInserted(index, index);
   fireTableRowsUpdated(index, index);
 }
Ejemplo n.º 9
0
  /** Sets the call stack with the given vector of method names. */
  public void setContents(Vector newMethodNames) {
    methodNames = (Vector) newMethodNames.clone();
    callStackTable.revalidate();

    Rectangle r = callStackTable.getCellRect(newMethodNames.size() - 1, 0, true);
    callStackTable.scrollRectToVisible(r);
    repaint();
  }
Ejemplo n.º 10
0
 /**
  * moveData
  *
  * @param curRow Old row for the data
  * @param newRow New row for the data
  */
 private void moveData(int curRow, int newRow) {
   int lastRow = rowData.size() - 1;
   if (curRow >= 0 && curRow <= lastRow && newRow >= 0 && newRow <= lastRow) {
     Object[] curData = (Object[]) rowData.elementAt(curRow);
     rowData.removeElementAt(curRow);
     rowData.insertElementAt(curData, newRow);
     fireTableDataChanged();
   }
 }
 /** Update a message */
 public void updateData(SOAPMonitorData soap) {
   int row;
   if (filter_data == null) {
     // No filter, so just fire table updated
     row = data.indexOf(soap);
     if (row != -1) {
       fireTableRowsUpdated(row, row);
     }
   } else {
     // Check if the row was being displayed
     row = filter_data.indexOf(soap);
     if (row == -1) {
       // Row was not displayed, so check for if it
       // now needs to be displayed
       if (filterMatch(soap)) {
         int index = -1;
         row = data.indexOf(soap) + 1;
         while ((row < data.size()) && (index == -1)) {
           index = filter_data.indexOf(data.elementAt(row));
           if (index != -1) {
             // Insert at this location
             filter_data.add(index, soap);
           }
           row++;
         }
         if (index == -1) {
           // Insert at end
           index = filter_data.size();
           filter_data.addElement(soap);
         }
         fireTableRowsInserted(index, index);
       }
     } else {
       // Row was displayed, so check if it needs to
       // be updated or removed
       if (filterMatch(soap)) {
         fireTableRowsUpdated(row, row);
       } else {
         filter_data.remove(soap);
         fireTableRowsDeleted(row, row);
       }
     }
   }
 }
 /** Find the data for a given id */
 public SOAPMonitorData findData(Long id) {
   SOAPMonitorData soap = null;
   for (int row = data.size(); (row > 0) && (soap == null); row--) {
     soap = (SOAPMonitorData) data.elementAt(row - 1);
     if (soap.getId().longValue() != id.longValue()) {
       soap = null;
     }
   }
   return soap;
 }
Ejemplo n.º 13
0
 public Object getValueAt(int rowIndex, int columnIndex) {
   if (timeList != null) {
     if (rowIndex < timeList.size()) {
       JCTimeObject ctObj = (JCTimeObject) timeList.get(rowIndex);
       if (columnIndex == 0) {
         return ctObj.toString();
       }
     }
   }
   return null;
 }
Ejemplo n.º 14
0
 /**
  * Establishes combo box editor for 'from onramp' column.
  *
  * @param clmn
  */
 private void setUpToOnrampColumn() {
   JComboBox combo = new JComboBox();
   Vector<AbstractNetworkElement> nes =
       ((AbstractControllerComplex) controller).getMyMonitor().getSuccessors();
   for (int i = 0; i < nes.size(); i++)
     if ((nes.get(i).getType() & TypesHWC.MASK_LINK) > 0) combo.addItem(nes.get(i));
   TableColumn clmn = zonetab.getColumnModel().getColumn(3);
   clmn.setCellEditor(new DefaultCellEditor(combo));
   clmn.setCellRenderer(new DefaultTableCellRenderer());
   return;
 }
Ejemplo n.º 15
0
 private void addNewRow() {
   Object[] row_data = new Object[2];
   if (rowData.size() < 1) { // add a new html filter
     row_data[0] = "text/html";
   } else {
     row_data[0] = "Enter MIME type";
   }
   row_data[1] = "Replace with " + mimeTypeEditorBuilder.getValueClassName() + " class name";
   logger.debug3("Adding new row");
   rowData.add(row_data);
   fireTableDataChanged();
 }
Ejemplo n.º 16
0
 /** Reaction to Add/Delete buttons. */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmdAdd.equals(cmd)) {
     Zone z = ((ControllerSWARM) controller).new Zone();
     Vector<AbstractNetworkElement> ml =
         ((AbstractControllerComplex) controller).getMyMonitor().getPredecessors();
     Vector<AbstractNetworkElement> cl =
         ((AbstractControllerComplex) controller).getMyMonitor().getSuccessors();
     if (ml.size() > 0) z.bottleneck = (AbstractLinkHWC) ml.firstElement();
     if (cl.size() > 0) {
       z.setFromOnramp((AbstractLinkHWC) cl.firstElement());
       z.setToOnramp((AbstractLinkHWC) cl.firstElement());
     }
     z.initialize();
     zones.add(z);
     zoneTM.fireTableStructureChanged();
     setUpBottleneckColumn();
     setUpFromOnrampColumn();
     setUpToOnrampColumn();
   }
   if (cmdDelete.equals(cmd)) {
     try {
       int[] selected = zonetab.getSelectedRows();
       if ((selected != null) && (selected.length > 0))
         for (int i = 0; i < selected.length; i++) {
           int idx = selected[i] - i;
           if ((idx >= 0) && (idx < zones.size())) {
             zones.remove(idx);
             zoneTM.fireTableStructureChanged();
             setUpBottleneckColumn();
             setUpFromOnrampColumn();
             setUpToOnrampColumn();
           }
         }
     } catch (Exception ex) {
     }
   }
   return;
 }
 /** Remove all messages from the table (but leave "most recent") */
 public void clearAll() {
   int last_row = data.size() - 1;
   if (last_row > 0) {
     data.removeAllElements();
     SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
     data.addElement(soap);
     if (filter_data != null) {
       filter_data.removeAllElements();
       filter_data.addElement(soap);
     }
     fireTableDataChanged();
   }
 }
Ejemplo n.º 18
0
  /**
   * Gets the sortable array of the specified column.
   *
   * @param header_value the header value of the column to sort.
   */
  protected SortableArray getSortableArray(String header_value) {
    if (header_value.length() == 0) return null;

    SortableArray array = null;
    if (header_value.equals("R.A.") || header_value.equals("Decl.") || header_value.equals("ID"))
      array = new StringArray(record_list.size());
    else array = new Array(record_list.size());

    for (int i = 0; i < record_list.size(); i++) {
      String value = getCellString(header_value, i);

      if (header_value.equals("R.A.")
          || header_value.equals("Decl.")
          || header_value.equals("ID")) {
        ((StringArray) array).set(i, value);
      } else if (header_value.equals("Max Mag") || header_value.equals("Min Mag")) {
        double mag_value = 0.0;
        if ('0' <= value.charAt(0) && value.charAt(0) <= '9'
            || value.charAt(0) == '-'
            || value.charAt(0) == '+') {
          mag_value = Format.doubleValueOf(value);
        } else {
          mag_value = 100 + Format.doubleValueOf(value.substring(1));
        }
        ((Array) array).set(i, mag_value);
      } else if (header_value.equals("First Date") || header_value.equals("Last Date")) {
        double jd = 0.0;
        if (value.length() > 0) jd = JulianDay.create(value).getJD();
        ((Array) array).set(i, jd);
      } else {
        ((Array) array).set(i, Double.parseDouble(value));
      }
    }

    return array;
  }
Ejemplo n.º 19
0
 public void actionPerformed(ActionEvent e) {
   List<Resource> loadedDocuments;
   try {
     // get all the documents loaded in the system
     loadedDocuments = Gate.getCreoleRegister().getAllInstances("gate.Document");
   } catch (GateException ge) {
     // gate.Document is not registered in creole.xml....what is!?
     throw new GateRuntimeException(
         "gate.Document is not registered in the creole register!\n"
             + "Something must be terribly wrong...take a vacation!");
   }
   Vector<String> docNames = new Vector<String>();
   for (Resource loadedDocument : new ArrayList<Resource>(loadedDocuments)) {
     if (corpus.contains(loadedDocument)) {
       loadedDocuments.remove(loadedDocument);
     } else {
       docNames.add(loadedDocument.getName());
     }
   }
   JList docList = new JList(docNames);
   docList.getSelectionModel().setSelectionInterval(0, docNames.size() - 1);
   docList.setCellRenderer(renderer);
   final JOptionPane optionPane =
       new JOptionPane(
           new JScrollPane(docList), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
   final JDialog dialog =
       optionPane.createDialog(CorpusEditor.this, "Add document(s) to this corpus");
   docList.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() == 2) {
             optionPane.setValue(JOptionPane.OK_OPTION);
             dialog.dispose();
           }
         }
       });
   dialog.setVisible(true);
   if (optionPane.getValue().equals(JOptionPane.OK_OPTION)) {
     int[] selectedIndices = docList.getSelectedIndices();
     for (int selectedIndice : selectedIndices) {
       corpus.add((Document) loadedDocuments.get(selectedIndice));
     }
   }
   changeMessage();
 }
Ejemplo n.º 20
0
  public void setData() {
    /*
       if(model.getAllViews() == null)
    	{
            	return;
    }
    */
    for (int i = JTable1.getRowCount() - 1; i >= 0; i--) {
      ViewTableModel.removeRow(i);
    }

    Vector views = model.getAllViews();
    for (int j = 0; j < views.size(); j++) {
      AuthViewWithOperations view = (AuthViewWithOperations) views.elementAt(j);
      String viewNa = view.getAuthorizedViewName();
      ViewTableModel.addRow(new Object[] {viewNa});
    }
  }
Ejemplo n.º 21
0
 public void handle(Throwable exception) {
   try {
     if (exception instanceof NullPointerException) {
       synchronized (lock) {
         JTable table = ui.getList();
         DefaultTableModel model = (DefaultTableModel) table.getModel();
         Vector<?> data = model.getDataVector();
         for (int i = 0; i < data.size(); i++) {
           Object row = data.get(i);
           if (row == null) data.remove(i);
         }
       }
     }
     exception.printStackTrace();
   } catch (Throwable exception2) {
     exception.printStackTrace();
   }
 }
  public void addColumn(Object columnName, Vector columnData) {
    if (columnName == null) throw new IllegalArgumentException("addColumn() - null parameter");
    columnIdentifiers.addElement(columnName);
    int index = 0;
    Enumeration enumeration = dataVector.elements();
    while (enumeration.hasMoreElements()) {
      Object value;
      if ((columnData != null) && (index < columnData.size())) value = columnData.elementAt(index);
      else value = null;
      ((Vector) enumeration.nextElement()).addElement(value);
      index++;
    }

    //
    cellAtt.addColumn();

    fireTableStructureChanged();
  }
Ejemplo n.º 23
0
 public int getRowCount() {
   return rowData.size();
 }
Ejemplo n.º 24
0
 public synchronized int getRowCount() {
   return _entries.size();
 }
Ejemplo n.º 25
0
 public int getRowCount() {
   return rowData == null ? 0 : rowData.size();
 }
Ejemplo n.º 26
0
 public int getRowCount() {
   return m_props.size();
 }
Ejemplo n.º 27
0
 public void add(SkeletonProperty prop) {
   m_props.addElement(prop);
   fireTableRowsInserted(m_props.size() - 1, m_props.size());
   fireTableStructureChanged();
 }
 public AttributiveCellTableModel(Vector columnNames, int numRows) {
   setColumnIdentifiers(columnNames);
   dataVector = new Vector();
   setNumRows(numRows);
   cellAtt = new DefaultCellAttribute(numRows, columnNames.size());
 }
Ejemplo n.º 29
0
 /** Fills the panel with SWARM specific fields. */
 public void fillPanel() {
   // Zone initialization
   ControllerSWARM z = (ControllerSWARM) controller;
   Vector<Zone> cz = z.zones;
   for (int i = 0; i < cz.size(); i++) zones.add(cz.get(i).clone());
   // Parameter initialization
   density_sample_size = z.P.SWARM_DENSITY_SAMPLE_SIZE;
   epsilon = z.P.epsilon;
   forecast_lead_time = z.P.SWARM_FORECAST_LEAD_TIME;
   input_var_lane = z.P.input_var_lane;
   meas_var_lane = z.P.meas_var_lane;
   phi = z.P.swarm_phi;
   psi = z.P.swarm_psi;
   sat_den_multiplier = z.P.SWARM_SAT_DEN_NUMBER;
   sat_smoother = z.P.sat_smoother;
   slope_sample_size = z.P.SWARM_SLOPE_SAMPLE_SIZE;
   // Components
   JPanel comp = new JPanel(new FlowLayout());
   comp.setBorder(BorderFactory.createTitledBorder("Components"));
   cbsw1.setSelected(z.P.SWARM1);
   comp.add(cbsw1);
   comp.add(new JLabel("  "));
   cbsw2a.setSelected(z.P.SWARM2A);
   comp.add(cbsw2a);
   comp.add(new JLabel("  "));
   cbsw2b.setSelected(z.P.SWARM2B);
   comp.add(cbsw2b);
   comp.add(new JLabel("  "));
   cbdynbott.setEnabled(false);
   comp.add(cbdynbott);
   add(comp);
   // Zones
   JPanel zone = new JPanel(new GridBagLayout());
   GridBagConstraints c = new GridBagConstraints();
   zone.setBorder(BorderFactory.createTitledBorder("Zones"));
   zonetab.setPreferredScrollableViewportSize(new Dimension(400, 30));
   setUpBottleneckColumn();
   setUpFromOnrampColumn();
   setUpToOnrampColumn();
   c.fill = GridBagConstraints.HORIZONTAL;
   c.ipady = 45;
   c.weightx = 0.5;
   c.gridwidth = 3;
   c.gridx = 0;
   c.gridy = 0;
   zone.add(new JScrollPane(zonetab), c);
   c.ipady = 0;
   c.gridy = 1;
   c.gridwidth = 1;
   c.gridx = 0;
   zone.add(buttonAdd, c);
   c.gridx = 1;
   zone.add(buttonDelete, c);
   // configure buttons
   buttonAdd.setEnabled(true);
   buttonAdd.setActionCommand(cmdAdd);
   buttonAdd.addActionListener(this);
   buttonDelete.setEnabled(true);
   buttonDelete.setActionCommand(cmdDelete);
   buttonDelete.addActionListener(this);
   add(zone);
   // Parameters
   JPanel param = new JPanel(new GridLayout(1, 0));
   param.setBorder(BorderFactory.createTitledBorder("Parameters"));
   final JTable paramtab = new JTable(paramTM);
   paramtab.setPreferredScrollableViewportSize(new Dimension(500, 160));
   param.add(new JScrollPane(paramtab));
   add(param);
   return;
 }
Ejemplo n.º 30
0
 /**
  * removeRowData
  *
  * @param row int
  */
 public void removeRowData(int row) {
   if (rowData.size() > row && row >= 0) {
     rowData.remove(row);
   }
   fireTableDataChanged();
 }