public ArtifactView(DataProvider provider) {
   this(
       new Artifact(
           new DateTime(
               Calendar.getInstance().getTime(), DateFormat.getDateInstance(DateFormat.MEDIUM)),
           new DateTime(
               Calendar.getInstance().getTime(), DateFormat.getDateInstance(DateFormat.MEDIUM)),
           "",
           "",
           "",
           "",
           ""),
       provider);
 }
示例#2
0
 /**
  * Create a default filename given the current date selection. If custom dates are selected, use
  * those dates; otherwise, use year and week numbers.
  *
  * @return The default filename.
  */
 private String getDefaultFilename() {
   if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0)
     return "timesheet-"
         + dateFormat.format(fromDate.getDate()).replaceAll("/", "")
         + "-"
         + dateFormat.format(toDate.getDate()).replaceAll("/", "")
         + ".txt";
   return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt";
 }
  /** {@inheritDoc} */
  protected String paramString() {
    String curDate;
    if ((selectedComponents & DISPLAY_DATE) == DISPLAY_DATE) {
      curDate = DateFormat.getDateInstance(DateFormat.FULL, locale).format(getDate());
    } else if ((selectedComponents & DISPLAY_TIME) == DISPLAY_TIME) {
      curDate = DateFormat.getTimeInstance(DateFormat.FULL, locale).format(getDate());
    } else {
      curDate =
          DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale)
              .format(getDate());
    }

    return super.paramString() + ",selectedDate=" + curDate;
  }
  /**
   * Create an instance of JCalendar using the given calendar and locale. Display a calendar and/or
   * a time spinner as requested (to display both use DISPLAY_DATE | DISPLAY_TIME). Display today's
   * date if requested. Set the pattern used to display the time in the time spinner field (if there
   * is one). If null, use the default MEDIUM format for the given locale. Patterns are from
   * DateFormat and SimpleDateFormat.
   *
   * @param calendar The calendar to use.
   * @param locale The locale to use.
   * @param selectedComponents Use DISPLAY_DATE, DISPLAY_TIME or (DISPLAY_DATE | DISPLAY_TIME).
   * @param isTodayDisplayed True if today's date should be displayed at the bottom of the panel.
   * @param timePattern The pattern used to display the time in the time spinner field.
   * @see DateFormat
   * @see SimpleDateFormat
   */
  public JCalendar(
      Calendar calendar,
      Locale locale,
      int selectedComponents,
      boolean isTodayDisplayed,
      String timePattern) {
    this.selectedCalendar = (Calendar) calendar.clone();
    this.displayCalendar = (Calendar) selectedCalendar.clone();
    this.selectedComponents = selectedComponents;
    if ((selectedComponents & (DISPLAY_DATE | DISPLAY_TIME)) == 0) {
      throw new IllegalStateException(bundle.getString("IllegalStateException"));
    }

    this.locale = locale;
    this.isTodayDisplayed = isTodayDisplayed;

    if ((selectedComponents & DISPLAY_TIME) > 0) {
      if (timePattern == null) {
        DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
        this.timePattern = "HH:mm:ss";
        if (timeFormat instanceof SimpleDateFormat) {
          this.timePattern = ((SimpleDateFormat) timeFormat).toPattern();
        }
      } else {
        this.timePattern = timePattern;
      }
    }

    createCalendarComponents();
    setDate(new Date());
  }
示例#5
0
  ///////////////////////////////////
  // constructor
  //////////////////////////////////
  public SwingImportRangeData(
      final Layers theData, final String lastDirectory, final PropertiesPanel thePanel) {
    super(theData, lastDirectory, thePanel);

    // initialise the date to GMT, so that the date points aren't shifted
    _dateF.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
  }
示例#6
0
 synchronized void checkDTG() {
   try {
     _theDTG = _dateF.parse(_theDate.getText()).getTime();
   } catch (final ParseException e) {
     MWC.GUI.Dialogs.DialogFactory.showMessage(
         "Date Format Error", "Sorry, date incorrectly formatted (2001/1/21)");
   }
 }
示例#7
0
  /*==========================================================
   * public methods
   *==========================================================*/
  public Vector parse(Object entry) throws ParseException {
    String logEntry = (String) entry;
    // parsing the log Entry and return segments
    // Debug.println("LogDataModel: DefaultLogParser: parse() -" +logEntry);
    int x = logEntry.indexOf("[");
    if (x == -1) throw new ParseException(logEntry, 0);
    String temp = logEntry.substring(x + 1);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);

    String dateStr = temp.substring(0, x);
    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateStr+" "+temp);
    SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
    Date date = format.parse(dateStr);
    String dateColumn = DateFormat.getDateInstance().format(date);
    String timeColumn = DateFormat.getTimeInstance().format(date);

    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateColumn+" "+timeColumn);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String source = temp.substring(1, x);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String level = temp.substring(1, x);
    temp = temp.substring(x + 2);
    Vector row = new Vector();
    row.addElement(getSourceString(source));
    row.addElement(getLevelString(level));
    row.addElement(dateColumn);
    row.addElement(timeColumn);
    JLabel detail = new JLabel(temp);
    detail.setToolTipText(temp);
    row.addElement(detail);
    return row;
  }
