예제 #1
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   dlg.panelMain.mark.setObject(Obj.UNKOBJ);
   dlg.panelMain.mark.setCategory(Cat.NOCAT);
   dlg.panelMain.mark.setTopmark(Top.NOTOP);
   if (mooringButton.isSelected()) {
     dlg.panelMain.mark.setObject(Obj.MORFAC);
     categoryBox.setVisible(false);
     mooringBox.setVisible(true);
     pillarButton.setEnabled(false);
     sparButton.setEnabled(false);
     beaconButton.setEnabled(false);
     towerButton.setEnabled(false);
     stakeButton.setEnabled(false);
     cairnButton.setEnabled(false);
     mooringButton.setBorderPainted(true);
   } else {
     mooringBox.setVisible(false);
     categoryBox.setVisible(true);
     pillarButton.setEnabled(true);
     sparButton.setEnabled(true);
     beaconButton.setEnabled(true);
     towerButton.setEnabled(true);
     stakeButton.setEnabled(true);
     cairnButton.setEnabled(true);
     mooringButton.setBorderPainted(false);
   }
   syncPanel();
 }
예제 #2
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();
 }
예제 #3
0
  /**
   * Contruct a new AnimationWidget.
   *
   * @param parentf the parent JFrame
   * @param anim a ucar.visad.display.Animation object to manage
   * @param info Default values for the AnimationInfo
   */
  public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) {

    // Initialize sharing to true
    super("AnimationWidget", true);
    timesCbx =
        new JComboBox() {
          public String getToolTipText(MouseEvent event) {
            if (boxPanel != null) {
              return boxPanel.getToolTipText();
            }
            return " ";
          }
        };
    timesCbx.setToolTipText("");
    timesCbxMutex = timesCbx.getTreeLock();
    timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9));
    timesCbx.setLightWeightPopupEnabled(false);
    // set to non-visible until items are added
    timesCbx.setVisible(false);
    timesCbx.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!ignoreTimesCbxEvents && (anime != null)) {
              debug("got timesCbx event");
              setTimeFromUser((Real) timesCbx.getSelectedItem());
              if (boxPanel != null) {
                boxPanel.setOnIndex(timesCbx.getSelectedIndex());
              }
            }
          }
        });

    animationInfo = new AnimationInfo();
    if (anim != null) {
      setAnimation(anim);
    }
    if (anime != null) {
      animationInfo.set(anime.getAnimationInfo());
    }
    if (info != null) {
      setProperties(info);
      animationInfo.setRunning(info.getRunning());
    }

    boxPanel = new AnimationBoxPanel(this);
    if (timesArray != null) {
      updateBoxPanel(timesArray);
    }
  }
예제 #4
0
  /** _more_ */
  private void setTimesInTimesBox() {
    DateTime[] theTimesArray = this.timesArray;
    if (theTimesArray == null) {
      return;
    }
    boolean oldValue = ignoreTimesCbxEvents;
    try {
      ignoreTimesCbxEvents = true;
      GuiUtils.setListData(timesCbx, theTimesArray);
      timesCbx.setVisible(
          timesCbxVisible && (theTimesArray != null) && (timesCbx.getItemCount() > 0));

    } finally {
      ignoreTimesCbxEvents = oldValue;
    }
  }
예제 #5
0
 protected void updateCategoryChooser() {
   if (categoryChooser != null) {
     ArrayList<String> categories;
     categoryChooser.removeAllItems();
     categories = new ArrayList<String>(contribListing.getCategories(filter));
     //      for (int i = 0; i < categories.size(); i++) {
     //        System.out.println(i + " category: " + categories.get(i));
     //      }
     Collections.sort(categories);
     //    categories.add(0, ContributionManagerDialog.ANY_CATEGORY);
     boolean categoriesFound = false;
     categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY);
     for (String s : categories) {
       categoryChooser.addItem(s);
       if (!s.equals(Contribution.UNKNOWN_CATEGORY)) {
         categoriesFound = true;
       }
     }
     categoryChooser.setVisible(categoriesFound);
   }
 }
예제 #6
0
 /**
  * Show the date box
  *
  * @param v true to show
  */
 public void showDateBox(boolean v) {
   timesCbxVisible = v;
   if (timesCbx != null) {
     timesCbx.setVisible(v);
   }
 }
