Example #1
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();
   }
 }
Example #2
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);
   }
 }
Example #3
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);
   }
 }
Example #4
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);
   }
 }
 // [JACKSON-212]
 public void testToStringEnumWithEnumMap() throws Exception {
   ObjectMapper m = new ObjectMapper();
   m.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true);
   EnumMap<LowerCaseEnum, String> enums = new EnumMap<LowerCaseEnum, String>(LowerCaseEnum.class);
   enums.put(LowerCaseEnum.C, "value");
   assertEquals("{\"c\":\"value\"}", m.writeValueAsString(enums));
 }
Example #6
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);
   }
 }
 // [databind#601]
 public void testEnumsWithJsonValueInMap() throws Exception {
   EnumMap<EnumWithJsonValue, String> input =
       new EnumMap<EnumWithJsonValue, String>(EnumWithJsonValue.class);
   input.put(EnumWithJsonValue.B, "x");
   assertEquals(
       "{\"" + EnumWithJsonValue.B.toString() + "\":\"x\"}", mapper.writeValueAsString(input));
 }
Example #8
0
 public static void main(String[] args) {
   EnumMap<AlarmPoints, Command> em = new EnumMap<AlarmPoints, Command>(AlarmPoints.class);
   em.put(
       KITCHEN,
       new Command() {
         public void action() {
           print("Kitchen fire!");
         }
       });
   em.put(
       BATHROOM,
       new Command() {
         public void action() {
           print("Bathroom alert!");
         }
       });
   for (Map.Entry<AlarmPoints, Command> e : em.entrySet()) {
     printnb(e.getKey() + ": ");
     e.getValue().action();
   }
   try { // If there's no value for a particular key:
     em.get(UTILITY).action();
   } catch (Exception e) {
     print(e);
   }
 }
 public static void main(String[] args) {
   // 创建EnumMap对象,该EnumMap的所有key都是Season枚举类的枚举值
   EnumMap enumMap = new EnumMap(Season.class);
   enumMap.put(Season.SUMMER, "夏日炎炎");
   enumMap.put(Season.SPRING, "春暖花开");
   System.out.println(enumMap);
 }
Example #10
0
 /**
  * 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);
 }
Example #11
0
 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);
   }
 }
Example #12
0
 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);
   }
 }
Example #13
0
 private JRadioButton getShapeButton(
     JRadioButton button, int x, int y, int w, int h, String tip, Shp shp, Obj obj) {
   button.setBounds(new Rectangle(x, y, w, h));
   button.setBorder(BorderFactory.createLoweredBevelBorder());
   button.setToolTipText(Messages.getString(tip));
   button.addActionListener(alShape);
   shapeButtons.add(button);
   shapes.put(shp, button);
   objects.put(shp, obj);
   return button;
 }
Example #14
0
    private Node(
        AbstractAction prevAct,
        ActionState state,
        Round prevRound,
        List<AbstractAction> path,
        PathToFlop pathToFlop) {
      if (pathToFlop != null) {
        PATH = pathToFlop;
      } else {
        if (prevAct != null) {
          path.add(prevAct);
        }
        PATH = PathToFlop.matching(path);
      }

      // nextIntent

      INDEX = nextIndex++;
      ID = nextId(PATH, state.round());
      INTENT = nextIntent(prevRound);
      CAN_RAISE = state.canRaise();
      CAN_CHECK = state.canCheck();
      STATUS = state.headsUpStatus();
      ROUND = state.round();
      STAKES = state.stakes().smallBlinds();
      DEALER_COMMIT = state.seat(1).commitment().smallBlinds();
      DEALEE_COMMIT = state.seat(0).commitment().smallBlinds();
      DEALER_NEXT = state.dealerIsNext();
      STATE = state;

      KIDS = new EnumMap<>(AbstractAction.class);
      for (Map.Entry<AbstractAction, ActionState> act : state.actions(false).entrySet())
      //                    state.viableActions().entrySet())
      {
        List<AbstractAction> nextPath = (PATH == null) ? new ArrayList<>(path) : null;

        //                if (! act.getValue().atEndOfHand()) {
        KIDS.put(act.getKey(), new Node(act.getKey(), act.getValue(), ROUND, nextPath, PATH));
        //                }
      }

      // intents
      F_INTENT = intent(AbstractAction.QUIT_FOLD);
      C_INTENT = intent(AbstractAction.CHECK_CALL);
      R_INTENT = intent(AbstractAction.BET_RAISE);

      KID_NODES =
          new Node[] {
            KIDS.get(AbstractAction.QUIT_FOLD),
            KIDS.get(AbstractAction.CHECK_CALL),
            KIDS.get(AbstractAction.BET_RAISE)
          };
    }
  @Override
  public EnumMap<?, ?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    // Ok: must point to START_OBJECT
    if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
      return _deserializeFromEmpty(jp, ctxt);
    }
    EnumMap result = constructMap();
    final JsonDeserializer<Object> valueDes = _valueDeserializer;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;

    while ((jp.nextToken()) == JsonToken.FIELD_NAME) {
      String keyName = jp.getCurrentName(); // just for error message
      // but we need to let key deserializer handle it separately, nonetheless
      Enum<?> key = (Enum<?>) _keyDeserializer.deserializeKey(keyName, ctxt);
      if (key == null) {
        if (!ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) {
          throw ctxt.weirdStringException(
              keyName,
              _enumClass,
              "value not one of declared Enum instance names for " + _mapType.getKeyType());
        }
        /* 24-Mar-2012, tatu: Null won't work as a key anyway, so let's
         *  just skip the entry then. But we must skip the value as well, if so.
         */
        jp.nextToken();
        jp.skipChildren();
        continue;
      }
      // And then the value...
      JsonToken t = jp.nextToken();
      /* note: MUST check for nulls separately: deserializers will
       * not handle them (and maybe fail or return bogus data)
       */
      Object value;

      try {
        if (t == JsonToken.VALUE_NULL) {
          value = valueDes.getNullValue(ctxt);
        } else if (typeDeser == null) {
          value = valueDes.deserialize(jp, ctxt);
        } else {
          value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
        }
      } catch (Exception e) {
        wrapAndThrow(e, result, keyName);
        return null;
      }
      result.put(key, value);
    }
    return result;
  }
Example #16
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);
   }
 }
  @Override
  @Transactional
  public LocalizationResponse localize(MeasurementContainer container) {
    User user = userRepository.findByUsername(container.getUsername());
    List<Fingerprint> userPrints = container.getFingerprints();
    // We sort the prints to make matching easier
    Collections.sort(userPrints);
    List<Place> places = placeRepository.findAll();

    // If there are no places we won't do anything
    if (places.isEmpty()) {
      return new LocalizationResponse();
    }

    Place leastErraneousPlace =
        localizationAlgorithms.get(container.getType()).localize(places, userPrints);

    cutDownHistoryOccurrencesTo9(user.getHistory());

    saveAsHistoryOccurrence(leastErraneousPlace, user);

    LocalizationResponse response = new LocalizationResponse();
    response.setPlaceName(leastErraneousPlace.getName());
    response.setAuthenticationSuccessful(true);
    return response;
  }
Example #18
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();
 }
  public IDGenerator getIDGenerator(IDGenerator.Name name) {
    IDGenerator filter = idGenerators.get(name);
    if (filter == null)
      throw new IllegalArgumentException("No ID Generator for " + name + " configured");

    return filter;
  }
  public AttributeFilter getAttributeFilter(Entity entity) {
    AttributeFilter filter = attributeFilters.get(entity);
    if (filter == null)
      throw new IllegalArgumentException("No Attribute Filter for " + entity + " configured");

    return filter;
  }
Example #21
0
  public NetworkMockup() {
    this.initialFactTemplate = defTemplate("initial-fact", "");
    defFacts("initial-fact", "", Arrays.asList(new TemplateContainer<>(initialFactTemplate)));

    {
      final Template dummyFact =
          this.defTemplate("dummy-fact", "used as default value for FACT-ADDRESS");
      @SuppressWarnings("unchecked")
      final FactIdentifier dummyFactIdentifier =
          new org.jamocha.function.fwa.Assert<>(
                  this, new TemplateContainer[] {new TemplateContainer<>(dummyFact)})
              .evaluate();
      for (final SlotType type : EnumSet.allOf(SlotType.class)) {
        switch (type) {
          case BOOLEAN:
            defaultValues.put(type, Boolean.FALSE);
            break;
          case DATETIME:
            defaultValues.put(type, ZonedDateTime.now());
            break;
          case DOUBLE:
            defaultValues.put(type, Double.valueOf(0.0));
            break;
          case LONG:
            defaultValues.put(type, Long.valueOf(0));
            break;
          case NIL:
            defaultValues.put(type, null);
            break;
          case STRING:
            defaultValues.put(type, "");
            break;
          case SYMBOL:
            defaultValues.put(type, this.getScope().getOrCreateSymbol("nil"));
            break;
          case FACTADDRESS:
            defaultValues.put(type, dummyFactIdentifier);
            break;
          case BOOLEANS:
          case DATETIMES:
          case DOUBLES:
          case FACTADDRESSES:
          case LONGS:
          case NILS:
          case STRINGS:
          case SYMBOLS:
            defaultValues.put(type, Array.newInstance(type.getJavaClass(), 0));
            break;
        }
      }
    }
  }
 protected void initNodesLoader() {
   if (!isUseNodes) {
     isUseNodes =
         shaderNames.get(Shader.ShaderType.Vertex) == null
             && shaderNames.get(Shader.ShaderType.Fragment) == null;
     if (isUseNodes) {
       if (nodesLoaderDelegate == null) {
         nodesLoaderDelegate = new ShaderNodeLoaderDelegate();
       } else {
         nodesLoaderDelegate.clear();
       }
       nodesLoaderDelegate.setTechniqueDef(technique);
       nodesLoaderDelegate.setMaterialDef(materialDef);
       nodesLoaderDelegate.setAssetManager(assetManager);
     }
   }
 }
  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);
  }