示例#8
0
  protected final synchronized void refreshForm() {
    // set the location
    OriginLabel.setText(
        MWC.Utilities.TextFormatting.BriefFormatLocation.toString(ImportRangeDataPanel._theOrigin));

    // set the filename
    FilenameLabel.setText(super._theFilename);

    // special case - in constructor we may get called before the _dateF
    // has been initialised
    if (_dateF != null) {
      // set the DTG
      _theDate.setText(_dateF.format(new Date(ImportRangeDataPanel._theDTG)));
    }
  }
 /** Constructor */
 public SOAPMonitorData(Long id, String target, String soap_request) {
   this.id = id;
   // A null id is used to signal that the "most recent" entry
   // is being created.
   if (id == null) {
     this.time = "Most Recent";
     this.target = "---";
     this.soap_request = null;
     this.soap_response = null;
   } else {
     this.time = DateFormat.getTimeInstance().format(new Date());
     this.target = target;
     this.soap_request = soap_request;
     this.soap_response = null;
   }
 }
  /**
   * Tries very, very hard to parse the a date. We assume that the text is neither empty nor <code>
   * null</code>.
   */
  private Date parseDate(String text) {
    DateFormat formats[] =
        new DateFormat[] {
          DateFormat.getDateInstance(DateFormat.SHORT),
          DateFormat.getDateInstance(DateFormat.MEDIUM),
          DateFormat.getDateInstance(DateFormat.LONG),
          DateFormat.getDateInstance(DateFormat.FULL),
        };

    for (int i = 0; i < formats.length; i++) {
      DateFormat df = formats[i];
      try {
        Date date = df.parse(text);
        return date;

      } catch (ParseException ex) {
        continue;
      }
    }

    error("Could not parse date: " + text);
    return null;
  }
  /**
   * Set up the calendar panel with the basic layout and components. These are not date specific.
   */
  private void createCalendarComponents() {
    // The date panel will hold the calendar and/or the time spinner

    JPanel datePanel = new JPanel(new BorderLayout(2, 2));

    // Create the calendar if we are displaying a calendar

    if ((selectedComponents & DISPLAY_DATE) > 0) {
      formatMonth = new SimpleDateFormat("MMM", locale);
      formatWeekDay = new SimpleDateFormat("EEE", locale);

      // Set up the shared keyboard bindings

      setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);
      setActionMap(actionMap);

      // Set up the decrement buttons

      yearDecrButton =
          new JButton(
              new ButtonAction(
                  "YearDecrButton",
                  "YearDecrButtonMnemonic",
                  "YearDecrButtonAccelerator",
                  "YearDecrButtonImage",
                  "YearDecrButtonShort",
                  "YearDecrButtonLong",
                  YEAR_DECR_BUTTON));
      monthDecrButton =
          new JButton(
              new ButtonAction(
                  "MonthDecrButton",
                  "MonthDecrButtonMnemonic",
                  "MonthDecrButtonAccelerator",
                  "MonthDecrButtonImage",
                  "MonthDecrButtonShort",
                  "MonthDecrButtonLong",
                  MONTH_DECR_BUTTON));
      JPanel decrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
      decrPanel.add(yearDecrButton);
      decrPanel.add(monthDecrButton);

      // Set up the month/year label

      monthYearLabel = new JLabel();
      monthYearLabel.setHorizontalAlignment(JLabel.CENTER);

      // Set up the increment buttons

      monthIncrButton =
          new JButton(
              new ButtonAction(
                  "MonthIncrButton",
                  "MonthIncrButtonMnemonic",
                  "MonthIncrButtonAccelerator",
                  "MonthIncrButtonImage",
                  "MonthIncrButtonShort",
                  "MonthIncrButtonLong",
                  MONTH_INCR_BUTTON));
      yearIncrButton =
          new JButton(
              new ButtonAction(
                  "YearIncrButton",
                  "YearIncrButtonMnemonic",
                  "YearIncrButtonAccelerator",
                  "YearIncrButtonImage",
                  "YearIncrButtonShort",
                  "YearIncrButtonLong",
                  YEAR_INCR_BUTTON));
      JPanel incrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
      incrPanel.add(monthIncrButton);
      incrPanel.add(yearIncrButton);

      // Put them all together

      JPanel monthYearNavigator = new JPanel(new BorderLayout(2, 2));
      monthYearNavigator.add(decrPanel, BorderLayout.WEST);
      monthYearNavigator.add(monthYearLabel);
      monthYearNavigator.add(incrPanel, BorderLayout.EAST);

      // Set up the day panel

      JPanel dayPanel = new JPanel(new GridLayout(7, 7));
      int firstDay = displayCalendar.getFirstDayOfWeek();

      // Get the week day labels. The following technique is used so
      // that we can start the calendar on the right day of the week and
      // we can get the week day labels properly localized

      Calendar temp = Calendar.getInstance(locale);
      temp.set(2000, Calendar.MARCH, 15);
      while (temp.get(Calendar.DAY_OF_WEEK) != firstDay) {
        temp.add(Calendar.DATE, 1);
      }
      dayOfWeekLabels = new JLabel[7];
      for (int i = 0; i < 7; i++) {
        Date date = temp.getTime();
        String dayOfWeek = formatWeekDay.format(date);
        dayOfWeekLabels[i] = new JLabel(dayOfWeek);
        dayOfWeekLabels[i].setHorizontalAlignment(JLabel.CENTER);
        dayPanel.add(dayOfWeekLabels[i]);
        temp.add(Calendar.DATE, 1);
      }

      // Add all the day buttons

      dayButtons = new JToggleButton[6][7];
      dayGroup = new ButtonGroup();
      DayListener dayListener = new DayListener();
      for (int row = 0; row < 6; row++) {
        for (int day = 0; day < 7; day++) {
          dayButtons[row][day] = new JToggleButton();
          dayButtons[row][day].addItemListener(dayListener);
          dayPanel.add(dayButtons[row][day]);
          dayGroup.add(dayButtons[row][day]);
        }
      }

      // We add this special button to the button group, so we have a
      // way of unselecting all the visible buttons

      offScreenButton = new JToggleButton("X");
      dayGroup.add(offScreenButton);

      // Combine the navigators and days

      datePanel.add(monthYearNavigator, BorderLayout.NORTH);
      datePanel.add(dayPanel);
    }

    // Create the time spinner field if we are displaying the time

    if ((selectedComponents & DISPLAY_TIME) > 0) {

      // Create the time component

      spinnerDateModel = new SpinnerDateModel();
      spinnerDateModel.addChangeListener(new TimeListener());
      spinner = new JSpinner(spinnerDateModel);

      JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(spinner, timePattern);
      dateEditor.getTextField().setEditable(false);
      dateEditor.getTextField().setHorizontalAlignment(JTextField.CENTER);
      spinner.setEditor(dateEditor);

      // Set the input/action maps for the spinner. (Only BACK_SPACE
      // seems to work!)

      InputMap sim = new InputMap();
      sim.put(KeyStroke.getKeyStroke("BACK_SPACE"), "setNullDate");
      sim.put(KeyStroke.getKeyStroke("DELETE"), "setNullDate");
      sim.setParent(spinner.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));

      ActionMap sam = new ActionMap();
      sam.put(
          "setNullDate",
          new AbstractAction("setNullDate") {
            public void actionPerformed(ActionEvent e) {
              JCalendar.this.setDate(null);
            }
          });
      sam.setParent(spinner.getActionMap());

      spinner.setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, sim);
      spinner.setActionMap(sam);

      // Create a special panel for the time display

      JPanel timePanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 2, 2));
      timePanel.add(spinner);

      // Now add it to the bottom

      datePanel.add(timePanel, BorderLayout.SOUTH);
    }

    setLayout(new BorderLayout(2, 2));
    add(datePanel);

    // Add today's date at the bottom of the calendar/time, if needed

    if (isTodayDisplayed) {
      Object[] args = {new Date()};
      String todaysDate = MessageFormat.format(bundle.getString("Today"), args);
      todaysLabel = new JLabel(todaysDate);
      todaysLabel.setHorizontalAlignment(JLabel.CENTER);

      // Add today's date at the very bottom

      add(todaysLabel, BorderLayout.SOUTH);
    }
  }
  /** Update the calendar panel to display the currently selected date. */
  private void updateCalendarComponents() {
    if ((selectedComponents & DISPLAY_DATE) > 0) {

      // Unselect all visible dates

      offScreenButton.setSelected(true);

      // Get the display date. We only need the month and year

      displayMonth = displayCalendar.get(Calendar.MONTH);
      displayYear = displayCalendar.get(Calendar.YEAR);

      // Get the localized display month name and year

      String month = formatMonth.format(displayCalendar.getTime());
      String year = Integer.toString(displayYear);

      {
        Object[] args = {month, year};
        monthYearLabel.setText(MessageFormat.format(bundle.getString("MonthYearTitle"), args));
      }

      // If the month or year have changed, we need to re-lay out
      // the days. Otherwise, we don't

      if (!month.equals(lastMonth) || !year.equals(lastYear)) {

        // Create a temporary calendar that we will use to
        // determine where day 1 goes and how many days there are
        // in this month

        Calendar temp = (Calendar) displayCalendar.clone();
        temp.set(Calendar.DATE, 1);

        int dayOfWeek = temp.get(Calendar.DAY_OF_WEEK);
        int firstDay = temp.getFirstDayOfWeek();

        // Determine how many blank slots occur before day 1 of this
        // month

        int dayPtr;
        for (dayPtr = 0; dayPtr < 7; dayPtr++) {
          int curDay = ((firstDay - 1) + dayPtr) % 7 + 1;
          if (curDay != dayOfWeek) {
            dayButtons[0][dayPtr].setText("");
            dayButtons[0][dayPtr].setEnabled(false);
          } else {
            break;
          }
        }

        // Determine the number of days in this month

        int maxDays = temp.getActualMaximum(Calendar.DATE);

        // Fill in the days

        int row = 0;
        for (int day = 1; day <= maxDays; day++) {
          dayButtons[row][dayPtr].setText(Integer.toString(day));
          dayButtons[row][dayPtr].setEnabled(true);

          // If this is the selected date, select the button;
          // otherwise, deselect it

          if (day == selectedDay && displayMonth == selectedMonth && displayYear == selectedYear) {
            dayButtons[row][dayPtr].setSelected(true);
          } else {
            dayButtons[row][dayPtr].getModel().setSelected(false);
          }

          // Wrap as needed

          dayPtr = (dayPtr + 1) % 7;
          if (dayPtr == 0) row++;
        }

        // Set the blanks slots after the last day

        while (row < 6) {
          dayButtons[row][dayPtr].setText("");
          dayButtons[row][dayPtr].setEnabled(false);
          dayButtons[row][dayPtr].getModel().setSelected(false);
          dayPtr = (dayPtr + 1) % 7;
          if (dayPtr == 0) row++;
        }
      }
    }

    // Update the time component, if displayed

    if ((selectedComponents & DISPLAY_TIME) > 0) {

      // If no date is selected, we set the date used by the time
      // field to today @ noon. We also make the field insensitive
      // -- the user must pick a non-null date before being able to
      // change the time (unless all we have is a time field)

      if (isNullDate) {
        Calendar temp = (Calendar) selectedCalendar.clone();
        temp.setTime(new Date());
        temp.set(Calendar.HOUR, 12);
        temp.set(Calendar.MINUTE, 0);
        temp.set(Calendar.SECOND, 0);
        spinnerDateModel.setValue(temp.getTime());
        spinner.setEnabled((selectedComponents & DISPLAY_DATE) == 0);
      }

      // If a date is selected, use it

      else {
        spinner.setEnabled(JCalendar.this.isEnabled());
        spinnerDateModel.setValue(selectedCalendar.getTime());
        spinnerDateModel.setStart(null);
        spinnerDateModel.setEnd(null);
        spinner.revalidate();
      }
    }
  }
