Ejemplo n.º 1
0
  public TimelimitTaskController(Preferences prefsParent, TimelimitTaskDelegate tltaskDelegate) {
    super();

    this.timelimittaskview = new TimelimitTaskView();
    this.timelimittaskview.init();
    this.tltaskDelegate = tltaskDelegate;
    this.popupTimelimit = new TimelimitTasksPopupMenu(timelimittaskview);
    this.prefs = prefsParent.node(PREFS_NODE_TIMELIMITTASKS);

    this.timelimittaskview.setTimelimitTaskTableModel(newTimelimitTaskTableModel());

    final JTable tblTimelimit = timelimittaskview.getTable();
    tblTimelimit.setTableHeader(
        new ToolTipsTableHeader(
            this.timelimittaskview.getTimelimitTaskTableModel(), tblTimelimit.getColumnModel()));
    TableUtils.addMouseListenerForSortingToTableHeader(
        tblTimelimit,
        this.timelimittaskview.getTimelimitTaskTableModel(),
        new CommonRunnable() {
          @Override
          public void run() {
            timelimittaskview.getTimelimitTaskTableModel().sort();
            storeOrderBySelectedColumnToPreferences();
          }
        });

    /** todo calculate row height */
    tblTimelimit.setRowHeight(20);

    setupRenderers(tblTimelimit);
    setupColumnModelListener(tblTimelimit);
    setupActions(tblTimelimit);
    setupDataTransfer(tblTimelimit);
    setupTableModelSorting();

    KeyBinding keybinding = KeyBindingProvider.REFRESH;
    this.timelimittaskview
        .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(keybinding.getKeystroke(), keybinding.getKey());
    this.timelimittaskview
        .getActionMap()
        .put(
            keybinding.getKey(),
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                TimelimitTaskController.this.cmdRefreshTimelimitTaskView();
              }
            });
  }
Ejemplo n.º 2
0
  public boolean run(String sDialogTitle, java.util.List<SortedRuleVO> excludeRules)
      throws RemoteException {
    this.pnlRules = new InsertRulePanel();

    final SelectRuleTableModel tblmodel = new SelectRuleTableModel();
    tblmodel.setExcludeRules(excludeRules);
    pnlRules.setModel(tblmodel);
    TableUtils.setPreferredColumnWidth(pnlRules.getTblRules(), 10, 10);

    final JOptionPane optionPane =
        new JOptionPane(pnlRules, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    optionPane.setInitialValue(null);
    pnlRules
        .getTblRules()
        .addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() > 1) {
                  optionPane.setValue(JOptionPane.OK_OPTION);
                }
              }
            });
    final JDialog dlg =
        optionPane.createDialog(
            getParent(),
            getSpringLocaleDelegate().getMessage("InsertRuleController.1", "Regelauswahl"));
    dlg.setResizable(true);
    dlg.setVisible(true);
    boolean result = false;
    if (optionPane.getValue() != null) {
      final int iBtn = (Integer) optionPane.getValue();
      result = (iBtn == JOptionPane.OK_OPTION);
    }
    return result;
  }
Ejemplo n.º 3
0
 private void fitFixedTable() {
   TableUtils.setOptimalColumnWidth(tblSelectedColumn, 1);
 }