Exemplo n.º 1
0
 private boolean checkValidPage() {
   if (resultSetController != null
       && resultSetController.getTotalResultSetLength() != -1
       && resultSetController.getBlockSize() != -1
       && controlPageNr.getDouble().intValue()
           > resultSetController.getTotalResultSetLength() / resultSetController.getBlockSize()) {
     controlPageNr.setValue(new Integer(currentPageNr));
     return false;
   }
   return true;
 }
Exemplo n.º 2
0
 /** Method called by grid component each time a row is selected. */
 public void setLastRow(boolean isLastRecord) {
   lastButton.setEnabled(!isLastRecord);
   nextButton.setEnabled(!isLastRecord);
   nextPgButton.setEnabled(!isLastRecord);
   controlPageNr.setEnabled(true);
   //    controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
 }
Exemplo n.º 3
0
 /** Method called by grid component each time a row is selected. */
 public void setFirstRow(boolean isFirstRecord) {
   firstButton.setEnabled(!isFirstRecord);
   prevPgButton.setEnabled(!isFirstRecord);
   prevButton.setEnabled(!isFirstRecord);
   controlPageNr.setEnabled(true);
   //    controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
 }
Exemplo n.º 4
0
 /** Show/update/hide page number field, according to loading policy and current data length. */
 public final void updatePageNumber(int pageNr) {
   controlPageNr.setValue(new Integer(pageNr));
   pageNrPanel.removeAll();
   if (pageNr > 0 && showPageNumber) pageNrPanel.add(controlPageNr);
   pageNrPanel.revalidate();
   this.repaint();
 }
Exemplo n.º 5
0
 public void setEnabled(boolean enabled) {
   controlPageNr.setEnabled(enabled);
   //    if (!enabled)
   //      controlPageNr.setEnabled(false);
   //    else
   //      controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
   firstButton.setEnabled(enabled);
   prevPgButton.setEnabled(enabled);
   prevButton.setEnabled(enabled);
   nextButton.setEnabled(enabled);
   nextPgButton.setEnabled(enabled);
   lastButton.setEnabled(enabled);
 }
Exemplo n.º 6
0
  public NavigatorBar() {
    try {
      jbInit();
      controlPageNr.setColumns(3);
      controlPageNr.setValue(new Integer(1));
      controlPageNr.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              if (controlPageNr.getDouble() == null) controlPageNr.setValue(new Integer(1));
              if (!checkValidPage()) return;
              currentPageNr = controlPageNr.getDouble().intValue();
              gotoPage();
            }
          });
      controlPageNr.addFocusListener(
          new FocusAdapter() {

            public void focusGained(FocusEvent e) {
              if (controlPageNr.getDouble() == null) controlPageNr.setValue(new Integer(1));
              currentPageNr = controlPageNr.getDouble().intValue();
            }

            public void focusLost(FocusEvent e) {
              if (controlPageNr.getDouble() == null) controlPageNr.setValue(new Integer(1));
              if (!checkValidPage()) return;
              int lastValue = currentPageNr;
              currentPageNr = controlPageNr.getDouble().intValue();
              if (lastValue != currentPageNr) gotoPage();
            }
          });

      firstButton.setToolTipText(
          ClientSettings.getInstance()
              .getResources()
              .getResource("Load the first block of records"));
      firstButton.setPreferredSize(new Dimension(32, 32));
      prevPgButton.setToolTipText(
          ClientSettings.getInstance()
              .getResources()
              .getResource("Load the previous block of records"));
      prevPgButton.setPreferredSize(new Dimension(32, 32));
      prevButton.setToolTipText(
          ClientSettings.getInstance()
              .getResources()
              .getResource("Select the previous row in grid"));
      prevButton.setPreferredSize(new Dimension(32, 32));
      nextButton.setToolTipText(
          ClientSettings.getInstance().getResources().getResource("Select the next row in grid"));
      nextButton.setPreferredSize(new Dimension(32, 32));
      nextPgButton.setToolTipText(
          ClientSettings.getInstance()
              .getResources()
              .getResource("Load the next block of records"));
      nextPgButton.setPreferredSize(new Dimension(32, 32));
      lastButton.setToolTipText(
          ClientSettings.getInstance()
              .getResources()
              .getResource("Load the last block of records"));
      lastButton.setPreferredSize(new Dimension(32, 32));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }