예제 #1
0
 private void OKPress() {
   Window owner = win.getOwner();
   if (table.isEditing()) table.removeEditor();
   if (win != null) {
     win.dispose();
     win = null;
   }
   raProcess.runChild(
       owner,
       new Runnable() {
         public void run() {
           performMatching();
         }
       });
   if (total.one == 0 && raProcess.isCompleted())
     JOptionPane.showMessageDialog(
         owner, "Nema stavaka za pokrivanje!", "Poruka", JOptionPane.INFORMATION_MESSAGE);
   else if (total.one > 0)
     JOptionPane.showMessageDialog(
         owner,
         Aus.getNumDep(
                 total.one,
                 "Pokriven " + total.one + " saldo",
                 "Pokrivena " + total.one + " salda",
                 "Pokriveno " + total.one + " salda")
             + " na ukupno "
             + Aus.getNum(total.two, "stavci.", "stavke.", "stavaka."),
         "Poruka",
         JOptionPane.INFORMATION_MESSAGE);
 }
        public void actionPerformed(ActionEvent arg0) {
          if (tabla.isEditing()) {
            tabla.getCellEditor().stopCellEditing();
          }
          Obj_Revision_Lista_Raya lista_raya = new Obj_Revision_Lista_Raya();
          lista_raya.borrar();

          Imprimir_lista_raya();
          new Cat_Imprimir_LR().setVisible(true);
        }
예제 #3
0
        public void actionPerformed(ActionEvent e) {
          int column = table.getSelectedColumn();
          int row = table.getSelectedRow();

          if (table.isEditing()) table.getCellEditor().stopCellEditing();

          if (column < 4) {
            table.changeSelection(row, column + 1, false, false);
            table.editCellAt(row, column + 1);
          }
        }
예제 #4
0
  private void CancelPress() {
    if (JOptionPane.showConfirmDialog(
            win,
            "Izlazak iz pokrivanja? " + "(Odabir se gubi)",
            "Potvrda izlaza",
            JOptionPane.OK_CANCEL_OPTION)
        == JOptionPane.CANCEL_OPTION) return;

    if (table.isEditing()) table.removeEditor();
    if (win != null) {
      win.dispose();
      win = null;
    }
  }
예제 #5
0
  public void release() {
    if (propertiesTable.isEditing()) {
      propertiesTable.getCellEditor().stopCellEditing();
    }

    propertiesModel.release();

    if (holder instanceof WsdlProject) {
      WsdlProject project = (WsdlProject) holder;
      project.removeEnvironmentListener(environmentListener);
      project.removeProjectListener(projectListener);
    }

    projectListener = null;
  }
예제 #6
0
 public void actionPerformed(ActionEvent ae) {
   Object src = ae.getSource();
   replaceTable.clearSelection();
   if (replaceTable.isEditing()) replaceTable.getCellEditor().stopCellEditing();
   if (src instanceof JComponent) {
     ((JComponent) src).requestFocusInWindow();
   }
   if (src == btEval) {
     if (apply(btEval.getActionCommand())) setVisible(false);
   } else if (src == btSub) {
     if (apply(btSub.getActionCommand())) setVisible(false);
   } else if (src == btNumeric) {
     if (apply(btNumeric.getActionCommand())) setVisible(false);
   }
 }
    @Override
    public void mouseDragged(MouseEvent e) {
      int ctrlMask = InputEvent.CTRL_DOWN_MASK;
      int action =
          ((e.getModifiersEx() & ctrlMask) == ctrlMask)
              ? TransferHandler.COPY
              : TransferHandler.MOVE;

      JTable setTable = (JTable) e.getSource();
      // 非選択状態からいきなりドラッグを開始すると cellEditor が残ってしまう問題の workaround
      if (setTable.isEditing()) {
        setTable.getCellEditor().stopCellEditing();
      }
      TransferHandler handler = setTable.getTransferHandler();
      handler.exportAsDrag(setTable, e, action);
    }
        public void actionPerformed(ActionEvent arg0) {
          if (validaCampos() != "") {
            JOptionPane.showMessageDialog(
                null,
                "El Siguiente campo es requerído:\n" + validaCampos(),
                "Error al guardar registro",
                JOptionPane.WARNING_MESSAGE,
                new ImageIcon("Iconos//critica.png"));
            return;
          } else {

            if (tabla.isEditing()) {
              tabla.getCellEditor().stopCellEditing();
            }
            new Progress_Bar_Guardar().setVisible(true);
          }
        }
  /** Event handler for this dialog. */
  public void actionPerformed(ActionEvent e) {
    // Force table to accept any partial edits.
    if (metadataTable.isEditing()) {
      metadataTable.getCellEditor().stopCellEditing();
    }

    // Apply new/modified attributes to the object.
    Map currentObjectMetadata = currentObject.getModifiableMetadata();
    Set obsoleteMetadataItems = currentObjectMetadata.keySet();
    for (int row = 0; row < metadataTable.getRowCount(); row++) {
      String name = (String) objectMetadataTableModel.getValueAt(row, 0);
      String value = (String) objectMetadataTableModel.getValueAt(row, 1);
      currentObject.addMetadata(name, value);
      obsoleteMetadataItems.remove(name);
    }
    // Remove obsolete attributes.
    Iterator obsoleteNamesIter = obsoleteMetadataItems.iterator();
    while (obsoleteNamesIter.hasNext()) {
      currentObject.removeMetadata((String) obsoleteNamesIter.next());
    }

    if (e.getSource().equals(nextObjectButton)) {
      currentObjectIndex++;
      displayObjectProperties();
    } else if (e.getSource().equals(previousObjectButton)) {
      currentObjectIndex--;
      displayObjectProperties();
    } else if ("OK".equals(e.getActionCommand())) {
      modifyActionApproved = isModifyMode();
      this.setVisible(false);
    } else if ("Cancel".equals(e.getActionCommand())) {
      modifyActionApproved = false;
      this.setVisible(false);
    } else if ("addMetadataItem".equals(e.getActionCommand())) {
      int newRowNumber = metadataTable.getRowCount() + 1;
      objectMetadataTableModel.addRow(
          new String[] {"name-" + newRowNumber, "value-" + newRowNumber});
    } else if ("removeMetadataItem".equals(e.getActionCommand())) {
      int[] rows = metadataTable.getSelectedRows();
      for (int i = rows.length - 1; i >= 0; i--) {
        int modelIndex = metadataTableSorter.modelIndex(rows[i]);
        objectMetadataTableModel.removeRow(modelIndex);
      }
    }
  }
