public void actionPerformed(ActionEvent e) {
   try {
     synchronized (accessLock) {
       Iterator iterator = buttons.iterator();
       while (iterator.hasNext()) {
         SearchButton searchButton = (SearchButton) iterator.next();
         searchButton.updateButtonDisplay();
       }
     }
   } catch (Throwable th) {
     NLogger.error(SearchInfoBox.class, th, th);
   }
 }
 public void setDisplayedSearch(SearchResultsDataModel searchResultsDataModel) {
   if (displayedDataModel != searchResultsDataModel) {
     displayedDataModel = searchResultsDataModel;
     if (searchResultsDataModel != null) {
       Search search = searchResultsDataModel.getSearch();
       SearchButton btn = searchButtonMap.get(search);
       if (btn != null) { // button might not be available yet since its created delayed on
         // event thread.
         btn.setSelected(true);
       }
     } else {
       notSelectedButton.setSelected(true);
     }
   }
 }
  private void addSearch(Search search) {
    SearchButton btn = new SearchButton(search, searchTab);
    btn.addActionListener(buttonHandler);

    synchronized (accessLock) {
      searchButtonMap.put(search, btn);
      searchButtonGroup.add(btn);
      addButton(btn);
    }

    if (displayedDataModel != null
        && search == displayedDataModel.getSearch()) { // select the button of the displayed model
      btn.setSelected(true);
    }
  }
    public void actionPerformed(ActionEvent e) {
      try {
        SearchButton searchButton = ((SearchButton) e.getSource());

        searchButton.updateButtonDisplay();
        searchTab.refreshTabActions();
        Search search = searchButton.getSearch();
        if (search == null) {
          return;
        }
        SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search);
        searchTab.setDisplayedSearch(dataModel);
      } catch (Exception exp) { // catch all handler
        NLogger.error(ButtonHandler.class, exp, exp);
      }
    }
Example #5
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    NavigationLabel = new javax.swing.JLabel();
    jPanel6 = new javax.swing.JPanel();
    CancelButton = new javax.swing.JButton();
    PrintButton = new javax.swing.JButton();
    SearchButton = new javax.swing.JButton();
    jPanel5 = new javax.swing.JPanel();
    VerticalLabel2 = new javax.swing.JLabel();
    jSeparator3 = new javax.swing.JSeparator();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea = new javax.swing.JTextArea();
    LogoutButton = new javax.swing.JButton();

    setBackground(new java.awt.Color(255, 255, 255));

    NavigationLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
    NavigationLabel.setText("Home > Reports > Product Turnover Report");

    jPanel6.setBackground(new java.awt.Color(255, 255, 204));

    CancelButton.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    CancelButton.setText("Cancel");
    CancelButton.setMinimumSize(new java.awt.Dimension(89, 100));

    PrintButton.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    PrintButton.setText("Print");
    PrintButton.setMinimumSize(new java.awt.Dimension(89, 100));

    SearchButton.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    SearchButton.setText("Search");
    SearchButton.setMinimumSize(new java.awt.Dimension(89, 100));

    org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(
        jPanel6Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel6Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        SearchButton,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        100,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        org.jdesktop.layout.LayoutStyle.RELATED,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .add(
                        PrintButton,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        100,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        CancelButton,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        100,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    jPanel6Layout.setVerticalGroup(
        jPanel6Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel6Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        jPanel6Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(
                                CancelButton,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                100,
                                Short.MAX_VALUE)
                            .add(
                                PrintButton,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                SearchButton,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap()));

    jPanel5.setBackground(new java.awt.Color(255, 255, 204));
    jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

    VerticalLabel2.setFont(new java.awt.Font("Lucida Grande", 1, 24)); // NOI18N
    VerticalLabel2.setText("Product Turnover Report");

    jTextArea.setColumns(20);
    jTextArea.setRows(5);
    jScrollPane1.setViewportView(jTextArea);

    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(
        jPanel5Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel5Layout
                    .createSequentialGroup()
                    .add(178, 178, 178)
                    .add(VerticalLabel2)
                    .addContainerGap(212, Short.MAX_VALUE))
            .add(
                jPanel5Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        jPanel5Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jSeparator3)
                            .add(
                                org.jdesktop.layout.GroupLayout.TRAILING,
                                jPanel5Layout
                                    .createSequentialGroup()
                                    .add(0, 0, Short.MAX_VALUE)
                                    .add(
                                        jScrollPane1,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                        685,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    jPanel5Layout.setVerticalGroup(
        jPanel5Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel5Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(VerticalLabel2)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        jSeparator3,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        10,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        jScrollPane1,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        352,
                        Short.MAX_VALUE)
                    .addContainerGap()));

    LogoutButton.setText("Logout");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(NavigationLabel)
                                    .addPreferredGap(
                                        org.jdesktop.layout.LayoutStyle.RELATED,
                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .add(
                                        LogoutButton,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                        75,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(
                                        layout
                                            .createParallelGroup(
                                                org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(
                                                jPanel6,
                                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                org.jdesktop.layout.GroupLayout.TRAILING,
                                                jPanel5,
                                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addContainerGap()))));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .add(0, 0, Short.MAX_VALUE)
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(NavigationLabel)
                            .add(LogoutButton))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        jPanel5,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        jPanel6,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
  } // </editor-fold>//GEN-END:initComponents