コード例 #1
0
  private JButton getJButton2() {
    if (jButton2 == null) {
      jButton2 = new JButton();
      // jButton2.setText("B3");
      jButton2.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.DELETE));
      jButton2.setToolTipText("Load Template");
    }
    jButton2.addActionListener(
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            // tablemodel
            //
            final JDialogTable showTemplates = new JDialogTable(tablemodel);
            showTemplates.setVisible(true);
            showTemplates.setLocationRelativeTo(jButton2);

            showTemplates.jTable1.addMouseListener(
                new java.awt.event.MouseAdapter() {

                  public void mouseClicked(MouseEvent e) {

                    String jobid =
                        showTemplates
                            .jTable1
                            .getValueAt(showTemplates.jTable1.getSelectedRow(), 0)
                            .toString();

                    try {
                      job = new UserJob();
                      job.setId(new Integer(jobid).intValue());
                      Vector<UserJobsDetails> jobdetails =
                          (Vector)
                              reportPanel
                                  .getRemoteTask()
                                  .getDetailsJob(new Integer(jobid).intValue());
                      loadJobs(jobdetails);
                    } catch (NumberFormatException e1) {
                      // TODO Auto-generated catch block
                      e1.printStackTrace();
                    } catch (RemoteException e1) {
                      // TODO Auto-generated catch block
                      e1.printStackTrace();
                    }
                    showTemplates.dispose();
                  }
                });
          }
        });
    return jButton2;
  }
コード例 #2
0
  private JButton getJButton0() {
    if (jButton0 == null) {
      jButton0 = new JButton();
      jButton0.setMaximumSize(new Dimension(20, 18));
      // jButton0.setText("B0");
      jButton0.setForeground(Color.white);
      ImageIcon icon = new ImageIcon("/resources/icon/hide12.png");
      jButton0.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.REFRESH));

      jButton0.setToolTipText("Execute");
    }
    jButton0.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent event) {
            String sql = "";
            String where =
                getFilterValues().createWhere(searchPanel.getFilterBeanData(), getReportType());
            String sqlW = "";
            String columnSQL = reportPanel.getColumnSQL();
            if (commonUTIL.isEmpty(columnSQL)) {
              commonUTIL.display("Execute Button", "Column are not gettting generated");
              return;
            }

            if (commonUTIL.isEmpty(where)) {
              sqlW = columnSQL;
            } else {
              sqlW = columnSQL + " and   " + where;
            }
            try {
              // commonUTIL.showAlertMessage(sql);
              data = (Vector) reportPanel.getRemoteTrade().getTradesforReport(sqlW);
              if (data != null && data.size() > 0) {

                reportPanel.loadreport(((Vector) data.get(2)));
              }

              System.out.println(data.size());
              System.out.println("PPP");
              //	jobdataPanel.setDataCreteria(data,filtersValues);
              // jobdataPanel.setJobdetails(filters);

            } catch (RemoteException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    return jButton0;
  }
コード例 #3
0
 private JButton getJButton1() {
   if (jButton1 == null) {
     jButton1 = new JButton();
     // jButton1.setText("B1");
     // ImageIcon icon = new ImageIcon("/resources/icon/save.png");
     // jButton1.setIcon(icon);
     jButton1.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.SMALLSAVE));
     jButton1.setToolTipText("Save");
   }
   jButton1.addActionListener(
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           //	System.out.println(job.getId());
           saveJobDetails();
         }
       });
   return jButton1;
 }
コード例 #4
0
  private JButton getJButton4() {
    if (jButton4 == null) {
      jButton4 = new JButton();
      jButton4.setMaximumSize(new Dimension(20, 18));
      // jButton0.setText("B0");

      jButton4.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.CLEARALL));

      jButton4.setToolTipText("Clear All");
      jButton4.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              searchPanel.clearllCriteriaModel();
              searchPanel.getFilterBeanData().clear();
              job = null;
            }
          });
    }
    return jButton4;
  }
コード例 #5
0
  private JButton getJButton5() {
    if (jButton5 == null) {
      jButton5 = new JButton();
      jButton5.setMaximumSize(new Dimension(20, 18));
      // jButton0.setText("B0");

      jButton5.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.DELETE));

      jButton5.setToolTipText("Delete Criteria");
      jButton5.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              if (searchPanel.table.getSelectedRow() != -1) {
                searchPanel.deleteRowCriteria(searchPanel.table.getSelectedRow());
                Vector<UserJobsDetails> jobdets = new Vector<UserJobsDetails>();
                for (int i = 0; i < filters.size(); i++) {
                  FilterBean filterBean = filters.get(i);
                  UserJobsDetails ud = new UserJobsDetails();
                  ud.setJobId(job.getId());
                  ud.setColumnName(filterBean.getColumnName());
                  ud.setCriteria(filterBean.getSearchCriteria());
                  ud.setValues(filterBean.getColumnValues());
                  ud.setFilterValues(filterBean.getIdSelected());
                  ud.setRowid(i);
                  jobdets.add(ud);
                }
                try {
                  if (job != null)
                    reportPanel.getRemoteTask().saveUserJobsDetails(jobdets, job.getId());
                } catch (RemoteException e) {
                  //
                  e.printStackTrace();
                }
              }
            }
          });
    }
    return jButton5;
  }
コード例 #6
0
  /*
   * 1.  Create Table Model
   * 2.  Create Renederer/Editor  in this  (remember getCellEditorValue method must return value )
   * 3.  Create Combox
   * 4.  assign sting [] for combox
   * 5.  assign combox to editor
   * 6.  when combox is assign to editor setEditorForRowCol  method is call where for each row and column wise editor is created.
   * 7.  when column and row is clicked selectEditor is called.
   * 8.  when combox box of that editor is clicked the jcombox mouse event is called.
   * 7.  in mouse event of combox, bean assign to the Table  model  is mapped and displayed in table
   */
  private JButton getJButton3() {

    if (jButton3 == null) {
      jButton3 = new JButton();
      // jButton3.setText("B4");
      jButton3.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.ADD));
      jButton3.setToolTipText("Add Search Criteria");
    }
    final JDialogBoxForChoice choice12 = new JDialogBoxForChoice(columnNamesListModel);
    jButton3.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {

            choice12.jList3.setModel(columnNamesListModel);
            choice12.setLocationRelativeTo(choice12);
            choice12.setVisible(true);
          }
        });
    choice12.addWindowListener(
        new WindowAdapter() {

          public void windowClosing(WindowEvent e) {
            String ss = "";
            Object obj[] = choice12.getObj();
            int rowCount = searchPanel.getTableRowCount();
            String criteria[] = null;
            criteria =
                getFilterValues().convertVectortoSringArray(searchCriteria, "SearchCriteria");
            for (int i = 0; i < obj.length; i++) {
              ss = (String) obj[i];
              FilterBean filter = new FilterBean();
              filter.setColumnName(ss);
              searchPanel.addNewRow(filter);
              rowCount = searchPanel.getTableRowCount();
              if (ss.endsWith("Date")) {
                criteria = getFilterValues().getDateSearchCriteria();
                searchPanel.addRowEditor(
                    rowCount - 1, 1, getDateCriteriaJComboxBox(criteria), "Criteria");
              }
              Vector dataValues = getFilterValues().getValuesonColumn(ss, null);
              if (dataValues == null || dataValues.isEmpty()) {
                if (ss.endsWith("Date")) {
                  searchPanel.addRowEditor(rowCount - 1, 2, getDateCellEditor("Values"), "Values");
                  searchPanel.addRowEditor(rowCount - 1, 3, getDateCellEditor("And/Or"), "And/Or");
                } else {
                  final JTextField numberValues = new JTextField();
                  DefaultCellEditor valuesCed = new DefaultCellEditor(numberValues);
                  numberValues.addMouseListener(
                      new MouseAdapter() {
                        public void mouseClicked(MouseEvent event) {
                          selectRow = searchPanel.table.getSelectedRow();
                          selectCol = searchPanel.table.getSelectedColumn();
                        }
                      });
                  numberValues.addFocusListener(
                      new FocusAdapter() {
                        public void focusLost(FocusEvent event) {

                          try {
                            String number = numberValues.getText();
                            int tradeId = Integer.parseInt(number);
                            int i = selectRow;
                            FilterBean filler = (FilterBean) filters.get(i);
                            filler.setColumnValues(number);
                            filler.setIdSelected("0"); // this are just // combox ids
                            filters.remove(i);
                            filters.add(i, filler);
                          } catch (NumberFormatException ec) {
                            // commonUTIL.showAlertMessage("Enter Number only");
                            // numberValues.setText("");
                          }
                        }
                      });
                }
              } else {
                String mvalues[] = getFilterValues().convertVectortoSringArray(dataValues, ss, 0);

                searchPanel.addRowEditor(rowCount - 1, 1, getJComboxBox(criteria), "Criteria");
                searchPanel.addRowEditor(
                    rowCount - 1, 2, getMultiSelectListExComboBox(mvalues), "Values");
              }
            }
          }
        });
    return jButton3;
  }