/**
   * Creates new form FortfuehrungsanlaesseDialog.
   *
   * @param parent DOCUMENT ME!
   * @param modal DOCUMENT ME!
   */
  private FortfuehrungsanlaesseDialog(final Frame parent, final boolean modal) {
    super(parent, modal);

    initComponents();

    final Highlighter istAbgearbeitetHighlighter = new IstAbgearbeitetHighlighter();
    jXTable1.setHighlighters(istAbgearbeitetHighlighter);

    jXTable1.setModel(new FortfuehrungenTableModel());

    jXTable1
        .getColumnModel()
        .getColumn(0)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));
    jXTable1
        .getColumnModel()
        .getColumn(1)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));
    jXTable1
        .getColumnModel()
        .getColumn(2)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));

    jXTable1.getColumnModel().getColumn(0).setPreferredWidth(100);
    jXTable1.getColumnModel().getColumn(1).setPreferredWidth(150);
    jXTable1.getColumnModel().getColumn(2).setPreferredWidth(200);

    jXTable1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jXTable1.setDragEnabled(false);

    jXTable1.getTableHeader().setResizingAllowed(true);
    jXTable1.getTableHeader().setReorderingAllowed(false);
    // jXTable1.setSortOrder(1, SortOrder.ASCENDING);

    jXTable1
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(final ListSelectionEvent e) {
                // If cell selection is enabled, both row and column change events are fired
                if ((e.getSource() == jXTable1.getSelectionModel())
                    && jXTable1.getRowSelectionAllowed()) {
                  fortfuehrungsTableListSelectionChanged(e);
                }
              }
            });

    jProgressBar1.setVisible(false);
  }
  public void EVENT_moveBottom(ActionEvent e) {
    int selection[] = table.getSelectedRows();

    int offset = 0;
    if (selection != null && selection.length > 0) {
      for (int i : selection) {
        DownloadWrapper dw = rows.get(i - offset);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveBottom(d);
                  }
                });
        moveBottom(i - offset, dw);
        offset++;
      }
      model.fireTableStructureChanged();
      // for(int i : selection) if (i<rows.size()-1)
      // table.getSelectionModel().addSelectionInterval(i+1,i+1);
      ListSelectionModel sm = table.getSelectionModel();
      sm.addSelectionInterval(rows.size() - selection.length, rows.size() - 1);
    }
  }
  public void EVENT_moveTop(ActionEvent e) {
    int selection[] = table.getSelectedRows();
    int offset = 0;
    if (selection != null && selection.length > 0) {
      for (int j = selection.length - 1; j >= 0; j--) {
        int i = selection[j];
        DownloadWrapper dw = rows.get(i + offset);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveTop(d);
                  }
                });
        moveTop(i + offset, dw);
        offset++;
      }
      model.fireTableStructureChanged();
      // for(int i : selection) if (i>0) table.getSelectionModel().addSelectionInterval(i-1,i-1);
      table.getSelectionModel().addSelectionInterval(0, selection.length - 1);
    }
  }
  public void EVENT_moveUp(ActionEvent e) {
    int selection[] = table.getSelectedRows();
    if (selection != null && selection.length > 0) {
      for (int i : selection) {
        DownloadWrapper dw = rows.get(i);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveUp(d);
                  }
                });
        moveUp(i, dw);
      }
      model.fireTableStructureChanged();
      for (int i : selection) {
        if (i > 0) {
          table.getSelectionModel().addSelectionInterval(i - 1, i - 1);
        }
      }
    }
  }
  public static void main(String[] args) {
    TranslationTableModel model = new TranslationTableModel(new File("conf/localization/pt"));
    JXTable table = new JXTable(model);
    table.setRowSelectionAllowed(true);
    JScrollPane scroll = new JScrollPane(table);
    GuiUtils.testFrame(scroll);

    Vector<Integer> searchResults = model.search("PLUGINNAME");

    for (int i : searchResults) {
      table.getSelectionModel().addSelectionInterval(i, i);
    }
  }
