Esempio n. 1
0
  private void cmdPerformTimelimitTask(TimelimitTaskView taskview) {
    final List<TimelimitTaskVO> collSelectedTimilimitTasks = getSelectedTimelimitTasks(taskview);

    if (!collSelectedTimilimitTasks.isEmpty() && collSelectedTimilimitTasks != null) {
      UIUtils.runCommandForTabbedPane(
          this.getTabbedPane(),
          new CommonRunnable() {
            @Override
            public void run() throws CommonBusinessException {
              final Collection<Integer> collGenericObjectIds = new ArrayList<Integer>();

              Integer iCommonModuleId = new Integer(0);
              for (TimelimitTaskVO tovo : collSelectedTimilimitTasks) {
                collGenericObjectIds.add(tovo.getGenericObjectId().intValue());
                if (iCommonModuleId != null && !iCommonModuleId.equals(tovo.getModuleId())) {
                  if (iCommonModuleId.equals(0)) {
                    iCommonModuleId = tovo.getModuleId();
                  } else {
                    iCommonModuleId = null;
                  }
                }
              }

              if (collGenericObjectIds.size() == 1) {
                final GenericObjectCollectController ctlGenericObject =
                    NuclosCollectControllerFactory.getInstance()
                        .newGenericObjectCollectController(
                            iCommonModuleId,
                            null,
                            ClientParameterProvider.getInstance()
                                .getValue(ParameterProvider.KEY_LAYOUT_CUSTOM_KEY));
                ctlGenericObject.runViewSingleCollectableWithId(
                    collGenericObjectIds.iterator().next());
              } else if (iCommonModuleId != null && iCommonModuleId != 0) {
                final GenericObjectCollectController ctlGenericObject =
                    NuclosCollectControllerFactory.getInstance()
                        .newGenericObjectCollectController(
                            iCommonModuleId,
                            null,
                            ClientParameterProvider.getInstance()
                                .getValue(ParameterProvider.KEY_LAYOUT_CUSTOM_KEY));
                ctlGenericObject.runViewResults(
                    getSearchConditionForRelatedObjects(collGenericObjectIds));
              }
            }
          });
    } else {
      final String sMessage =
          getSpringLocaleDelegate()
              .getMessage("TimelimitTaskController.6", "Dieser Frist ist kein Objekt zugeordnet.");
      JOptionPane.showMessageDialog(
          taskview,
          sMessage,
          getSpringLocaleDelegate()
              .getMessage("TimelimitTaskController.18", "Zugeordnetes Objekt anzeigen"),
          JOptionPane.ERROR_MESSAGE);
    }
  }
Esempio n. 2
0
 private void cmdPrintTimelimitTaskView() {
   UIUtils.runCommandForTabbedPane(
       this.getTabbedPane(),
       new Runnable() {
         @Override
         public void run() {
           printTimelimitTaskView();
         }
       });
 }
Esempio n. 3
0
  /**
   * removes the currently selected tasks
   *
   * @param taskview
   * @param bRefresh Refresh the lists afterwards?
   */
  private void cmdRemoveTimelimitTask(TimelimitTaskView taskview, final boolean bRefresh) {
    final List<TimelimitTaskVO> lstSelectedTimelimitTasks = getSelectedTimelimitTasks(taskview);

    if (!lstSelectedTimelimitTasks.isEmpty() && lstSelectedTimelimitTasks != null) {
      final String sMessage;
      if (lstSelectedTimelimitTasks.size() == 1)
        sMessage =
            getSpringLocaleDelegate()
                    .getMessage(
                        "TimelimitTaskController.14",
                        "Wollen Sie den ausgew\u00e4hlten Eintrag wirklich l\u00f6schen?")
                + "\n";
      else
        sMessage =
            getSpringLocaleDelegate()
                    .getMessage(
                        "TimelimitTaskController.15",
                        "Wollen Sie die ausgew\u00e4hlten Eintr\u00e4ge wirklich l\u00f6schen?")
                + "\n";

      final int btn =
          JOptionPane.showConfirmDialog(
              this.getTabbedPane().getComponentPanel(),
              sMessage,
              getSpringLocaleDelegate()
                  .getMessage("TimelimitTaskController.8", "Eintr\u00e4ge l\u00f6schen"),
              JOptionPane.YES_NO_OPTION);

      if (btn == JOptionPane.YES_OPTION) {
        UIUtils.runCommandForTabbedPane(
            this.getTabbedPane(),
            new Runnable() {
              @Override
              public void run() {
                try {
                  for (TimelimitTaskVO taskvo : lstSelectedTimelimitTasks)
                    TimelimitTaskController.this.tltaskDelegate.remove(taskvo);
                } catch (CommonBusinessException ex) {
                  Errors.getInstance().showExceptionDialog(getTabbedPane().getComponentPanel(), ex);
                }
                if (bRefresh) {
                  refreshTimelimitTaskView();
                }
              }
            });
      }
    }
  }
