Exemple #1
0
 public void syncPanel() {
   panelPat.syncPanel();
   regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A);
   regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B);
   regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C);
   elevBox.setText(dlg.panelMain.mark.getElevation());
   heightBox.setText(dlg.panelMain.mark.getObjectHeight());
   sourceBox.setText(dlg.panelMain.mark.getSource());
   infoBox.setText(dlg.panelMain.mark.getInfo());
   for (Sts sts : statuses.keySet()) {
     int item = statuses.get(sts);
     if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item);
   }
   for (Cns cns : constructions.keySet()) {
     int item = constructions.get(cns);
     if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item);
   }
   for (Con con : conspicuities.keySet()) {
     int item = conspicuities.get(con);
     if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item);
   }
   for (Con con : reflectivities.keySet()) {
     int item = reflectivities.get(con);
     if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item);
   }
 }
Exemple #2
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Con con : reflectivities.keySet()) {
     int idx = reflectivities.get(con);
     if (dlg.panelMain.mark != null && (idx == reflBox.getSelectedIndex()))
       dlg.panelMain.mark.setRefl(con);
   }
 }
Exemple #3
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cns cns : constructions.keySet()) {
     int idx = constructions.get(cns);
     if (dlg.panelMain.mark != null && (idx == constrBox.getSelectedIndex()))
       dlg.panelMain.mark.setConstr(cns);
   }
 }
Exemple #4
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Sts sts : statuses.keySet()) {
     int idx = statuses.get(sts);
     if (dlg.panelMain.mark != null && (idx == statusBox.getSelectedIndex()))
       dlg.panelMain.mark.setStatus(sts);
   }
 }
Exemple #5
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : categories.keySet()) {
     int idx = categories.get(cat);
     if (dlg.node != null && (idx == categoryBox.getSelectedIndex()))
       dlg.panelMain.mark.setCategory(cat);
   }
 }
Exemple #6
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   if ((dlg.panelMain.mark.getObject() != Obj.MORFAC)
       || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) {
     for (Shp shp : shapes.keySet()) {
       JRadioButton button = shapes.get(shp);
       if (button.isSelected()) {
         dlg.panelMain.mark.setShape(shp);
         if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) {
           dlg.panelMain.mark.setObject(objects.get(shp));
           if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) {
             dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
             dlg.panelMain.mark.setObjColour(Col.YELLOW);
           }
           if (button == cairnButton) {
             dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
             dlg.panelMain.mark.setObjColour(Col.UNKCOL);
           }
           topmarkButton.setVisible(dlg.panelMain.mark.testValid());
         }
         button.setBorderPainted(true);
       } else button.setBorderPainted(false);
     }
     dlg.panelMain.panelMore.syncPanel();
   }
 }
 /**
  * Helper method that can be used to dynamically figure out enumeration type of given {@link
  * EnumSet}, without having access to its declaration. Code is needed to work around design flaw
  * in JDK.
  *
  * @since 1.5
  */
 public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> m) {
   if (!m.isEmpty()) {
     return findEnumType(m.keySet().iterator().next());
   }
   // Otherwise need to locate using an internal field
   return EnumTypeLocator.instance.enumTypeFor(m);
 }
 public void syncPanel() {
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (SmedAction.panelMain.mark.getShape() == shp) {
       button.setBorderPainted(true);
     } else button.setBorderPainted(false);
   }
 }