Пример #6
0
  public InventoryController(App view, final Connection connection) {
    this.view = view;
    model = new InventoryModel(connection);
    addItem = new AddItem();

    iSupplierList = addItem.getiSupplierList();
    iProductLineList = addItem.getiProductLineList();
    iSupplierCodeText = addItem.getiSupplierCodeText();
    iUnitPriceText = addItem.getiUnitPriceText();
    iSellingPriceText = addItem.getiSellingPriceText();
    iQtyText = addItem.getiQtyText();
    iThresholdText = addItem.getiThresholdText();
    iCharacteristics = addItem.getiCharacteristicsText();
    iModelText = addItem.getiModelText();
    iDescriptionText = addItem.getiDescriptionText();
    iSearchField = view.getiSearchField();
    iProductsTable = view.getiProductsTable();
    tableModel = (DefaultTableModel) iProductsTable.getModel();
    selectionModel = (ListSelectionModel) iProductsTable.getSelectionModel();
    iProductName = view.getiProductName();
    iItemNumber = view.getiItemNo();
    iAddMotoCode = view.getiAddMotoCode();
    iProductLine = view.getiProductLine();
    iItemDescription = view.getiItemDescription();
    iOnHandQuantity = view.getiOnHandQuantity();
    iStatus = view.getiStatus();
    iSupplier = view.getiSupplier();
    iShowHistory = view.getiShowHistory();
    iEditUpdateRSP = view.getiEditUpdateRSP();
    iEditUpdateUC = view.getiEditUpdateUC();
    iEditUpdateQT = view.getiEditUpdateQT();
    iCancelRSP = view.getiCancelRSP();
    iCancelUC = view.getiCancelUC();
    iCancelQT = view.getiCancelQT();
    iSellingPrice = view.getiSellingPrice();
    iSellingPrice.setDisabledTextColor(Color.BLACK);
    iUnitCost = view.getiUnitCost();
    iUnitCost.setDisabledTextColor(Color.BLACK);
    iQtyThreshold = view.getiThreshold();
    iQtyThreshold.setDisabledTextColor(Color.BLACK);
    iAddNew = view.getiAddNew();
    iAddNewPLine = view.getiAddNewPLine();

    setDefaultViews();
    populate();
    setListeners();
  }
Пример #7
0
  public JLoadTestAssertionsTable(WsdlLoadTest wsdlLoadTest) {
    super(new BorderLayout());
    this.loadTest = wsdlLoadTest;

    loadTest.addLoadTestListener(internalLoadTestListener);

    tableModel = new LoadTestAssertionsTableModel();
    table = new JXTable(tableModel);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(16);
    columnModel.getColumn(0).setCellRenderer(new IconTableCellRenderer());
    columnModel.getColumn(1).setPreferredWidth(100);
    columnModel.getColumn(2).setPreferredWidth(100);
    columnModel.getColumn(3).setPreferredWidth(200);

    JScrollPane scrollPane = new JScrollPane(table);
    add(scrollPane, BorderLayout.CENTER);

    table.addMouseListener(
        new MouseAdapter() {

          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() < 2) return;

            int ix = table.getSelectedRow();
            if (ix == -1) return;
            ix = table.convertRowIndexToModel(ix);

            Object obj = loadTest.getAssertionAt(ix);
            if (obj instanceof Configurable) {
              ((Configurable) obj).configure();
            } else Toolkit.getDefaultToolkit().beep();
          }
        });

    add(buildToolbar(), BorderLayout.NORTH);

    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              public void valueChanged(ListSelectionEvent e) {
                int ix = table.getSelectedRow();

                configureAssertionAction.setEnabled(ix >= 0);
                removeAssertionAction.setEnabled(ix >= 0);

                if (ix == -1) return;

                ix = table.convertRowIndexToModel(ix);
                configureAssertionAction.setEnabled(
                    loadTest.getAssertionAt(ix) instanceof Configurable);
              }
            });

    assertionPopup = new JPopupMenu();
    assertionPopup.add(configureAssertionAction);
    assertionPopup.addSeparator();
    assertionPopup.add(addLoadTestAssertionAction);
    assertionPopup.add(removeAssertionAction);

    setComponentPopupMenu(assertionPopup);

    scrollPane.setInheritsPopupMenu(true);
    table.setComponentPopupMenu(assertionPopup);
  }
  public DownloadsMDIWindow(final UISubsystem ui) throws Exception {
    super(ui.getMainWindow().getMDIManager(), "downloads", ui);

    table = new JXTable();
    table.setModel(model = new DownloadsTableModel());
    table.setAutoCreateColumnsFromModel(false);
    table.getColumnModel().getColumn(1).setCellRenderer(new ProgressBarCellRenderer());
    table.getColumnModel().getColumn(0).setPreferredWidth(300);
    table.getColumnModel().getColumn(1).setPreferredWidth(80);

    status = (JLabel) xui.getComponent("status");
    downloadingFromText = (JLabel) xui.getComponent("downloadingfromtext");
    uploadingToText = (JLabel) xui.getComponent("uploadingtotext");

    setFixedColumnSize(table.getColumnModel().getColumn(2), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(3), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(4), 60);
    setFixedColumnSize(table.getColumnModel().getColumn(5), 10);

    table.setColumnControlVisible(true);

    downloadGrid = (JDownloadGrid) xui.getComponent("downloadgrid");
    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                if (e.getFirstIndex() < 0 || e.getFirstIndex() >= rows.size()) {
                  downloadGrid.setDownload(null);
                  updateDownloadingFromAndUploadingToText();
                  return;
                }
                selectDownloadToShowOnDownloadGrid();
                updateDownloadingFromAndUploadingToText();
              }
            });

    table.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseReleased(MouseEvent e) {
            maybeShowPopup(e);
          }

          @Override
          public void mousePressed(MouseEvent e) {
            maybeShowPopup(e);
          }

          @Override
          public void mouseClicked(MouseEvent e) {}

          private void maybeShowPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
              int row = table.rowAtPoint(e.getPoint());
              boolean b = false;
              for (int r : table.getSelectedRows()) {
                if (r == row) {
                  b = true;
                  break;
                }
              }
              if (!b) {
                table.getSelectionModel().setSelectionInterval(row, row);
              }
              popup.show(e.getComponent(), e.getX(), e.getY());
            }
          }
        });

    //        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setColumnSelectionAllowed(false);

    ((JScrollPane) xui.getComponent("scroll")).setViewportView(table);

    popup = (JPopupMenu) xui.getComponent("popup");

    update();

    setTitle("Downloads");
    listenExternalLinks();
    postInit();
  }