示例#13
0
/** @author Octavio */
public class MovimientoAlmacen extends javax.swing.JInternalFrame {

  BufferedImage fondo;
  Celda cellCodigo = new Celda();
  /** Creates new form MovimientoAlmacen */
  public MovimientoAlmacen() {
    initComponents();
    // Instrucciones para el funcionamiento del fondo semistransparente
    this.setOpaque(false);
    ((JPanel) this.getContentPane()).setOpaque(false);
    this.getLayeredPane().setOpaque(false);
    this.getRootPane().setOpaque(false);
    this.generarFondo(this);

    Herramientas.centrarVentana(this);

    this.tablaPrincipal.addKeyListener(new TabListener());
    tablaPrincipal.getModel().addTableModelListener(modelListener);
    tablaPrincipal.getColumn("Código artículo").setCellEditor(cellCodigo);

    this.fecha.setDate(new java.util.Date());
    // tablaPrincipal.setDefaultEditor(Object.class, new Celda());

  }

  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLabel2 = new javax.swing.JLabel();
    lblTitulo = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    descripcion = new javax.swing.JTextField();
    jLabel4 = new javax.swing.JLabel();
    folio = new javax.swing.JTextField();
    jScrollPane1 = new javax.swing.JScrollPane();
    tablaPrincipal = new javax.swing.JTable();
    btnNuevo = new javax.swing.JButton();
    btnImprimir = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    btnCerrar = new javax.swing.JButton();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    almacen = new javax.swing.JTextField();
    tipoMovimiento = new javax.swing.JComboBox();
    txtSumaTotal = new javax.swing.JTextField();
    jLabel8 = new javax.swing.JLabel();
    btnEliminarRenglon = new javax.swing.JButton();
    fecha = new org.jdesktop.swingx.JXDatePicker();
    jLabel3 = new javax.swing.JLabel();