예제 #7
0
  public PanelSpec(SmedAction dia) {
    dlg = dia;
    setLayout(null);
    add(getShapeButton(pillarButton, 0, 0, 34, 32, "Pillar", Shp.PILLAR, Obj.BOYSPP));
    add(getShapeButton(sparButton, 34, 0, 34, 32, "Spar", Shp.SPAR, Obj.BOYSPP));
    add(getShapeButton(canButton, 68, 0, 34, 32, "Can", Shp.CAN, Obj.BOYSPP));
    add(getShapeButton(coneButton, 102, 0, 34, 32, "Cone", Shp.CONI, Obj.BOYSPP));
    add(getShapeButton(sphereButton, 0, 32, 34, 32, "Sphere", Shp.SPHERI, Obj.BOYSPP));
    add(getShapeButton(barrelButton, 34, 32, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSPP));
    add(getShapeButton(superButton, 68, 32, 34, 32, "Super", Shp.SUPER, Obj.BOYSPP));
    add(getShapeButton(floatButton, 102, 32, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT));
    add(getShapeButton(beaconButton, 0, 64, 34, 32, "Beacon", Shp.BEACON, Obj.BCNSPP));
    add(getShapeButton(towerButton, 34, 64, 34, 32, "TowerB", Shp.TOWER, Obj.BCNSPP));
    add(getShapeButton(stakeButton, 68, 64, 34, 32, "Stake", Shp.STAKE, Obj.BCNSPP));
    add(getShapeButton(cairnButton, 102, 64, 34, 32, "CairnB", Shp.CAIRN, Obj.BCNSPP));

    categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
    categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
    add(categoryLabel);
    categoryBox = new JComboBox();
    categoryBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(categoryBox);
    categoryBox.setVisible(true);
    categoryBox.addActionListener(alCategoryBox);
    addCatItem("", Cat.NOCAT);
    addCatItem(Messages.getString("UKPurpose"), Cat.SPM_UNKN);
    addCatItem(Messages.getString("Warning"), Cat.SPM_WARN);
    addCatItem(Messages.getString("ChanSeparation"), Cat.SPM_CHBF);
    addCatItem(Messages.getString("Yachting"), Cat.SPM_YCHT);
    addCatItem(Messages.getString("Cable"), Cat.SPM_CABL);
    addCatItem(Messages.getString("Outfall"), Cat.SPM_OFAL);
    addCatItem(Messages.getString("ODAS"), Cat.SPM_ODAS);
    addCatItem(Messages.getString("RecreationZone"), Cat.SPM_RECN);
    addCatItem(Messages.getString("Mooring"), Cat.SPM_MOOR);
    addCatItem(Messages.getString("LANBY"), Cat.SPM_LNBY);
    addCatItem(Messages.getString("Leading"), Cat.SPM_LDNG);
    addCatItem(Messages.getString("Notice"), Cat.SPM_NOTC);
    addCatItem(Messages.getString("TSS"), Cat.SPM_TSS);
    addCatItem(Messages.getString("FoulGround"), Cat.SPM_FOUL);
    addCatItem(Messages.getString("Diving"), Cat.SPM_DIVE);
    addCatItem(Messages.getString("FerryCross"), Cat.SPM_FRRY);
    addCatItem(Messages.getString("Anchorage"), Cat.SPM_ANCH);
    mooringBox = new JComboBox();
    mooringBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(mooringBox);
    mooringBox.setVisible(false);
    mooringBox.addActionListener(alMooringBox);
    addMorItem("", Cat.NOCAT);
    addMorItem(Messages.getString("Dolphin"), Cat.MOR_DLPN);
    addMorItem(Messages.getString("DevDolphin"), Cat.MOR_DDPN);
    addMorItem(Messages.getString("Bollard"), Cat.MOR_BLRD);
    addMorItem(Messages.getString("Wall"), Cat.MOR_WALL);
    addMorItem(Messages.getString("Post"), Cat.MOR_POST);
    addMorItem(Messages.getString("Chain"), Cat.MOR_CHWR);
    addMorItem(Messages.getString("Rope"), Cat.MOR_ROPE);
    addMorItem(Messages.getString("Automatic"), Cat.MOR_AUTO);
    addMorItem(Messages.getString("MooringBuoy"), Cat.MOR_BUOY);
    addMorItem(Messages.getString("CALM"), Cat.INB_CALM);
    addMorItem(Messages.getString("SBM"), Cat.INB_SBM);

    topmarkButton.setBounds(new Rectangle(136, 0, 34, 32));
    topmarkButton.setToolTipText(Messages.getString("Topmark"));
    topmarkButton.setBorder(BorderFactory.createLoweredBevelBorder());
    topmarkButton.addActionListener(alTop);
    add(topmarkButton);

    //		noticeButton.setBounds(new Rectangle(136, 32, 34, 32));
    //		noticeButton.setToolTipText(Messages.getString("Notice"));
    //		noticeButton.setBorder(BorderFactory.createLoweredBevelBorder());
    //		noticeButton.addActionListener(alNotice);
    //		add(noticeButton);

    mooringButton.setBounds(new Rectangle(136, 64, 34, 32));
    mooringButton.setToolTipText(Messages.getString("Mooring"));
    mooringButton.setBorder(BorderFactory.createLoweredBevelBorder());
    mooringButton.addActionListener(alMooring);
    add(mooringButton);
  }