示例#1
0
  private void doShowServerTips(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnResetDrawerActionPerformed

    Job job =
        new Job() {
          @Override
          public Object run() {
            try {
              setGlassPaneVisible(true);

              JPanel panel = new JPanel(new MigLayout());
              List<User> users = UserDAO.getInstance().findAll();

              JXDatePicker fromDatePicker = UiUtil.getCurrentMonthStart();
              JXDatePicker toDatePicker = UiUtil.getCurrentMonthEnd();

              panel.add(new JLabel(com.floreantpos.POSConstants.SELECT_USER + ":"), "grow");
              JComboBox userCombo = new JComboBox(new ListComboBoxModel(users));
              panel.add(userCombo, "grow, wrap");
              panel.add(new JLabel(com.floreantpos.POSConstants.FROM + ":"), "grow");
              panel.add(fromDatePicker, "wrap");
              panel.add(new JLabel(com.floreantpos.POSConstants.TO_), "grow");
              panel.add(toDatePicker);

              int option =
                  JOptionPane.showOptionDialog(
                      ManagerDialog.this,
                      panel,
                      com.floreantpos.POSConstants.SELECT_CRIETERIA,
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE,
                      null,
                      null,
                      null);
              if (option != JOptionPane.OK_OPTION) {
                return null;
              }

              GratuityDAO gratuityDAO = new GratuityDAO();
              TipsCashoutReport report =
                  gratuityDAO.createReport(
                      fromDatePicker.getDate(),
                      toDatePicker.getDate(),
                      (User) userCombo.getSelectedItem());

              TipsCashoutReportDialog dialog =
                  new TipsCashoutReportDialog(report, ManagerDialog.this, false);
              dialog.setSize(400, 600);
              dialog.open();
            } catch (Exception e) {
              POSMessageDialog.showError(com.floreantpos.POSConstants.ERROR_MESSAGE, e);
            } finally {
              setGlassPaneVisible(false);
            }
            return null;
          }
        };
    Worker.post(job);
  } // GEN-LAST:event_btnResetDrawerActionPerformed
示例#2
0
 private void btnOpenTicketsActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnOpenTicketsActionPerformed
   Job job =
       new Job() {
         @Override
         public Object run() {
           try {
             setGlassPaneVisible(true);
             OpenTicketsListDialog dialog = new OpenTicketsListDialog(ManagerDialog.this, true);
             dialog.open();
           } catch (Exception e) {
             POSMessageDialog.showError(com.floreantpos.POSConstants.ERROR_MESSAGE, e);
           } finally {
             setGlassPaneVisible(false);
           }
           return null;
         }
       };
   Worker.post(job);
 } // GEN-LAST:event_btnOpenTicketsActionPerformed
  /**
   * Set the selected link
   *
   * @param link
   */
  public void setLink(final ILink link) {
    WaitIndicator waitIndicator =
        new LabeledSpinningDialWaitIndicator(this, "Loading " + link.getToConcept() + " ...");
    getLinkNameTextField().setText(link.getLinkName());
    getLinkValueTextField().setText(link.getLinkValue());
    final HierachicalConceptNameComboBox comboBox = getToConceptComboBox();
    comboBox.hidePopup();
    getLinksComboBox().hidePopup();
    String conceptName = link.getToConcept();

    if (conceptName.equals(ILink.VALUE_NIL) || conceptName.equals(ILink.VALUE_SELF)) {
      SortedComboBoxModel<String> model = (SortedComboBoxModel<String>) comboBox.getModel();
      model.clear();
      model.addElement(conceptName);
    } else {

      // Retrieve the child concepts and add to gui
      try {
        final Concept c =
            (Concept)
                Worker.post(
                    new Task() {
                      @Override
                      public Object run() throws Exception {
                        return annotationPersistenceService.findConceptByName(link.getToConcept());
                      }
                    });
        comboBox.setConcept(c);
        conceptName = c.getPrimaryConceptName().getName();

      } catch (final Exception e) {
        EventBus.publish(GlobalLookup.TOPIC_NONFATAL_ERROR, e);
        comboBox.addItem(conceptName);
      }
    }

    comboBox.setSelectedItem(conceptName);
    waitIndicator.dispose();
    repaint();
  }
示例#4
0
 private void showDrawerPullReport() {
   Job job =
       new Job() {
         @Override
         public Object run() {
           try {
             setGlassPaneVisible(true);
             DrawerPullReportDialog dialog = new DrawerPullReportDialog(ManagerDialog.this, true);
             dialog.setTitle(com.floreantpos.POSConstants.DRAWER_PULL);
             dialog.initialize();
             dialog.setSize(430, 500);
             dialog.setResizable(false);
             dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
             dialog.open();
           } catch (Exception e) {
             POSMessageDialog.showError(com.floreantpos.POSConstants.ERROR_MESSAGE, e);
           } finally {
             setGlassPaneVisible(false);
           }
           return null;
         }
       };
   Worker.post(job);
 }