Пример #9
0
  public AttachmentsView(@Service ApplicationContext context, @Uses AttachmentsModel model) {
    setLayout(new BorderLayout());

    final ActionMap am = context.getActionMap(this);

    this.attachmentsModel = model;
    TableFormat tableFormat = new AttachmentsTableFormatter();
    tableModel = new EventJXTableModel<AttachmentDTO>(attachmentsModel.getEventList(), tableFormat);

    attachments = new JXTable(tableModel);

    attachments.setFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
        KeyboardFocusManager.getCurrentKeyboardFocusManager()
            .getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    attachments.setFocusTraversalKeys(
        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
        KeyboardFocusManager.getCurrentKeyboardFocusManager()
            .getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));

    attachments.getColumn(0).setPreferredWidth(20);
    attachments.getColumn(0).setMaxWidth(20);
    attachments.getColumn(0).setResizable(false);
    attachments.getColumn(2).setPreferredWidth(100);
    attachments.getColumn(2).setMaxWidth(100);
    attachments.getColumn(3).setPreferredWidth(100);
    attachments.getColumn(3).setMaxWidth(100);

    attachments.setAutoCreateColumnsFromModel(false);

    attachments.addHighlighter(HighlighterFactory.createAlternateStriping());

    attachments.setModel(tableModel);
    attachments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JPanel toolbar = new JPanel();
    StreamflowButton addButton = new StreamflowButton(am.get("add"));
    toolbar.add(addButton);
    StreamflowButton removeButton = new StreamflowButton(am.get("remove"));
    toolbar.add(removeButton);
    final StreamflowButton openButton = new StreamflowButton(am.get("open"));
    toolbar.add(openButton);
    attachments
        .getSelectionModel()
        .addListSelectionListener(new SelectionActionEnabler(am.get("open")));
    attachments
        .getSelectionModel()
        .addListSelectionListener(
            new SelectionActionEnabler(am.get("remove")) {

              @Override
              public boolean isSelectedValueValid(javax.swing.Action action) {
                return !attachments
                    .getValueAt(attachments.convertRowIndexToModel(attachments.getSelectedRow()), 0)
                    .equals(Icons.formSubmitted);
              }
            });

    attachmentsModel.addObserver(
        new RefreshComponents().visibleOn("createattachment", addButton, removeButton));

    attachments.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "open");
    attachments.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "remove");
    attachments.setActionMap(am);

    attachments.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent me) {
            int obj = attachments.getSelectedRow();
            if (obj == -1) return;
            if (me.getClickCount() == 2) {
              am.get("open")
                  .actionPerformed(
                      new ActionEvent(openButton, ActionEvent.ACTION_PERFORMED, "open"));
              me.consume();
            }
          }
        });

    attachments
        .getColumn(0)
        .setCellRenderer(
            new DefaultTableCellRenderer() {
              @Override
              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {

                JLabel iconLabel = new JLabel(" ");
                switch ((Icons) value) {
                  case attachments:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;

                  case conversations:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;

                  case formSubmitted:
                    iconLabel = new JLabel(i18n.icon((Icons) value, 11));
                    break;
                }

                iconLabel.setOpaque(true);

                if (isSelected) iconLabel.setBackground(attachments.getSelectionBackground());
                return iconLabel;
              }
            });

    JScrollPane attachmentsScrollPane = new JScrollPane(attachments);

    add(attachmentsScrollPane, BorderLayout.CENTER);
    add(toolbar, BorderLayout.SOUTH);

    new RefreshWhenShowing(this, attachmentsModel);
  }