/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
 /** 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;
 }
Exemple #3
0
  /**
   * Creates a new, empty SessionDescription. The session is set as follows:
   *
   * <p>v=0
   *
   * <p>o=this.createOrigin ("user", InetAddress.getLocalHost().toString());
   *
   * <p>s=-
   *
   * <p>t=0 0
   *
   * @throws SdpException SdpException, - if there is a problem constructing the SessionDescription.
   * @return a new, empty SessionDescription.
   */
  public SessionDescription createSessionDescription() throws SdpException {
    SessionDescriptionImpl sessionDescriptionImpl = new SessionDescriptionImpl();

    ProtoVersionField ProtoVersionField = new ProtoVersionField();
    ProtoVersionField.setVersion(0);
    sessionDescriptionImpl.setVersion(ProtoVersionField);

    OriginField originImpl = null;
    try {
      originImpl =
          (OriginField) this.createOrigin("user", InetAddress.getLocalHost().getHostAddress());
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
    sessionDescriptionImpl.setOrigin(originImpl);

    SessionNameField sessionNameImpl = new SessionNameField();
    sessionNameImpl.setValue("-");
    sessionDescriptionImpl.setSessionName(sessionNameImpl);

    TimeDescriptionImpl timeDescriptionImpl = new TimeDescriptionImpl();
    TimeField timeImpl = new TimeField();
    timeImpl.setZero();
    timeDescriptionImpl.setTime(timeImpl);
    Vector times = new Vector();
    times.addElement(timeDescriptionImpl);
    sessionDescriptionImpl.setTimeDescriptions(times);

    sessionDescriptionsList.addElement(sessionDescriptionImpl);
    return sessionDescriptionImpl;
  }
 /**
  * Return the graph items for this graph.
  *
  * @return the graph items for this graph.
  */
 public GraphItem[] getGraphItems() {
   GraphItem gia[] = new GraphItem[graphItems.size()];
   for (int i = 0; i < graphItems.size(); i++) {
     gia[i] = (GraphItem) graphItems.elementAt(i);
   }
   return gia;
 }
Exemple #5
0
  public static void main(String[] args) throws SdpParseException, SdpException {
    String sdpFields =
        "v=0\r\n"
            + "o=4855 13760799956958020 13760799956958020 IN IP4 166.35.224.216\r\n"
            + "s=nortelnetworks\r\n"
            + "p=+1 972 684 1000\r\n"
            + "c=IN IP4 166.35.224.216\r\n"
            + "t=0 0\r\n"
            + "m=audio 50006 RTP/AVP 0 8 4 18\r\n"
            + "a=rtpmap:0 PCMU/8000\r\n"
            + "a=rtpmap:8 PCMA/8000\r\n"
            + "a=rtpmap:4 G723/8000\r\n"
            + "a=rtpmap:18 G729A/8000\r\n"
            + "a=ptime:30\r\n";
    SdpFactory sdpFactory = new SdpFactory();
    SessionDescription sessionDescription = sdpFactory.createSessionDescription(sdpFields);

    System.out.println("sessionDescription = " + sessionDescription);
    Vector mediaDescriptions = sessionDescription.getMediaDescriptions(true);
    for (int i = 0; i < mediaDescriptions.size(); i++) {
      MediaDescription m = (MediaDescription) mediaDescriptions.elementAt(i);
      System.out.println("m = " + m.toString());
      Media media = m.getMedia();
      Vector formats = media.getMediaFormats(false);
      System.out.println("formats = " + formats);
    }
  }
 /** Constructor */
 public SOAPMonitorFilter() {
   // By default, exclude NotificationService and
   // EventViewerService messages
   filter_exclude_list = new Vector();
   filter_exclude_list.addElement("NotificationService");
   filter_exclude_list.addElement("EventViewerService");
 }
 // -------------------------------------------
 public static String toSpaceSeparatedString(Vector v) {
   StringBuffer sb = new StringBuffer(30);
   for (int i = 0; i < v.size(); i++) {
     Object o = v.elementAt(i);
     sb.append(" " + o); // NOI18N
   }
   return new String(sb);
 }
  public Vector matrixRowToVector(int n) { // 矩阵化为列向量组
    int i;
    Vector vector = new Vector();

    vector.setN(getLine());
    for (i = 0; i < getLine(); i++) vector.setElement(i, this.getElement(i, n));
    return vector;
  }
Exemple #9
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);
 }
 /** Find the row in the table for a given message id */
 public int findRow(SOAPMonitorData soap) {
   int row = -1;
   if (filter_data != null) {
     row = filter_data.indexOf(soap);
   } else {
     row = data.indexOf(soap);
   }
   return row;
 }
 /** Get the data for a row */
 public SOAPMonitorData getData(int row) {
   SOAPMonitorData soap = null;
   if (filter_data == null) {
     soap = (SOAPMonitorData) data.elementAt(row);
   } else {
     soap = (SOAPMonitorData) filter_data.elementAt(row);
   }
   return soap;
 }
 public static Vector testInstancesWithBindingAndNoCalendarPrinting() {
   Vector tests = new Vector(calendarStrings.length);
   for (int i = 0; i < calendarStrings.length; i++) {
     tests.add(
         new CalendarToTSTZWithBindingTest(
             i + (calendarStrings.length + 1), calendarStrings[i], false));
   }
   return tests;
 }
 /** 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;
 }
Exemple #14
0
 /**
  * Replaces the {@link DataElement} at the specified index. After the element has been
  * successfully replaced all {@link DataListener DataListeners} will be informed.
  *
  * @param index Index of the element which will be replaced by <tt>element</tt>.
  * @param element The new <tt>DataElement</tt>.
  * @throws IllegalArgumentException if <tt>element</tt> is not of the correct type which will be
  *     checked by the method {@link #isValid}.
  */
 public void replaceElementAt(int index, DataElement element) {
   if (isValid(element)) {
     DataElement oldElement = (DataElement) _container.elementAt(index);
     oldElement.setContainer(null);
     _container.setElementAt(element, index);
     element.setContainer(this);
     notifyListeners(DataEvent.createReplaceEvent(this, index, oldElement));
   } else {
     throwException(REPLACE, element);
   }
 }
 /** Remove a message from the table */
 public void removeRow(int row) {
   SOAPMonitorData soap = null;
   if (filter_data == null) {
     soap = (SOAPMonitorData) data.elementAt(row);
     data.remove(soap);
   } else {
     soap = (SOAPMonitorData) filter_data.elementAt(row);
     filter_data.remove(soap);
     data.remove(soap);
   }
   fireTableRowsDeleted(row, row);
 }