예제 #10
0
  public void showResults(Container parent, String title) {
    Container realparent = null;

    if (parent instanceof JComponent) realparent = ((JComponent) parent).getTopLevelAncestor();
    else if (parent instanceof Window) realparent = parent;

    if (realparent instanceof Dialog) win = new JraDialog((Dialog) realparent, title, true);
    else if (realparent instanceof Frame) win = new JraDialog((Frame) realparent, title, true);
    else win = new JraDialog((Frame) null, title, true);
    win.setContentPane(contents);
    ((MatchTableModel) table.getModel()).fillData(master);
    win.pack();
    win.setLocationRelativeTo(parent);
    win.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    win.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            CancelPress();
          }
        });
    win.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == e.VK_ESCAPE) {
              CancelPress();
              e.consume();
            }
          }

          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == e.VK_A && e.getModifiers() == e.CTRL_MASK) {
              ((Action) table.getActionMap().get("selectAll")).actionPerformed(null);
              e.consume();
            }
          }
        });
    int dd = ToolTipManager.sharedInstance().getDismissDelay();
    ToolTipManager.sharedInstance().setDismissDelay(10000);
    okp.registerOKPanelKeys(win);
    table.scrollRectToVisible(new Rectangle(0, 0, 10, 10));
    if (table.isEditing()) table.removeEditor();
    win.show();
    ToolTipManager.sharedInstance().setDismissDelay(dd);
  }
예제 #11
0
 // add, find or save button
 public void buttonActionPerformed(java.awt.event.ActionEvent ae) {
   // log.debug("car button activated");
   if (ae.getSource() == findButton) {
     int rowindex = carsTableModel.findCarByRoadNumber(findCarTextBox.getText());
     if (rowindex < 0) {
       JOptionPane.showMessageDialog(
           this,
           MessageFormat.format(
               Bundle.getMessage("carWithRoadNumNotFound"),
               new Object[] {findCarTextBox.getText()}),
           Bundle.getMessage("carCouldNotFind"),
           JOptionPane.INFORMATION_MESSAGE);
       return;
     }
     // clear any sorts by column
     clearTableSort(carsTable);
     carsTable.changeSelection(rowindex, 0, false, false);
     return;
   }
   if (ae.getSource() == addButton) {
     if (f != null) {
       f.dispose();
     }
     f = new CarEditFrame();
     f.initComponents();
     f.setTitle(Bundle.getMessage("TitleCarAdd"));
   }
   if (ae.getSource() == saveButton) {
     if (carsTable.isEditing()) {
       log.debug("cars table edit true");
       carsTable.getCellEditor().stopCellEditing();
     }
     OperationsXml.save();
     saveTableDetails(carsTable);
     if (Setup.isCloseWindowOnSaveEnabled()) {
       dispose();
     }
   }
 }
예제 #12
0
    @Override
    public void update(AnActionEvent e) {
      Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
      e.getPresentation().setEnabled(false);
      if (focusOwner instanceof JComponent
          && SpeedSearchBase.hasActiveSpeedSearch((JComponent) focusOwner)) {
        return;
      }

      if (StackingPopupDispatcher.getInstance().isPopupFocused()) return;

      if (focusOwner instanceof JTree) {
        JTree tree = (JTree) focusOwner;
        if (!tree.isEditing()) {
          e.getPresentation().setEnabled(true);
        }
      } else if (focusOwner instanceof JTable) {
        JTable table = (JTable) focusOwner;
        if (!table.isEditing()) {
          e.getPresentation().setEnabled(true);
        }
      }
    }