Esempio n. 4
0
  public void cmdShowTimelimitTasks() {
    if (tab == null) {
      UIUtils.runCommandForTabbedPane(
          this.getTabbedPane(),
          new Runnable() {
            @Override
            public void run() {
              try {
                showTimelimitTasks(new MainFrameTab());
                MainFrame.addTab(tab);
              } catch (Exception e) {
                LOG.error("cmdShowTimelimitTasks failed: " + e, e);
              }
            }
          });
    }

    MainFrame.setSelectedTab(tab);
  }
Esempio n. 5
0
 /**
  * finishes the selected tasks
  *
  * @param taskview
  * @param bRefresh Refresh the lists afterwards?
  */
 private void cmdFinishTimelimitTask(final TimelimitTaskView taskview, final boolean bRefresh) {
   final List<TimelimitTaskVO> lstSelectedTimelimitTasks = getSelectedTimelimitTasks(taskview);
   if (!lstSelectedTimelimitTasks.isEmpty() && lstSelectedTimelimitTasks != null) {
     UIUtils.runCommandForTabbedPane(
         this.getTabbedPane(),
         new Runnable() {
           @Override
           public void run() {
             try {
               for (TimelimitTaskVO taskvo : lstSelectedTimelimitTasks)
                 taskvo = tltaskDelegate.finish(taskvo);
               if (bRefresh) {
                 refreshTimelimitTaskView();
               }
             } catch (/* CommonBusiness */ Exception ex) {
               Errors.getInstance().showExceptionDialog(getTabbedPane().getComponentPanel(), ex);
             }
           }
         });
   }
 }
Esempio n. 6
0
  /**
   * "unfinishes" the selected tasks
   *
   * @param taskview
   * @param bRefresh Refresh the lists afterwards?
   */
  private void cmdUnfinishTimelimitTask(final TimelimitTaskView taskview, final boolean bRefresh) {
    final List<TimelimitTaskVO> lstSelectedTimelimitTasks = getSelectedTimelimitTasks(taskview);
    if (!lstSelectedTimelimitTasks.isEmpty() && lstSelectedTimelimitTasks != null) {

      final String sMessage =
          getSpringLocaleDelegate()
              .getMessage(
                  "TimelimitTaskController.12",
                  "Soll(en) die ausgew\u00e4hlte(n) Frist(e) als unerledigt markiert werden?");
      final int iBtn =
          JOptionPane.showConfirmDialog(
              this.getTabbedPane().getComponentPanel(),
              sMessage,
              getSpringLocaleDelegate()
                  .getMessage("TimelimitTaskController.9", "Friste als unerledigt markieren"),
              JOptionPane.YES_NO_OPTION);
      if (iBtn == JOptionPane.YES_OPTION) {
        UIUtils.runCommandForTabbedPane(
            this.getTabbedPane(),
            new Runnable() {
              @Override
              public void run() {
                try {
                  for (TimelimitTaskVO taskvo : lstSelectedTimelimitTasks)
                    tltaskDelegate.unfinish(taskvo);
                  if (bRefresh) {
                    refreshTimelimitTaskView();
                  }
                } catch (/* CommonBusiness */ Exception ex) {
                  Errors.getInstance().showExceptionDialog(getTabbedPane().getComponentPanel(), ex);
                }
              }
            });
      } else {
        // undo selection of the button:
        timelimittaskview.getFinishButton().setSelected(false);
      }
    }
  }