    jLabel2.setText("jLabel2");

    setTitle("Movimiento de almacén");
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    lblTitulo.setFont(new java.awt.Font("Arial", 1, 36));
    lblTitulo.setForeground(new java.awt.Color(255, 255, 255));
    lblTitulo.setText("Movimiento de almacén");
    getContentPane()
        .add(lblTitulo, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 40));

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setText("Descripción:");
    getContentPane()
        .add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, -1, 30));
    getContentPane()
        .add(descripcion, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 90, 600, -1));

    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel4.setForeground(new java.awt.Color(255, 255, 255));
    jLabel4.setText("Folio:");
    getContentPane()
        .add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 90, -1, 30));
    getContentPane().add(folio, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 90, 80, -1));

    tablaPrincipal.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    tablaPrincipal.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {},
            new String[] {"Código artículo", "Descripción", "Costo", "Cantidad", "Total"}) {
          boolean[] canEdit = new boolean[] {true, false, true, true, false};

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    tablaPrincipal.setToolTipText("[ F1 ] catalogo de articulos");
    tablaPrincipal.setCellSelectionEnabled(true);
    tablaPrincipal.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    tablaPrincipal.setGridColor(new java.awt.Color(51, 255, 255));
    tablaPrincipal.setRowHeight(25);
    tablaPrincipal.setShowHorizontalLines(false);
    tablaPrincipal.setSurrendersFocusOnKeystroke(true);
    jScrollPane1.setViewportView(tablaPrincipal);

    getContentPane()
        .add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, 820, 280));

    btnNuevo.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/64x64/page_add.png"))); // NOI18N
    btnNuevo.setText("<html><center>Agregar éste movimiento [F5]</center></html>");
    btnNuevo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNuevoActionPerformed(evt);
          }
        });
    getContentPane()
        .add(btnNuevo, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 440, 190, 60));

    btnImprimir.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/64x64/printer.png"))); // NOI18N
    btnImprimir.setText("<html><center>Imprimir [F8]</center></html>");
    btnImprimir.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnImprimirActionPerformed(evt);
          }
        });
    getContentPane()
        .add(btnImprimir, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 440, 160, 60));

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 30, Short.MAX_VALUE));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 30, Short.MAX_VALUE));

    getContentPane()
        .add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(810, 480, 30, 30));

    btnCerrar.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/64x64/back.png"))); // NOI18N
    btnCerrar.setText("<HTML>Regresar a almacén [Esc]</HTML>");
    btnCerrar.setRequestFocusEnabled(false);
    btnCerrar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCerrarActionPerformed(evt);
          }
        });
    getContentPane()
        .add(btnCerrar, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 10, 230, 40));

    jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel5.setForeground(new java.awt.Color(255, 255, 255));
    jLabel5.setText("Tipo de movimiento:");
    getContentPane()
        .add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 130, 30));

    jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel6.setForeground(new java.awt.Color(255, 255, 255));
    jLabel6.setText("Fecha:");
    getContentPane()
        .add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(630, 60, 40, 30));

    jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel7.setForeground(new java.awt.Color(255, 255, 255));
    jLabel7.setText("Almacén [F1]:");
    getContentPane()
        .add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 50, 90, 30));

    almacen.setEditable(false);
    getContentPane()
        .add(almacen, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 60, 190, -1));

    tipoMovimiento.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"Entrada al almacén", "Salida del almacén", "Ajuste"}));
    getContentPane()
        .add(tipoMovimiento, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 60, 140, -1));
    getContentPane()
        .add(txtSumaTotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 410, 170, -1));

    jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel8.setForeground(new java.awt.Color(255, 255, 255));
    jLabel8.setText("Total:");
    getContentPane()
        .add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 410, -1, 20));

    btnEliminarRenglon.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/16x16/remove.png"))); // NOI18N
    btnEliminarRenglon.setText("Eliminar renglón seleccionado [F12]");
    btnEliminarRenglon.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnEliminarRenglonActionPerformed(evt);
          }
        });
    getContentPane()
        .add(
            btnEliminarRenglon, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 410, -1, -1));

    fecha.setFormats(java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM));
    getContentPane()
        .add(fecha, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 60, 160, -1));

    jLabel3.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N
    jLabel3.setText("[ F1 ] catalogo de articulos");
    getContentPane()
        .add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 410, 190, 20));

    pack();
  } // </editor-fold>//GEN-END:initComponents

  public DateFormat formatoFecha = DateFormat.getDateInstance(DateFormat.MEDIUM);
  public SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

  public String getTipoMovimiento() {
    return (String) this.tipoMovimiento.getSelectedItem();
  }

  public String getAlmacen() {
    return (String) (this.almacen.getText());
  }

  public String getFecha() {
    return (String) sdf.format(this.fecha.getDate());
  }

  public String getDescripcion() {
    return (String) this.descripcion.getText();
  }

  public String getFolio() {
    return (String) this.folio.getText();
  }

  public Double getGranTotal() {
    return Double.parseDouble(this.txtSumaTotal.getText());
  }

  public Vector getTablaPrincipal() {
    return ((DefaultTableModel) this.tablaPrincipal.getModel()).getDataVector();
  }

  public JTextField getFieldAlmacen() {
    return this.almacen;
  }

  public void setTipoMovimiento(String val) {
    tipoMovimiento.setSelectedItem(val);
  }

  public void setAlmacen(String val) {
    almacen.setText(val);
  }

  public void setFecha(String val) {
    try {
      fecha.setDate(sdf.parse(val));
    } catch (Exception e) {
      omoikane.sistema.Dialogos.lanzarDialogoError(
          null,
          "Error en el registro: Fecha inválida",
          omoikane.sistema.Herramientas.getStackTraceString(e));
    }
  }

  public void setDescripcion(String val) {
    descripcion.setText(val);
  }

  public void setFolio(String val) {
    folio.setText(val);
  }

  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();
  }

  int ID = -1;

  public void setID(int ID) {
    this.ID = ID;
  }

  public int getID() {
    return ID;
  }

  public void setModoModificaciones() {
    this.setTitle("Modificar movimiento " + ID);
    // this.btnEliminar.setVisible(false);
    this.btnNuevo.setVisible(false);
    this.lblTitulo.setText("Modificar Movimiento de Almacén");
    this.btnEliminarRenglon.setVisible(true);
    // this.btnModificar.setVisible(true);
    this.folio.setEditable(true);
    this.descripcion.setEditable(true);
    this.fecha.setEditable(true);
    this.tipoMovimiento.setEditable(true);
    this.almacen.setEditable(true);
    this.tablaPrincipal.setEnabled(true);
  }

  public void setModoNuevo() {
    this.setTitle("Registrar nuevo movimiento de almacén");
    this.lblTitulo.setText("Nuevo movimiento de almacén");
    this.folio.setText("0");
    // this.btnEliminar.setVisible(false);
    // this.btnModificar.setVisible(false);
    ((DefaultTableModel) this.tablaPrincipal.getModel()).addRow(new Object[] {});
  }

  public void setModoDetalles() {
    this.setTitle("Detalles del movimiento de almacén " + ID);
    this.lblTitulo.setText("Detalles del movimiento");
    this.btnEliminarRenglon.setVisible(false);
    // this.btnCatalogo.setVisible(false);
    this.btnNuevo.setVisible(false);
    // this.btnModificar.setVisible(false);
    this.folio.setEditable(false);
    this.descripcion.setEditable(false);
    this.fecha.setEditable(false);
    this.tipoMovimiento.setEditable(false);
    this.almacen.setEditable(false);
    this.tablaPrincipal.setEnabled(false);
  }

  private void btnCerrarActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnCerrarActionPerformed
    // TODO add your handling code here:
    this.dispose();
  } // GEN-LAST:event_btnCerrarActionPerformed

  private void btnEliminarRenglonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEliminarRenglonActionPerformed
    // TODO add your handling code here:
    int IDRenglon = this.tablaPrincipal.getSelectedRow();
    if (IDRenglon != -1) {
      if (JOptionPane.showConfirmDialog(
              null,
              "¿Realmente desea eliminar el renglón seleccionado?",
              "¿Eliminar?",
              JOptionPane.OK_CANCEL_OPTION)
          == JOptionPane.OK_OPTION) {
        ((DefaultTableModel) tablaPrincipal.getModel()).removeRow(IDRenglon);
      }
    }
  } // GEN-LAST:event_btnEliminarRenglonActionPerformed

  private void btnNuevoActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnNuevoActionPerformed
    // TODO add your handling code here:
    omoikane.principal.Almacenes.guardarMovimiento(this);
  } // GEN-LAST:event_btnNuevoActionPerformed

  private void btnImprimirActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnImprimirActionPerformed
    // TODO add your handling code here:
    omoikane.principal.Almacenes.lanzarImprimirMovimiento(this);
  } // GEN-LAST:event_btnImprimirActionPerformed

  public void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.drawImage(fondo, 0, 0, null);
  }

  public void generarFondo(Component componente) {
    Rectangle areaDibujo = this.getBounds();
    BufferedImage tmp;
    GraphicsConfiguration gc =
        GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getDefaultScreenDevice()
            .getDefaultConfiguration();

    tmp = gc.createCompatibleImage(areaDibujo.width, areaDibujo.height, BufferedImage.TRANSLUCENT);
    Graphics2D g2d = (Graphics2D) tmp.getGraphics();
    g2d.setColor(new Color(55, 55, 255, 165));
    g2d.fillRect(0, 0, areaDibujo.width, areaDibujo.height);
    fondo = tmp;
  }

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JTextField almacen;
  private javax.swing.JButton btnCerrar;
  private javax.swing.JButton btnEliminarRenglon;
  private javax.swing.JButton btnImprimir;
  private javax.swing.JButton btnNuevo;
  public javax.swing.JTextField descripcion;
  private org.jdesktop.swingx.JXDatePicker fecha;
  private javax.swing.JTextField folio;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JLabel jLabel4;
  private javax.swing.JLabel jLabel5;
  private javax.swing.JLabel jLabel6;
  private javax.swing.JLabel jLabel7;
  private javax.swing.JLabel jLabel8;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JLabel lblTitulo;
  private javax.swing.JTable tablaPrincipal;
  private javax.swing.JComboBox tipoMovimiento;
  private javax.swing.JTextField txtSumaTotal;
  // End of variables declaration//GEN-END:variables

  public void calculaSumas() {
    try {
      TableModel tm = this.tablaPrincipal.getModel();
      int tamTabla = tm.getRowCount();
      double costo, cantidad, totalFila, sumaTotal;
      sumaTotal = 0.0;

      for (int i = 0; i < tamTabla; i++) {
        if (tm.getValueAt(i, 2) != null && tm.getValueAt(i, 3) != null) {
          costo = Double.valueOf(String.valueOf(tm.getValueAt(i, 2)));
          cantidad = Double.valueOf(String.valueOf(tm.getValueAt(i, 3)));
          totalFila = costo * cantidad;

          tm.setValueAt(totalFila, i, 4);
          sumaTotal += totalFila;
        }
      }

      txtSumaTotal.setText(String.valueOf(sumaTotal));
    } catch (Exception e) {
      Dialogos.lanzarAlerta("Cantidades invalidas, puede que algun numero este mal escrito");
    }
  }

  // Clase encargada de recibir los eventos de la tabla, para crear nuevas filas y calcular sumas
  class TabListener extends KeyAdapter {
    public void keyPressed(KeyEvent ke) {

      if (ke.getKeyCode() == ke.VK_TAB) {
        int x = ((JTable) ke.getSource()).getSelectedColumn();
        int y = ((JTable) ke.getSource()).getSelectedRow();
        int maxX = ((JTable) ke.getSource()).getColumnCount();
        int maxY = ((JTable) ke.getSource()).getRowCount();
        TableModel tm = ((JTable) ke.getSource()).getModel();
        if (x == maxX - 1 && y == maxY - 1) {
          ((DefaultTableModel) tm).addRow(new Object[maxX]);
        }
      }
    }
  }

  public TableModelListener modelListener =
      new javax.swing.event.TableModelListener() {
        public void tableChanged(javax.swing.event.TableModelEvent tme) {
          DefaultTableModel tm = (DefaultTableModel) tme.getSource();
          int col = tme.getColumn();
          int row = tme.getFirstRow();
          String valCel = (String) tm.getValueAt(tme.getFirstRow(), 0);

          if (tme.getType() == 0 && (col == 2 || col == 3)) {
            calculaSumas();
          }
        }
      };

  class Celda extends DefaultCellEditor {
    JTextField componente;

    Celda() {
      super(new JTextField());
      componente =
          (JTextField)
              this.getComponent(); /*componente.addKeyListener(new CellCodigoKeyListener());*/
    }

    public boolean stopCellEditing() {
      Object descrip = null, costo = null;
      JTextField campo = ((JTextField) this.getComponent());
      String codigo = campo.getText();
      if (codigo == "") {
        return false;
      }
      descrip =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('codigo = \""
                  + codigo
                  + "\"').descripcion");
      costo =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('select * from articulos,precios where articulos.codigo = \""
                  + codigo
                  + "\" "
                  + "and articulos.id_articulo = precios.id_articulo and precios.id_almacen = '+omoikane.principal.Principal.config.idAlmacen[0].text()).costo");

      if (descrip == null) {
        Dialogos.lanzarAlerta("El artículo que capturó no exíste");
        campo.setText("");
        return false;
      } else {
        tablaPrincipal.setValueAt(
            descrip, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 1);
        tablaPrincipal.setValueAt(
            costo, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 2);
        return super.stopCellEditing();
      }
    }
  }
}
  public FormatTestFrame() {
    JPanel buttonPanel = new JPanel();
    okButton = new JButton("Ok");
    buttonPanel.add(okButton);
    add(buttonPanel, BorderLayout.SOUTH);

    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 3));
    add(mainPanel, BorderLayout.CENTER);

    JFormattedTextField intField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    intField.setValue(new Integer(100));
    addRow("Number:", intField);

    JFormattedTextField intField2 = new JFormattedTextField(NumberFormat.getIntegerInstance());
    intField2.setValue(new Integer(100));
    intField2.setFocusLostBehavior(JFormattedTextField.COMMIT);
    addRow("Number (Commit behavior):", intField2);

    JFormattedTextField intField3 =
        new JFormattedTextField(
            new InternationalFormatter(NumberFormat.getIntegerInstance()) {
              protected DocumentFilter getDocumentFilter() {
                return filter;
              }
            });
    intField3.setValue(new Integer(100));
    addRow("Filtered Number", intField3);

    JFormattedTextField intField4 = new JFormattedTextField(NumberFormat.getIntegerInstance());
    intField4.setValue(new Integer(100));
    intField4.setInputVerifier(
        new InputVerifier() {
          public boolean verify(JComponent component) {
            JFormattedTextField field = (JFormattedTextField) component;
            return field.isEditValid();
          }
        });
    addRow("Verified Number:", intField4);

    JFormattedTextField currencyField = new JFormattedTextField(NumberFormat.getCurrencyInstance());
    currencyField.setValue(new Double(10));
    addRow("Currency:", currencyField);

    JFormattedTextField dateField = new JFormattedTextField(DateFormat.getDateInstance());
    dateField.setValue(new Date());
    addRow("Date (default):", dateField);

    DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT);
    format.setLenient(false);
    JFormattedTextField dateField2 = new JFormattedTextField(format);
    dateField2.setValue(new Date());
    addRow("Date (short, not lenient):", dateField2);

    try {
      DefaultFormatter formatter = new DefaultFormatter();
      formatter.setOverwriteMode(false);
      JFormattedTextField urlField = new JFormattedTextField(formatter);
      urlField.setValue(new URL("http://java.sun.com"));
      addRow("URL:", urlField);
    } catch (MalformedURLException ex) {
      ex.printStackTrace();
    }

    try {
      MaskFormatter formatter = new MaskFormatter("###-##-####");
      formatter.setPlaceholderCharacter('0');
      JFormattedTextField ssnField = new JFormattedTextField(formatter);
      ssnField.setValue("078-05-1120");
      addRow("SSN Mask:", ssnField);
    } catch (ParseException ex) {
      ex.printStackTrace();
    }

    JFormattedTextField ipField = new JFormattedTextField(new IPAddressFormatter());
    ipField.setValue(new byte[] {(byte) 130, 65, 86, 66});
    addRow("IP Address:", ipField);
    pack();
  }