예제 #13
0
 protected void comboBoxActionPerformed(ActionEvent ae) {
   log.debug("combobox action");
   if (table.isEditing()) {
     table.getCellEditor().stopCellEditing(); // Allows the table contents to update
   }
 }
 public void actionPerformed(ActionEvent arg0) {
   if (tabla.isEditing()) {
     tabla.getCellEditor().stopCellEditing();
   }
   guardar_lista_raya();
 }
예제 #15
0
  /** Store changes to table preferences. This method is called when the user clicks Ok. */
  public void storeSettings() {
    _prefs.putBoolean("fileColumn", fileColumn.isSelected());
    _prefs.putBoolean("pdfColumn", pdfColumn.isSelected());
    _prefs.putBoolean("urlColumn", urlColumn.isSelected());
    _prefs.putBoolean("preferUrlDoi", preferDoi.isSelected());
    _prefs.putBoolean("arxivColumn", arxivColumn.isSelected());

    _prefs.putBoolean(
        JabRefPreferences.SHOWONELETTERHEADINGFORICONCOLUMNS,
        showOneLetterHeadingForIconColumns.isSelected());

    /** * begin: special fields ** */
    boolean newSpecialFieldsEnabled = specialFieldsEnabled.isSelected(),
        newRankingColumn = rankingColumn.isSelected(),
        newCompactRankingColumn = compactRankingColumn.isSelected(),
        newQualityColumn = qualityColumn.isSelected(),
        newPriorityColumn = priorityColumn.isSelected(),
        newRelevanceColumn = relevanceColumn.isSelected(),
        newSyncKeyWords = syncKeywords.isSelected(),
        newWriteSpecialFields = writeSpecialFields.isSelected();

    boolean restartRequired = false;
    restartRequired =
        (oldSpecialFieldsEnabled != newSpecialFieldsEnabled)
            || (oldRankingColumn != newRankingColumn)
            || (oldCompcatRankingColumn != newCompactRankingColumn)
            || (oldQualityColumn != newQualityColumn)
            || (oldPriorityColumn != newPriorityColumn)
            || (oldRelevanceColumn != newRelevanceColumn)
            || (oldSyncKeyWords != newSyncKeyWords)
            || (oldWriteSpecialFields != newWriteSpecialFields);
    if (restartRequired) {
      JOptionPane.showMessageDialog(
          null,
          Globals.lang("You have changed settings for special fields.")
              .concat(" ")
              .concat(Globals.lang("You must restart JabRef for this to come into effect.")),
          Globals.lang("Changed special field settings"),
          JOptionPane.WARNING_MESSAGE);
    }

    // restart required implies that the settings have been changed
    // the seetings need to be stored
    if (restartRequired) {
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED, newSpecialFieldsEnabled);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING, newRankingColumn);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_RANKING_COMPACT, newCompactRankingColumn);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY, newPriorityColumn);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY, newQualityColumn);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE, newRelevanceColumn);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS, newSyncKeyWords);
      _prefs.putBoolean(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS, newWriteSpecialFields);
    }

    /** * end: special fields ** */
    if (colSetup.isEditing()) {
      int col = colSetup.getEditingColumn(), row = colSetup.getEditingRow();
      colSetup.getCellEditor(row, col).stopCellEditing();
    }

    // _prefs.putStringArray("columnNames", getChoices());
    /*String[] cols = tableFields.getText().replaceAll("\\s+","")
        .replaceAll("\\n+","").toLowerCase().split(";");
    if (cols.length > 0) for (int i=0; i<cols.length; i++)
        cols[i] = cols[i].trim();
        else cols = null;*/

    // Now we need to make sense of the contents the user has made to the
    // table setup table.
    if (tableChanged) {
      // First we remove all rows with empty names.
      int i = 0;
      while (i < tableRows.size()) {
        if (tableRows.elementAt(i).name.equals("")) tableRows.removeElementAt(i);
        else i++;
      }
      // Then we make arrays
      String[] names = new String[tableRows.size()], widths = new String[tableRows.size()];
      int[] nWidths = new int[tableRows.size()];

      _prefs.putInt("numberColWidth", ncWidth);
      for (i = 0; i < tableRows.size(); i++) {
        TableRow tr = tableRows.elementAt(i);
        names[i] = tr.name.toLowerCase();
        nWidths[i] = tr.length;
        widths[i] = "" + tr.length;
        // Util.pr(names[i]+"   "+widths[i]);
      }

      // Finally, we store the new preferences.
      _prefs.putStringArray("columnNames", names);
      _prefs.putStringArray("columnWidths", widths);
    }
  }