Exemple #9
0
 public void syncPanel() {
   if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) == Ent.MOORING) {
     mooringButton.setBorderPainted(true);
     categoryBox.setVisible(false);
     mooringBox.setVisible(true);
     pillarButton.setEnabled(false);
     sparButton.setEnabled(false);
     beaconButton.setEnabled(false);
     towerButton.setEnabled(false);
     stakeButton.setEnabled(false);
     cairnButton.setEnabled(false);
     noticeButton.setEnabled(false);
     topmarkButton.setVisible(false);
     for (Cat cat : moorings.keySet()) {
       int item = moorings.get(cat);
       if (dlg.panelMain.mark.getCategory() == cat) mooringBox.setSelectedIndex(item);
     }
   } else {
     mooringButton.setBorderPainted(false);
     mooringBox.setVisible(false);
     categoryBox.setVisible(true);
     pillarButton.setEnabled(true);
     sparButton.setEnabled(true);
     beaconButton.setEnabled(true);
     towerButton.setEnabled(true);
     stakeButton.setEnabled(true);
     cairnButton.setEnabled(true);
     noticeButton.setEnabled(true);
     topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
     topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
     topmarkButton.setVisible(dlg.panelMain.mark.testValid());
     for (Cat cat : categories.keySet()) {
       int item = categories.get(cat);
       if (dlg.panelMain.mark.getCategory() == cat) categoryBox.setSelectedIndex(item);
     }
   }
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (dlg.panelMain.mark.getShape() == shp) {
       button.setBorderPainted(true);
     } else button.setBorderPainted(false);
   }
   noticeButton.setBorderPainted(false);
   dlg.panelMain.mark.testValid();
 }
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Shp shp : shapes.keySet()) {
     JRadioButton button = shapes.get(shp);
     if (button.isSelected()) {
       SmedAction.panelMain.mark.setShape(shp);
       SmedAction.panelMain.mark.setObject(objects.get(shp));
       button.setBorderPainted(true);
     } else button.setBorderPainted(false);
   }
   if (SmedAction.panelMain.mark.testValid()) {
     SmedAction.panelMain.panelChan.topmarkButton.setVisible(true);
     SmedAction.panelMain.panelChan.lightButton.setVisible(true);
     if (SmedAction.panelMain.mark.getCategory() == Cat.LAM_STBD) {
       switch (SmedAction.panelMain.mark.getRegion()) {
         case A:
           SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
           SmedAction.panelMain.mark.setObjColour(Col.GREEN);
           break;
         case B:
           SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           break;
         case C:
           SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP);
           SmedAction.panelMain.mark.setObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.WHITE);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.WHITE);
           break;
       }
     } else {
       SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP);
       switch (SmedAction.panelMain.mark.getRegion()) {
         case A:
           SmedAction.panelMain.mark.setObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           break;
         case B:
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           break;
         case C:
           SmedAction.panelMain.mark.setObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           SmedAction.panelMain.mark.addObjColour(Col.RED);
           SmedAction.panelMain.mark.addObjColour(Col.GREEN);
           break;
       }
     }
     SmedAction.panelMain.panelMore.syncPanel();
   } else {
     SmedAction.panelMain.panelChan.topmarkButton.setVisible(false);
     SmedAction.panelMain.panelChan.lightButton.setVisible(false);
   }
 }
  public EnrollmentDialog(
      Frame owner,
      int maxCount,
      final String reasonToFail,
      EnumMap<DPFPFingerIndex, DPFPTemplate> templates) {
    super(owner, true);
    this.templates = templates;

    setTitle("Fingerprint Enrollment");

    DPFPEnrollmentControl enrollmentControl = new DPFPEnrollmentControl();

    EnumSet<DPFPFingerIndex> fingers = EnumSet.noneOf(DPFPFingerIndex.class);
    fingers.addAll(templates.keySet());
    enrollmentControl.setEnrolledFingers(fingers);
    enrollmentControl.setMaxEnrollFingerCount(maxCount);

    enrollmentControl.addEnrollmentListener(
        new DPFPEnrollmentListener() {
          public void fingerDeleted(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else {
              EnrollmentDialog.this.templates.remove(e.getFingerIndex());
            }
          }

          public void fingerEnrolled(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              //                  e.setStopCapture(false);
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else EnrollmentDialog.this.templates.put(e.getFingerIndex(), e.getTemplate());
          }
        });

    getContentPane().setLayout(new BorderLayout());

    JButton closeButton = new JButton("Close");
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false); // End Dialog
          }
        });

    JPanel bottom = new JPanel();
    bottom.add(closeButton);
    add(enrollmentControl, BorderLayout.CENTER);
    add(bottom, BorderLayout.PAGE_END);

    pack();
    setLocationRelativeTo(null);
  }
Exemple #12
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   for (Cat cat : moorings.keySet()) {
     int idx = moorings.get(cat);
     if (dlg.node != null && (idx == mooringBox.getSelectedIndex())) {
       dlg.panelMain.mark.setCategory(cat);
       if ((cat == Cat.INB_CALM) || (cat == Cat.INB_SBM)) {
         dlg.panelMain.mark.setObject(Obj.BOYINB);
         dlg.panelMain.mark.setShape(Shp.UNKSHP);
       } else {
         dlg.panelMain.mark.setObject(Obj.MORFAC);
         if (cat != Cat.MOR_BUOY) dlg.panelMain.mark.setShape(Shp.UNKSHP);
       }
     }
   }
   if (dlg.node != null) syncPanel();
 }