示例#15
0
/**
 * This class is used in the model of the ACLTree. The MessageNode contains an ACLMessage, a
 * direction and a date/timestamp
 *
 * @author Chris van Aart - Acklin B.V., the Netherlands
 * @created April 26, 2002
 */
public class ACLMessageNode extends DefaultMutableTreeNode {

  /**
   * Constructor for the MessageNode object
   *
   * @param str Description of Parameter
   */
  ACLMessageNode(String str) {
    super(str);
  }

  /**
   * Gets the Message attribute of the MessageNode object
   *
   * @return The Message value
   */
  public ACLMessage getMessage() {
    return theMessage;
  }

  /**
   * Gets the Performative attribute of the MessageNode object
   *
   * @return The Performative value
   */
  public String getPerformative() {
    return theMessage.getPerformative(theMessage.getPerformative());
  }

  /**
   * Gets the SendTo attribute of the MessageNode object
   *
   * @return The SendTo value
   */
  public String getSendTo() {
    if (theMessage.getAllReceiver().hasNext()) {
      AID sender = (AID) theMessage.getAllReceiver().next();
      return sender.getName();
    }
    return "<unknown>";
  }

  /**
   * Gets the Ontology attribute of the MessageNode object
   *
   * @return The Ontology value
   */
  public String getOntology() {
    String ontology = theMessage.getOntology();
    if (ontology != null) {
      return ontology;
    }
    return "<unknown>";
  }

