コード例 #1
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
 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
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  // Mode modification
  public void modeModification() {
    resetCollection();
    loadCollection();
    resetCategorie();
    loadCategorie();
    comboCollection.setEnabled(true);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);

    comboType.setVisible(true);
    comboType.setEnabled(true);

    comboEval.setVisible(true);
    comboEval.setEnabled(true);

    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(true);
    textCommentaires.setBackground(Color.WHITE);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      modeButton[k].setEnabled(false);
      modeButton[k].setVisible(false);
    }

    modeButton[3].setVisible(true); // Boutton Modifier
    modeButton[4].setVisible(true); // Boutton Supprimer
    boolean enabled = true;
    if (listeEstVide()) {
      enabled = false;
    }
    modeButton[3].setEnabled(enabled);
    modeButton[4].setEnabled(enabled);

    optionCategories[0].setEnabled(true); // Boutton ajouter categorie
    optionCategories[1].setEnabled(true);

    // Place the first element of combobox in the grid
    comboCollection.setSelectedIndex(0);
    Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString());
    afficherFilmChoisis(video.getTitre());
  }
コード例 #3
0
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  // Mode consultation
  public void modeConsultation() {
    resetCollection();
    loadCollection();
    comboCollection.setEnabled(true);

    textTitre.setVisible(false);
    textTitre.setEditable(false);
    textAnnee.setVisible(false);
    textAnnee.setEditable(false);
    comboType.setVisible(false);
    comboType.setEnabled(false);
    comboEval.setVisible(false);
    comboEval.setEnabled(false);

    // Juste au cas que ca foire
    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(false);
    textCategories.setEnabled(true);
    textCategories.setEditable(false);

    textCommentaires.setBackground(GRIS);
    textCategories.setBackground(GRIS);

    for (int k = 0; k < infos_film.length; k++) {
      infos_film[k].setVisible(true);
    }

    // Place the first element of combobox in the grid DEPRECATED by Enoncé
    comboCollection.setSelectedIndex(comboCollection.getSelectedIndex());

    for (int l = 0; l < modeButton.length; l++) {
      if (l < 2) {
        modeButton[0].setEnabled(false);
        modeButton[0].setVisible(true);
        if (comboCollection.getItemCount() > 1) {
          modeButton[l].setEnabled(true);
          modeButton[l].setVisible(true);
        } else {
          modeButton[l].setEnabled(false);
          modeButton[l].setVisible(true);
        }
        // modeButton[l].setEnabled(true);
        // modeButton[l].setVisible(true);
      } else {
        modeButton[l].setEnabled(false);
        modeButton[l].setVisible(false);
      }
    }
    optionCategories[0].setEnabled(false);
    optionCategories[1].setEnabled(false);

    // Get the collection and place in combobox

    Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString());
    afficherFilmChoisis(video.getTitre());
  }
コード例 #4
0
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  // Mode ajout
  public void modeAjout() {
    resetCollection();
    loadCollection();
    resetCategorie();
    loadCategorie();
    comboCollection.setEnabled(false);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);
    textTitre.setText("");
    textTitre.requestFocusInWindow();

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);
    textAnnee.setText("");

    comboType.setVisible(true);
    comboType.setEnabled(true);
    comboType.setSelectedIndex(1);

    comboEval.setVisible(true);
    comboEval.setEnabled(true);
    comboEval.setSelectedIndex(0);

    // Juste au cas que ca foire
    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(true);
    textCommentaires.setBackground(Color.WHITE);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    optionCategories[0].setEnabled(true);
    optionCategories[1].setEnabled(false);

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      if (k == 2) {
        modeButton[k].setEnabled(true);
        modeButton[k].setVisible(true);
      } else {
        modeButton[k].setEnabled(false);
        modeButton[k].setVisible(false);
      }
    }
  }
コード例 #5
0
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  // Mode recherche
  public void modeRecherche() {
    resetCollection();

    comboCollection.setEnabled(false);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);
    textTitre.setText("");
    textTitre.requestFocusInWindow();

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);
    textAnnee.setText("");

    comboType.setVisible(true);
    comboType.setEnabled(true);
    comboType.setSelectedIndex(0);

    comboEval.setVisible(true);
    comboEval.setEnabled(false);
    // comboEval.setFont();
    comboEval.setSelectedIndex(0);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(false);
    textCommentaires.setBackground(GRIS);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      modeButton[k].setEnabled(false);
      modeButton[k].setVisible(false);
    }
    modeButton[5].setVisible(true);
    // modeButton[6].setVisible(true);

    boolean enabled = true;

    if (listeEstVide()) {
      enabled = false;
    }
    optionCategories[0].setEnabled(enabled);
    optionCategories[1].setEnabled(enabled);
    modeButton[5].setEnabled(enabled);
    modeButton[6].setEnabled(true);
  }
コード例 #6
0
 private void setUpBrowserCombobox() {
   for (BrowsersConfiguration.BrowserFamily family :
       BrowsersConfiguration.getInstance().getActiveBrowsers()) {
     browserComboBox.addItem(family);
   }
   browserComboBox.setRenderer(
       new ListCellRendererWrapper<BrowsersConfiguration.BrowserFamily>(browserComboBox) {
         @Override
         public void customize(
             JList list,
             BrowsersConfiguration.BrowserFamily family,
             int index,
             boolean selected,
             boolean hasFocus) {
           if (family != null) {
             setText(family.getName());
             setIcon(family.getIcon());
           }
         }
       });
   if (browserComboBox.getItemCount() < 2) {
     browserComboBox.setVisible(false);
     browserComboBox.setVisible(false);
   } else {
     browserComboBox.setSelectedItem(0);
   }
 }
コード例 #7
0
 private void checkSeek() {
   boolean seek = CHK_seek.isSelected();
   SELECT_seekType.setVisible(seek);
   TEXT_seekPos.setVisible(seek);
   LABEL_seekPos.setVisible(seek);
   LABEL_seekType.setVisible(seek);
   LABEL_seek.setVisible(seek);
 }
コード例 #8
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
 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();
 }
コード例 #9
0
  private void updateSelectEigenvaluesBy(boolean show) {
    if (show) {
      selectEigenvaluesBy.setVisible(true);
      selectEigenvaluesByLabel.setVisible(true);

      String item = (String) selectEigenvaluesBy.getSelectedItem();
      if (item.equals(PCAOp.EIGENVALUE_THRESHOLD)) {
        enableEigenvalueThreshold(true);
        enableNumberOfEigenvalues(false);
      } else {
        enableEigenvalueThreshold(false);
        enableNumberOfEigenvalues(true);
      }
    } else {
      selectEigenvaluesBy.setVisible(false);
      selectEigenvaluesByLabel.setVisible(false);
      enableEigenvalueThreshold(false);
      enableNumberOfEigenvalues(false);
    }
  }