Exemple #16
0
 private void notifyListeners(DataEvent event) {
   for (int i = 0, n = _listeners.size(); i < n; i++) {
     ((DataListener) _listeners.elementAt(i)).dataChanged(event);
   }
   // Notifies also parent container
   if (this instanceof DataElement) {
     DataContainer container = ((DataElement) this).getContainer();
     if (container != null) {
       container.notifyListeners(event);
     }
   }
 }
 /* Non-recursive (NR) version of Node.getElementsByTagName(...)
  */
 static Element[] getElementsByTagNameNR(Element e, String tagName) {
   Vector<Element> elements = new Vector<Element>();
   Node child = e.getFirstChild();
   while (child != null) {
     if (child instanceof Element && child.getNodeName().equals(tagName)) {
       elements.add((Element) child);
     }
     child = child.getNextSibling();
   }
   Element[] result = new Element[elements.size()];
   elements.copyInto(result);
   return result;
 }
 /** 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();
   }
 }
 /** 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);
   }
 }
 public void test() {
   // read data back from database literally in order to check contents of database rather than the
   // driver's TIMESTAMPTZ
   String sql =
       "select TEST_ID, to_char(TSTZ_DATA,'MM/DD/YYYY hh24:mi:ss TZR') as TSTZ_DATA FROM "
           + commonDescriptor().getTableName()
           + " where TEST_ID = "
           + getTestId();
   Vector result = getSession().executeSQL(sql);
   if (result != null & !result.isEmpty()) {
     this.result = (DatabaseRecord) result.firstElement();
   }
 }
Exemple #21
0
 /**
  * Add the graph item to the graph.
  *
  * @param graphItem Item to be added to the graph.
  */
 public void addGraphItem(GraphItem graphItem) {
   if (graphItem != null) {
     graphItems.addElement(graphItem);
     graphItem.addGraphItemListener(graphItemListener);
   }
   repaint();
 }
  // @karen not completed
  public Vector getRecord_Sorted(String sSQL, int type) {
    Vector v = new Vector();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    try {

      // int SortType = getSortType();
      sSQL = sSQL + " ORDER BY ";

      if (type == 1) {
        if (SortType == 1) sSQL = sSQL + "CompanyName";
        else if (SortType == 2) sSQL = sSQL + "CompanyDesc";

        if (Toggle[SortType - 1] == 1) sSQL = sSQL + " DESC";
      } else {
        if (SortType_org == 1) sSQL = sSQL + "OrganizationName";
        else if (SortType_org == 2) sSQL = sSQL + "OrganizationCode";
        else if (SortType_org == 3) sSQL = sSQL + "NameSequence";

        if (Toggle_org[SortType_org - 1] == 1) sSQL = sSQL + " DESC";
      }

      con = ConnectionBean.getConnection();
      st = con.createStatement();
      rs = st.executeQuery(sSQL);

      while (rs.next()) {
        votblConsultingCompany vo = new votblConsultingCompany();
        vo.setCompanyDesc(rs.getString("CompanyDesc"));
        vo.setCompanyName(rs.getString("CompanyName"));
        vo.setCompanyID(rs.getInt("CompanyID"));
        v.add(vo);
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getRecord_Sorted - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    return v;
  }
Exemple #23
0
  protected static double[] parseGapScalingFactorMultipliersString(
      String gapScalingFactorMultipliersString) {
    StringTokenizer tok =
        new StringTokenizer(gapScalingFactorMultipliersString, GSFM_PARAMETER_DELIMITER);
    Vector<Double> vec = new Vector<Double>();
    while (tok.hasMoreTokens()) {
      Double gsfm = new Double(Double.parseDouble(tok.nextToken()));
      vec.add(gsfm);
    }

    double[] result = new double[vec.size()];
    for (int i = 0; i < result.length; i++) {
      result[i] = ((Double) (vec.get(i))).doubleValue();
    }

    return (result);
  }
 public CachedProbe(AffyProbe ap, Vector<AffyExperiment> expts) {
   probe = ap;
   min = max = 0.0;
   color = Color.lightGray;
   stroke = new BasicStroke((float) 2.0);
   values = new Vector<Double>();
   for (AffyExperiment e : expts) {
     AffyMeasurement am = e.getMeasurement(probe);
     if (am != null) {
       values.add(am.getValue());
       min = Math.min(am.getValue(), min);
       max = Math.max(am.getValue(), max);
     } else {
       values.add(null);
     }
   }
 }
Exemple #25
0
 /**
  * Adds a {@link DataElement}. After the element has been successfully added all {@link
  * DataListener DataListeners} will be informed.
  *
  * @param element DataElement to be added.
  * @throws IllegalArgumentException if <tt>element</tt> is not of the correct type which will be
  *     checked by the method {@link #isValid}.
  */
 public void addElement(DataElement element) {
   if (isValid(element)) {
     _container.addElement(element);
     element.setContainer(this);
     notifyListeners(DataEvent.createAddEvent(this));
   } else {
     throwException(ADD, element);
   }
 }
Exemple #26
0
 /**
  * Inserts a {@link DataElement} at the specified index. After the element has been successfully
  * inserted all {@link DataListener DataListeners} will be informed.
  *
  * @param index Index at which <tt>element</tt> will be inserted. All elements with an index &gt;=
  *     <tt>index</tt> will be shifted.
  * @param element DataElement to be added.
  * @throws IllegalArgumentException if <tt>element</tt> is not of the correct type which will be
  *     checked by the method {@link #isValid}.
  */
 public void insertElementAt(int index, DataElement element) {
   if (isValid(element)) {
     _container.insertElementAt(element, index);
     element.setContainer(this);
     notifyListeners(DataEvent.createInsertEvent(this, index));
   } else {
     throwException(INSERT, element);
   }
 }
 /** Constructor */
 public SOAPMonitorTableModel() {
   data = new Vector();
   // Add "most recent" entry to top of table
   SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
   data.addElement(soap);
   filter_include = null;
   filter_exclude = null;
   filter_active = false;
   filter_complete = false;
   filter_data = null;
   // By default, exclude NotificationService and
   // EventViewerService messages
   filter_exclude = new Vector();
   filter_exclude.addElement("NotificationService");
   filter_exclude.addElement("EventViewerService");
   filter_data = new Vector();
   filter_data.addElement(soap);
 }
  /**
   * This Method returns the 2D Array which is the list of the Items for the selected WorkOrder of
   * the Customer.
   *
   * @param workorderId - WorkOrder Id Foreign Key of WRK_ORDR_DETS table
   * @return Object[][] - 2D Array which is List of the Items for the WorkOrder
   */
  public Object[][] getWorkOrderItems(long workorderId) throws RemoteException {

    WrkOrdrDets wrkordrdts_obj = new WrkOrdrDets(conn);

    RHCCBlgKeys blgkeys_obj = new RHCCBlgKeys(conn);

    Vector workorderdetList = wrkordrdts_obj.getProductList(workorderId);

    // Hashtable BSysList = (Hashtable) USFEnv.getBillSystems();
    BlgSys blgsys = new BlgSys();

    Hashtable BSysList = (Hashtable) blgsys.searchBlgSys();

    Enumeration BSys = BSysList.keys();

    // The 2-Dimensional array to hold the Items Billing System wise.
    Object[][] prodList = new Object[BSysList.size()][workorderdetList.size() + 1];

    // The Number of Billing Systems are assumed to be equal to the
    // Static Load Billing Systems Hashtable size. The Billing Systems will
    // be in order starting from 1 and incrementing by one.
    for (int i = 0; i < BSysList.size(); i++) {
      // Set the 2D array to store the Billing System as the first element
      // of each row.
      prodList[i][0] = String.valueOf(i + 1);
    }

    // Loop throught the WorkOrder Items List and place them in the appropriate
    // positions in the 2D array.
    for (int j = 0; j < workorderdetList.size(); j++) {
      // Determine the Billing System of the Product
      Vector tmpVector = new Vector();

      WrkOrdrDets workorderObj = (WrkOrdrDets) workorderdetList.elementAt(j);

      RHCCBlgKeys bkObj =
          blgkeys_obj.searchRHCCBlgKeys(((WrkOrdrDets) workorderdetList.elementAt(j)).getRBKID());
      int bsid = (new Long(bkObj.getBsId())).intValue();

      tmpVector.addElement(bkObj);
      tmpVector.addElement(workorderObj);

      // Based on the Billing System Id retreived place the Product Object
      // in the 2D array.
      int k = 1;
      while (prodList[bsid - 1][k] != null) {
        k = k + 1;
      }
      prodList[bsid - 1][k] = tmpVector;
    }

    // Return the 2D array
    return prodList;
  }
Exemple #29
0
  /**
   * Called by the paint method to draw the graph and its graph items.
   *
   * @param g the graphics context.
   */
  public void paintComponent(Graphics g) {

    Dimension dim = getSize();
    Insets insets = getInsets();
    dataArea =
        new Rectangle(
            insets.left,
            insets.top,
            dim.width - insets.left - insets.right - 1,
            dim.height - insets.top - insets.bottom - 1);
    // background
    if (isOpaque()) {
      g.setColor(getBackground());
      g.fillRect(0, 0, dim.width, dim.height);
    }
    g.setColor(getForeground());
    // get axis tickmarks
    double xticks[] = xAxis.getTicks();
    double yticks[] = yAxis.getTicks();
    int yb = dataArea.y + dataArea.height;
    // draw grid
    if (showGrid) {
      g.setColor(gridColor != null ? gridColor : getBackground().darker());
      // vertical x grid lines
      for (int i = 0; i < xticks.length; i += 2) {
        int x = dataArea.x + (int) Math.round(xticks[i]);
        g.drawLine(x, dataArea.y, x, dataArea.y + dataArea.height);
      }
      // horizontal y grid lines
      for (int i = 0; i < yticks.length; i += 2) {
        int y = yb - (int) Math.round(yticks[i]);
        g.drawLine(dataArea.x, y, dataArea.x + dataArea.width, y);
      }
    }
    for (int i = 0; i < graphItems.size(); i++) {
      ((GraphItem) graphItems.elementAt(i)).draw(this, g, dataArea, xAxis, yAxis);
    }
    if (sPt != null && ePt != null) {
      g.setColor(getForeground());
      g.drawRect(
          Math.min(sPt.x, ePt.x), Math.min(sPt.y, ePt.y),
          Math.abs(ePt.x - sPt.x), Math.abs(ePt.y - sPt.y));
    }
  }
 /** 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);
       }
     }
   }
 }