Esempio n. 7
0
/**
 * An <code>ExplorerView</code> displays one tree in a tab of an <code>ExplorerPanel</code>. <br>
 * <br>
 * Created by Novabit Informationssysteme GmbH <br>
 * Please visit <a href="http://www.novabit.de">www.novabit.de</a>
 *
 * @author <a href="mailto:[email protected]">Christoph.Radig</a>
 * @version 01.00.00
 */
public class DefaultExplorerView extends JPanel implements ExplorerView {

  public static final int FADE = 2;

  private final JToolBar toolBar = UIUtils.createNonFloatableToolBar();

  private List<JComponent> additionalToolBarContents;

  private final JPanel content =
      new JPanel(new BorderLayout()) {

        @Override
        public void paint(Graphics g) {
          Graphics2D g2 = (Graphics2D) g;
          g2.setPaint(
              new GradientPaint(0, 0, NuclosThemeSettings.BACKGROUND_PANEL, 0, FADE, Color.WHITE));
          g2.fillRect(0, 0, getWidth(), getHeight());

          super.paint(g);
        }
      };

  private final JScrollPane scrlpn = new JScrollPane();

  private final JTree tree;

  /**
   * creates an explorer view
   *
   * @param tree
   */
  public DefaultExplorerView(TreeNode tn) {
    super(new BorderLayout());
    this.setOpaque(false);
    this.setBorder(BorderFactory.createEmptyBorder());

    this.scrlpn.setBorder(BorderFactory.createEmptyBorder());
    this.scrlpn.setOpaque(false);
    this.scrlpn.getViewport().setOpaque(false);

    this.content.setOpaque(true);
    this.content.setBackground(new Color(0, 0, 0, 0));
    this.content.setBorder(BorderFactory.createEmptyBorder(FADE, 0, 0, 0));
    this.content.add(this.scrlpn, BorderLayout.CENTER);

    this.add(this.toolBar, BorderLayout.NORTH);
    this.add(this.content, BorderLayout.CENTER);

    final ExplorerNode<?> explorernodeRoot = ExplorerController.newExplorerTree(tn);
    this.tree = new JTree(explorernodeRoot, true);

    this.tree.putClientProperty("JTree.lineStyle", "Angled");
    this.tree.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
    this.tree.setBackground(Color.WHITE);
    this.tree.setRootVisible(true);
    this.tree.setShowsRootHandles(true);

    // enable drag:
    this.tree.setDragEnabled(true);
    this.tree.setTransferHandler(new DefaultTransferHandler(Main.getInstance().getMainFrame()));

    // don't expand on double click:
    this.tree.setToggleClickCount(0);

    this.tree.addKeyListener(new DefaultKeyListener(tree));
    this.tree.addMouseListener(new DefaultMouseListener(tree));

    // enable tool tips:
    ToolTipManager.sharedInstance().registerComponent(this.tree);

    this.tree.setCellRenderer(new ExplorerNodeRenderer());
    this.tree.addTreeWillExpandListener(new DefaultTreeWillExpandListener(tree));

    this.scrlpn.getViewport().add(tree, null);
  }

  protected void init() {
    for (JComponent c : getToolBarComponents()) {
      toolBar.add(c);
    }
  }

  protected List<JComponent> getToolBarComponents() {
    List<JComponent> components = new ArrayList<JComponent>();
    components.add(
        new JButton(
            new AbstractAction("", Icons.getInstance().getIconRefresh16()) {

              @Override
              public void actionPerformed(ActionEvent e) {
                UIUtils.runCommand(
                    DefaultExplorerView.this.getParent(),
                    new CommonRunnable() {
                      @Override
                      public void run() throws CommonFinderException {
                        Main.getInstance()
                            .getMainController()
                            .getExplorerController()
                            .refreshTab(DefaultExplorerView.this);
                      }
                    });
              }
            }));
    return components;
  }

  /** @return the JTree contained in this ExplorerView */
  public JTree getJTree() {
    return tree;
  }

  /** @return the root ExplorerNode contained in this view */
  public ExplorerNode<?> getRootNode() {
    return (ExplorerNode<?>) this.getJTree().getModel().getRoot();
  }

  @Override
  public JComponent getViewComponent() {
    return this;
  }
} // class ExplorerView