コード例 #1
0
 /**
  * Metoda nastavujici polozky comboBoxu unitType. Polozky jsou nastaveny dle aktualne vybrane
  * polozky comboBoxu material.
  *
  * @throws java.rmi.RemoteException
  * @throws java.rmi.NotBoundException
  * @throws java.io.FileNotFoundException
  */
 private void setUnitTypeModel(JComboBox materialBox, JComboBox unitBox)
     throws RemoteException, NotBoundException, FileNotFoundException {
   if (materialBox.getSelectedIndex() == -1) {
     unitBox.removeAllItems();
     return;
   }
   Material mat =
       ServiceFacade.getInstance().getMaterialByName((String) materialBox.getSelectedItem());
   int typeId = mat.getUnitType().getTypeId();
   setComboBoxModel(ServiceFacade.getInstance().getUnitTypeAbbrsByTypeId(typeId), unitBox);
   unitBox.setSelectedItem(mat.getUnitType().getAbbreviation());
 }
コード例 #2
0
 /**
  * Metoda nastavujici polozky comboBoxu material. Polozky jsou nastaveny dle aktualne vybrane
  * polozky comboBoxu materialType.
  *
  * @throws java.rmi.RemoteException
  * @throws java.rmi.NotBoundException
  * @throws java.io.FileNotFoundException
  */
 private void setMaterialModel(JComboBox materialTypeBox, JComboBox materialBox)
     throws RemoteException, NotBoundException, FileNotFoundException {
   if (materialTypeBox.getSelectedIndex() == -1) {
     materialBox.setSelectedItem(null);
     return;
   }
   int materialTypeId =
       ServiceFacade.getInstance()
           .getMaterialTypeByName((String) materialTypeBox.getSelectedItem())
           .getMaterialTypeId();
   setComboBoxModel(
       ServiceFacade.getInstance().getMaterialNamesByMaterialType(materialTypeId), materialBox);
 }
コード例 #3
0
 private void jButton5ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton5ActionPerformed
   try {
     boolean isOK =
         ServiceFacade.getInstance()
             .createAccount(
                 nb.bill.value.getText(), nb.statusTypeId, nb.tableId, nb.userId, nb.slevaId);
     if (!isOK) {
       JOptionPane.showMessageDialog(
           this,
           "Účet nemohl být vytvořen, protože účet se stejným názvem již existuje.",
           "Účet",
           JOptionPane.INFORMATION_MESSAGE);
       return;
     }
   } catch (FileNotFoundException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   } catch (NotBoundException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   } catch (RemoteException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   }
   this.setVisible(false);
   MainJFrame.PanelListku.setVisible(true);
   MainJFrame.PanelVyberu.removeAll();
   MainJFrame.NewAcc.setEnabled(false);
   MainJFrame.OpenAcc.setEnabled(false);
   MainJFrame.CloseAcc.setEnabled(true);
   MainJFrame.PayAcc.setEnabled(true);
   MainJFrame.PrintBill.setEnabled(true);
 } // GEN-LAST:event_jButton5ActionPerformed
コード例 #4
0
  private void jButton4ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton4ActionPerformed
    try {
      String[] tablenames = ServiceFacade.getInstance().getAccountStatusTypeNames();
      this.SelectPanel.removeAll();
      this.SelectPanel.setLayout(this.grid);
      for (int a = 0; a < tablenames.length; a++) {
        JButton butt = new JButton();
        butt.setText(tablenames[a]);
        butt.addActionListener(
            new java.awt.event.ActionListener() {

              public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectStatus(evt);
              }
            });
        this.SelectPanel.add(butt);
      }
      this.SelectPanel.setVisible(true);
      this.MenuPanel.setVisible(false);
      this.SelectPanel.validate();
      this.SelectPanel.repaint();
      this.repaint();
    } catch (FileNotFoundException ex) {
      Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NotBoundException ex) {
      Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
    } catch (RemoteException ex) {
      Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
    }
  } // GEN-LAST:event_jButton4ActionPerformed
コード例 #5
0
 void selectCustomer(ActionEvent evt) {
   try {
     nb.user.value.setText(((JButton) (evt.getSource())).getText());
     nb.userId =
         (ServiceFacade.getInstance().getUserByUsername(((JButton) (evt.getSource())).getText()))
             .getUserId();
     this.SelectPanel.setVisible(false);
     this.MenuPanel.setVisible(true);
   } catch (RemoteException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   } catch (FileNotFoundException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   } catch (NotBoundException ex) {
     Logger.getLogger(NewAccount.class.getName()).log(Level.SEVERE, null, ex);
   }
 }