  /**
   * Gets the Direction attribute of the MessageNode object
   *
   * @return The Direction value
   */
  public String getDirection() {
    return direction;
  }

  public String getTime() {
    return time;
  }

  public Date getTheDate() {
    return theDate;
  }

  /**
   * Sets the Message attribute of the MessageNode object
   *
   * @param msg The new Message value
   */
  public void setMessage(ACLMessage msg) {
    theMessage = (ACLMessage) msg.clone();
  }

  /**
   * Sets the Direction attribute of the MessageNode object
   *
   * @param theDirection The new Direction value
   */
  public void setDirection(String theDirection) {
    direction = theDirection;
  }

  public void setTime(String theTime) {
    time = theTime;
    try {
      this.theDate = dateFormat.parse(time);
    } catch (Exception ex) {
      jade.util.Logger.getMyLogger(this.getClass().getName())
          .log(jade.util.Logger.WARNING, ex.getMessage());
    }
  }

  public void setTheDate(Date theTheDate) {
    theDate = theTheDate;
  }

  public String receivedFrom() {
    if (theMessage.getSender() != null) {
      AID sender = theMessage.getSender();
      return sender.getName();
    }
    return "<unknown>";
  }

  private static DateFormat dateFormat =
      DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
  private Date theDate = new Date();
  private ACLMessage theMessage;
  private String direction;
  private String time;
}
示例#16
0
  synchronized Result formatSummary() {
    Result result = new Result();
    ProxyClient proxyClient = vmPanel.getProxyClient();
    if (proxyClient.isDead()) {
      return null;
    }

    buf = new StringBuilder();
    append("<table cellpadding=1>");

    try {
      RuntimeMXBean rmBean = proxyClient.getRuntimeMXBean();
      CompilationMXBean cmpMBean = proxyClient.getCompilationMXBean();
      ThreadMXBean tmBean = proxyClient.getThreadMXBean();
      MemoryMXBean memoryBean = proxyClient.getMemoryMXBean();
      ClassLoadingMXBean clMBean = proxyClient.getClassLoadingMXBean();
      OperatingSystemMXBean osMBean = proxyClient.getOperatingSystemMXBean();
      com.sun.management.OperatingSystemMXBean sunOSMBean =
          proxyClient.getSunOperatingSystemMXBean();

      append("<tr><td colspan=4>");
      append("<center><b>" + Messages.SUMMARY_TAB_TAB_NAME + "</b></center>");
      String dateTime = headerDateTimeFormat.format(System.currentTimeMillis());
      append("<center>" + dateTime + "</center>");

      append(newDivider);

      { // VM info
        append(newLeftTable);
        append(Messages.CONNECTION_NAME, vmPanel.getDisplayName());
        append(
            Messages.VIRTUAL_MACHINE,
            Resources.format(
                Messages.SUMMARY_TAB_VM_VERSION, rmBean.getVmName(), rmBean.getVmVersion()));
        append(Messages.VENDOR, rmBean.getVmVendor());
        append(Messages.NAME, rmBean.getName());
        append(endTable);

        append(newRightTable);
        result.upTime = rmBean.getUptime();
        append(Messages.UPTIME, formatTime(result.upTime));
        if (sunOSMBean != null) {
          result.processCpuTime = sunOSMBean.getProcessCpuTime();
          append(Messages.PROCESS_CPU_TIME, formatNanoTime(result.processCpuTime));
        }

        if (cmpMBean != null) {
          append(Messages.JIT_COMPILER, cmpMBean.getName());
          append(
              Messages.TOTAL_COMPILE_TIME,
              cmpMBean.isCompilationTimeMonitoringSupported()
                  ? formatTime(cmpMBean.getTotalCompilationTime())
                  : Messages.UNAVAILABLE);
        } else {
          append(Messages.JIT_COMPILER, Messages.UNAVAILABLE);
        }
        append(endTable);
      }

      append(newDivider);

      { // Threads and Classes
        append(newLeftTable);
        int tlCount = tmBean.getThreadCount();
        int tdCount = tmBean.getDaemonThreadCount();
        int tpCount = tmBean.getPeakThreadCount();
        long ttCount = tmBean.getTotalStartedThreadCount();
        String[] strings1 =
            formatLongs(
                tlCount, tpCount,
                tdCount, ttCount);
        append(Messages.LIVE_THREADS, strings1[0]);
        append(Messages.PEAK, strings1[1]);
        append(Messages.DAEMON_THREADS, strings1[2]);
        append(Messages.TOTAL_THREADS_STARTED, strings1[3]);
        append(endTable);

        append(newRightTable);
        long clCount = clMBean.getLoadedClassCount();
        long cuCount = clMBean.getUnloadedClassCount();
        long ctCount = clMBean.getTotalLoadedClassCount();
        String[] strings2 = formatLongs(clCount, cuCount, ctCount);
        append(Messages.CURRENT_CLASSES_LOADED, strings2[0]);
        append(Messages.TOTAL_CLASSES_LOADED, strings2[2]);
        append(Messages.TOTAL_CLASSES_UNLOADED, strings2[1]);
        append(null, "");
        append(endTable);
      }

      append(newDivider);

      { // Memory
        MemoryUsage u = memoryBean.getHeapMemoryUsage();

        append(newLeftTable);
        String[] strings1 = formatKByteStrings(u.getUsed(), u.getMax());
        append(Messages.CURRENT_HEAP_SIZE, strings1[0]);
        append(Messages.MAXIMUM_HEAP_SIZE, strings1[1]);
        append(endTable);

        append(newRightTable);
        String[] strings2 = formatKByteStrings(u.getCommitted());
        append(Messages.COMMITTED_MEMORY, strings2[0]);
        append(
            Messages.SUMMARY_TAB_PENDING_FINALIZATION_LABEL,
            Messages.SUMMARY_TAB_PENDING_FINALIZATION_VALUE,
            memoryBean.getObjectPendingFinalizationCount());
        append(endTable);

        append(newTable);
        Collection<GarbageCollectorMXBean> garbageCollectors =
            proxyClient.getGarbageCollectorMXBeans();
        for (GarbageCollectorMXBean garbageCollectorMBean : garbageCollectors) {
          String gcName = garbageCollectorMBean.getName();
          long gcCount = garbageCollectorMBean.getCollectionCount();
          long gcTime = garbageCollectorMBean.getCollectionTime();

          append(
              Messages.GARBAGE_COLLECTOR,
              Resources.format(
                  Messages.GC_INFO,
                  gcName,
                  gcCount,
                  (gcTime >= 0) ? formatTime(gcTime) : Messages.UNAVAILABLE),
              4);
        }
        append(endTable);
      }

      append(newDivider);

      { // Operating System info
        append(newLeftTable);
        String osName = osMBean.getName();
        String osVersion = osMBean.getVersion();
        String osArch = osMBean.getArch();
        result.nCPUs = osMBean.getAvailableProcessors();
        append(Messages.OPERATING_SYSTEM, osName + " " + osVersion);
        append(Messages.ARCHITECTURE, osArch);
        append(Messages.NUMBER_OF_PROCESSORS, result.nCPUs + "");

        if (pathSeparator == null) {
          // Must use separator of remote OS, not File.pathSeparator
          // from this local VM. In the future, consider using
          // RuntimeMXBean to get the remote system property.
          pathSeparator = osName.startsWith("Windows ") ? ";" : ":";
        }

        if (sunOSMBean != null) {
          String[] kbStrings1 = formatKByteStrings(sunOSMBean.getCommittedVirtualMemorySize());

          String[] kbStrings2 =
              formatKByteStrings(
                  sunOSMBean.getTotalPhysicalMemorySize(),
                  sunOSMBean.getFreePhysicalMemorySize(),
                  sunOSMBean.getTotalSwapSpaceSize(),
                  sunOSMBean.getFreeSwapSpaceSize());

          append(Messages.COMMITTED_VIRTUAL_MEMORY, kbStrings1[0]);
          append(endTable);

          append(newRightTable);
          append(Messages.TOTAL_PHYSICAL_MEMORY, kbStrings2[0]);
          append(Messages.FREE_PHYSICAL_MEMORY, kbStrings2[1]);
          append(Messages.TOTAL_SWAP_SPACE, kbStrings2[2]);
          append(Messages.FREE_SWAP_SPACE, kbStrings2[3]);
        }

        append(endTable);
      }

      append(newDivider);

      { // VM arguments and paths
        append(newTable);
        String args = "";
        java.util.List<String> inputArguments = rmBean.getInputArguments();
        for (String arg : inputArguments) {
          args += arg + " ";
        }
        append(Messages.VM_ARGUMENTS, args, 4);
        append(Messages.CLASS_PATH, rmBean.getClassPath(), 4);
        append(Messages.LIBRARY_PATH, rmBean.getLibraryPath(), 4);
        append(
            Messages.BOOT_CLASS_PATH,
            rmBean.isBootClassPathSupported() ? rmBean.getBootClassPath() : Messages.UNAVAILABLE,
            4);
        append(endTable);
      }
    } catch (IOException e) {
      if (JConsole.isDebug()) {
        e.printStackTrace();
      }
      proxyClient.markAsDead();
      return null;
    } catch (UndeclaredThrowableException e) {
      if (JConsole.isDebug()) {
        e.printStackTrace();
      }
      proxyClient.markAsDead();
      return null;
    }

    append("</table>");

    result.timeStamp = System.currentTimeMillis();
    result.summary = buf.toString();

    return result;
  }