コード例 #10
0
ファイル: AnimationWidget.java プロジェクト: nbearson/IDV
  /**
   * 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);
    }
  }
コード例 #11
0
ファイル: AnimationWidget.java プロジェクト: nbearson/IDV
  /** _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;
    }
  }
コード例 #12
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);
   }
 }
コード例 #13
0
  public FileTypePatternDialog(
      @Nullable String initialPatterns, FileType fileType, Language templateDataLanguage) {
    myPatternField.setText(initialPatterns);

    if (fileType instanceof TemplateLanguageFileType) {
      final DefaultComboBoxModel model = (DefaultComboBoxModel) myLanguageCombo.getModel();
      model.addElement(null);
      final List<Language> languages = TemplateDataLanguageMappings.getTemplateableLanguages();
      Collections.sort(
          languages,
          new Comparator<Language>() {
            @Override
            public int compare(final Language o1, final Language o2) {
              return o1.getID().compareTo(o2.getID());
            }
          });
      for (Language language : languages) {
        model.addElement(language);
      }
      myLanguageCombo.setRenderer(
          new ListCellRendererWrapper() {
            @Override
            public void customize(
                JList list, Object value, int index, boolean selected, boolean hasFocus) {
              setText(value == null ? "" : ((Language) value).getDisplayName());
              if (value != null) {
                final FileType type = ((Language) value).getAssociatedFileType();
                if (type != null) {
                  setIcon(type.getIcon());
                }
              }
            }
          });
      myLanguageCombo.setSelectedItem(templateDataLanguage);
    } else {
      myLanguageCombo.setVisible(false);
      myTemplateDataLanguageButton.setVisible(false);
    }
  }
コード例 #14
0
  @Override
  protected JComponent createCenterPanel() {
    myTitledSeparator.setText(myAnalysisNoon);

    // include test option
    myInspectTestSource.setSelected(myAnalysisOptions.ANALYZE_TEST_SOURCES);

    // module scope if applicable
    myModuleButton.setText(
        AnalysisScopeBundle.message("scope.option.module.with.mnemonic", myModuleName));
    boolean useModuleScope = false;
    if (myModuleName != null) {
      useModuleScope = myAnalysisOptions.SCOPE_TYPE == AnalysisScope.MODULE;
      myModuleButton.setSelected(myRememberScope && useModuleScope);
    }

    myModuleButton.setVisible(
        myModuleName != null && ModuleManager.getInstance(myProject).getModules().length > 1);

    boolean useUncommitedFiles = false;
    final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    final boolean hasVCS = !changeListManager.getAffectedFiles().isEmpty();
    if (hasVCS) {
      useUncommitedFiles = myAnalysisOptions.SCOPE_TYPE == AnalysisScope.UNCOMMITTED_FILES;
      myUncommitedFilesButton.setSelected(myRememberScope && useUncommitedFiles);
    }
    myUncommitedFilesButton.setVisible(hasVCS);

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    model.addElement(ALL);
    final List<? extends ChangeList> changeLists = changeListManager.getChangeListsCopy();
    for (ChangeList changeList : changeLists) {
      model.addElement(changeList.getName());
    }
    myChangeLists.setModel(model);
    myChangeLists.setEnabled(myUncommitedFilesButton.isSelected());
    myChangeLists.setVisible(hasVCS);

    // file/package/directory/module scope
    if (myFileName != null) {
      myFileButton.setText(myFileName);
      myFileButton.setMnemonic(myFileName.charAt(getSelectedScopeMnemonic()));
    } else {
      myFileButton.setVisible(false);
    }

    VirtualFile file = PsiUtilBase.getVirtualFile(myContext);
    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    boolean searchInLib =
        file != null && (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file));

    String preselect =
        StringUtil.isEmptyOrSpaces(myAnalysisOptions.CUSTOM_SCOPE_NAME)
            ? FindSettings.getInstance().getDefaultScopeName()
            : myAnalysisOptions.CUSTOM_SCOPE_NAME;
    if (searchInLib
        && GlobalSearchScope.projectScope(myProject).getDisplayName().equals(preselect)) {
      preselect = GlobalSearchScope.allScope(myProject).getDisplayName();
    }
    if (GlobalSearchScope.allScope(myProject).getDisplayName().equals(preselect)
        && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.CUSTOM) {
      myAnalysisOptions.CUSTOM_SCOPE_NAME = preselect;
      searchInLib = true;
    }

    // custom scope
    myCustomScopeButton.setSelected(
        myRememberScope && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.CUSTOM);

    myScopeCombo.init(myProject, searchInLib, true, preselect);

    // correct selection
    myProjectButton.setSelected(
        myRememberScope && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.PROJECT
            || myFileName == null);
    myFileButton.setSelected(
        myFileName != null
            && (!myRememberScope
                || myAnalysisOptions.SCOPE_TYPE != AnalysisScope.PROJECT
                    && !useModuleScope
                    && myAnalysisOptions.SCOPE_TYPE != AnalysisScope.CUSTOM
                    && !useUncommitedFiles));

    myScopeCombo.setEnabled(myCustomScopeButton.isSelected());

    final ActionListener radioButtonPressed =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            onScopeRadioButtonPressed();
          }
        };
    final Enumeration<AbstractButton> enumeration = myGroup.getElements();
    while (enumeration.hasMoreElements()) {
      enumeration.nextElement().addActionListener(radioButtonPressed);
    }

    // additional panel - inspection profile chooser
    JPanel wholePanel = new JPanel(new BorderLayout());
    wholePanel.add(myPanel, BorderLayout.NORTH);
    final JComponent additionalPanel = getAdditionalActionSettings(myProject);
    if (additionalPanel != null) {
      wholePanel.add(additionalPanel, BorderLayout.CENTER);
    }
    new RadioUpDownListener(
        myProjectButton,
        myModuleButton,
        myUncommitedFilesButton,
        myFileButton,
        myCustomScopeButton);
    return wholePanel;
  }
コード例 #15
0
ファイル: AnimationWidget.java プロジェクト: nbearson/IDV
 /**
  * Show the date box
  *
  * @param v true to show
  */
 public void showDateBox(boolean v) {
   timesCbxVisible = v;
   if (timesCbx != null) {
     timesCbx.setVisible(v);
   }
 }