Example #24
0
 private EnumMap<Location, Component> makeLookupMap(List<Component> components) {
   EnumMap<Location, Component> map =
       new EnumMap<BorderLayout.Location, Component>(Location.class);
   List<Component> unassignedComponents = new ArrayList<Component>();
   for (Component component : components) {
     if (component.getLayoutData() instanceof Location) {
       map.put((Location) component.getLayoutData(), component);
     } else {
       unassignedComponents.add(component);
     }
   }
   // Try to assign components to available locations
   for (Component component : unassignedComponents) {
     for (Location location : AUTO_ASSIGN_ORDER) {
       if (!map.containsKey(location)) {
         map.put(location, component);
         break;
       }
     }
   }
   return map;
 }
Example #25
0
 public synchronized void decreaseStock(Book book, int quantity, int jobSeqNum)
     throws InterruptedException {
   while (!inventory.containsKey(book) || inventory.get(book).intValue() < quantity) {
     wait();
   }
   inventory.put(book, inventory.get(book) - quantity);
   printWork(false, jobSeqNum, book, inventory.get(book) + quantity, inventory.get(book));
 }
Example #26
0
 static {
   tagFieldToID3v1Field.put(FieldKey.ARTIST, ID3v1FieldKey.ARTIST);
   tagFieldToID3v1Field.put(FieldKey.ALBUM, ID3v1FieldKey.ALBUM);
   tagFieldToID3v1Field.put(FieldKey.TITLE, ID3v1FieldKey.TITLE);
   tagFieldToID3v1Field.put(FieldKey.TRACK, ID3v1FieldKey.TRACK);
   tagFieldToID3v1Field.put(FieldKey.YEAR, ID3v1FieldKey.YEAR);
   tagFieldToID3v1Field.put(FieldKey.GENRE, ID3v1FieldKey.GENRE);
   tagFieldToID3v1Field.put(FieldKey.COMMENT, ID3v1FieldKey.COMMENT);
 }
  private void readShaderDefinition(
      Shader.ShaderType shaderType, String name, String... languages) {
    shaderNames.put(shaderType, name);

    if (langSize != 0 && langSize != languages.length) {
      throw new AssetLoadException(
          "Technique "
              + technique.getName()
              + " must have the same number of languages for each shader type.");
    }
    langSize = languages.length;
    for (int i = 0; i < languages.length; i++) {
      if (i >= shaderLanguages.size()) {
        shaderLanguages.add(new EnumMap<Shader.ShaderType, String>(Shader.ShaderType.class));
      }
      shaderLanguages.get(i).put(shaderType, languages[i]);
    }
  }
  public void testEnumMap() throws Exception {
    ObjectMapper mapper = new ObjectMapper();
    String JSON = "{ \"KEY1\" : \"\", \"WHATEVER\" : null }";

    // to get typing, must use type reference
    EnumMap<Key, String> result =
        mapper.readValue(JSON, new TypeReference<EnumMap<Key, String>>() {});

    assertNotNull(result);
    assertEquals(EnumMap.class, result.getClass());
    assertEquals(2, result.size());

    assertEquals("", result.get(Key.KEY1));
    // null should be ok too...
    assertTrue(result.containsKey(Key.WHATEVER));
    assertNull(result.get(Key.WHATEVER));

    // plus we have nothing for this key
    assertFalse(result.containsKey(Key.KEY2));
    assertNull(result.get(Key.KEY2));
  }
  /**
   * Localizes user by selected localization measure by selecting a proper localization command
   * object and adding closest place to user's history
   *
   * @param username Username of user to be localized
   * @param measurementform Measurement form containing user's Fingerprint data and selected
   *     localization measure
   */
  @Override
  @Transactional
  public void localize(String username, MeasurementForm measurementform) {
    User user = userRepository.findByUsername(username);
    ArrayList<Fingerprint> userPrints = measurementform.makeFingerprints();
    // We sort the prints to make matching easier
    Collections.sort(userPrints);
    List<Place> places = placeRepository.findAll();

    // If there are no places we won't do anything
    if (places.isEmpty()) {
      return;
    }

    Place leastErraneousPlace =
        localizationAlgorithms.get(measurementform.getType()).localize(places, userPrints);

    cutDownHistoryOccurrencesTo9(user.getHistory());

    saveAsHistoryOccurrence(leastErraneousPlace, user);
  }
Example #30
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();
 }