コード例 #16
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
  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);
  }
コード例 #17
0
  public CreateXmlResourceDialog(
      @NotNull Module module,
      @NotNull ResourceType resourceType,
      @Nullable String predefinedName,
      @Nullable String predefinedValue,
      boolean chooseName,
      @Nullable VirtualFile defaultFile) {
    super(module.getProject());
    myResourceType = resourceType;

    if (predefinedName != null && predefinedName.length() > 0) {
      if (!chooseName) {
        myNameLabel.setVisible(false);
        myNameField.setVisible(false);
      }
      myNameField.setText(predefinedName);
    }

    if (predefinedValue != null && predefinedValue.length() > 0) {
      myValueLabel.setVisible(false);
      myValueField.setVisible(false);
      myValueField.setText(predefinedValue);
    }
    final Set<Module> modulesSet = new HashSet<Module>();
    modulesSet.add(module);

    for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) {
      modulesSet.add(depFacet.getModule());
    }

    assert modulesSet.size() > 0;

    if (modulesSet.size() == 1) {
      myModule = module;
      myModuleLabel.setVisible(false);
      myModuleCombo.setVisible(false);
    } else {
      myModule = null;

      final Module[] modules = modulesSet.toArray(new Module[modulesSet.size()]);
      Arrays.sort(
          modules,
          new Comparator<Module>() {
            @Override
            public int compare(Module m1, Module m2) {
              return m1.getName().compareTo(m2.getName());
            }
          });

      myModuleCombo.setModel(new DefaultComboBoxModel(modules));
      myModuleCombo.setSelectedItem(module);
      myModuleCombo.setRenderer(new ModuleListCellRendererWrapper(myModuleCombo.getRenderer()));
    }

    if (defaultFile == null) {
      final String defaultFileName = AndroidResourceUtil.getDefaultResourceFileName(resourceType);

      if (defaultFileName != null) {
        myFileNameCombo.getEditor().setItem(defaultFileName);
      }
    }
    myDirectoriesList = new CheckBoxList();
    myDirectoriesLabel.setLabelFor(myDirectoriesList);
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myDirectoriesList);

    decorator.setEditAction(null);
    decorator.disableUpDownActions();

    decorator.setAddAction(
        new AnActionButtonRunnable() {
          @Override
          public void run(AnActionButton button) {
            doAddNewDirectory();
          }
        });

    decorator.setRemoveAction(
        new AnActionButtonRunnable() {
          @Override
          public void run(AnActionButton button) {
            doDeleteDirectory();
          }
        });

    final AnActionButton selectAll =
        new AnActionButton("Select All", null, PlatformIcons.SELECT_ALL_ICON) {
          @Override
          public void actionPerformed(AnActionEvent e) {
            doSelectAllDirs();
          }
        };
    decorator.addExtraAction(selectAll);

    final AnActionButton unselectAll =
        new AnActionButton("Unselect All", null, PlatformIcons.UNSELECT_ALL_ICON) {
          @Override
          public void actionPerformed(AnActionEvent e) {
            doUnselectAllDirs();
          }
        };
    decorator.addExtraAction(unselectAll);

    myDirectoriesPanel.add(decorator.createPanel());

    updateDirectories(true);

    myModuleCombo.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            updateDirectories(true);
          }
        });
    final JCheckBox valuesCheckBox = myCheckBoxes.get(SdkConstants.FD_RES_VALUES);
    if (valuesCheckBox != null) {
      valuesCheckBox.setSelected(true);
    }

    if (defaultFile != null) {
      resetFromFile(defaultFile, module.getProject());
    }
    init();
  }