Exemplo n.º 1
0
  private void fillGUI() {
    Object[] attributes;
    boolean enabled;
    if (context != null) {
      attributes = this.context.getAttributes().toArray();
      enabled = true;
    } else {
      attributes = new Object[] {"No context available"};
      enabled = false;
    }

    sequenceColumnChooser.setModel(new DefaultComboBoxModel(attributes));
    sequenceColumnChooser.setEnabled(enabled);

    timelineColumnChooser.setModel(new DefaultComboBoxModel(attributes));
    timelineColumnChooser.setEnabled(enabled);
    if (context != null) {
      timelineColumnChooser.setSelectedIndex(Math.min(attributes.length - 1, 1));
    }

    calculateValueLists();
    fillSequenceChooser();

    setButtonStates(!enabled);
  }
Exemplo n.º 2
0
  private void updateEnabled() {
    combo.setEnabled(action.isSelected());
    list.setEnabled(action.isSelected());

    boolean iconControlsEnabled = !separator.isSelected();
    builtin.setEnabled(iconControlsEnabled);
    file.setEnabled(iconControlsEnabled);
    builtinCombo.setEnabled(iconControlsEnabled && builtin.isSelected());
    fileButton.setEnabled(iconControlsEnabled && file.isSelected());
  }
 private void updateEnabledItems() {
   if (myRbExisting.isSelected()) {
     myExistingListsCombo.setEnabled(true);
     UIUtil.setEnabled(myNewListPanel, false, true);
     myExistingListsCombo.requestFocus();
   } else {
     myExistingListsCombo.setEnabled(false);
     UIUtil.setEnabled(myNewListPanel, true, true);
     myNewListPanel.requestFocus();
   }
   if (myProject != null) {
     myNewListPanel.nameChangedImpl(myProject, null);
   }
 }
Exemplo n.º 4
0
  public void setIndexer(LibrariesIndexer indexer) {
    this.indexer = indexer;

    DropdownItem<DownloadableContribution> previouslySelectedCategory = (DropdownItem<DownloadableContribution>) categoryChooser.getSelectedItem();
    DropdownItem<DownloadableContribution> previouslySelectedType = (DropdownItem<DownloadableContribution>) typeChooser.getSelectedItem();

    categoryChooser.removeActionListener(categoryChooserActionListener);
    typeChooser.removeActionListener(typeChooserActionListener);

    // TODO: Remove setIndexer and make getContribModel 
    // return a FilteredAbstractTableModel
    getContribModel().setIndexer(indexer);

    categoryFilter = null;
    categoryChooser.removeAllItems();

    // Load categories
    categoryChooser.addItem(new DropdownAllItem());
    Collection<String> categories = indexer.getIndex().getCategories();
    for (String category : categories) {
      categoryChooser.addItem(new DropdownLibraryOfCategoryItem(category));
    }

    categoryChooser.setEnabled(categoryChooser.getItemCount() > 1);

    categoryChooser.addActionListener(categoryChooserActionListener);
    if (previouslySelectedCategory != null) {
      categoryChooser.setSelectedItem(previouslySelectedCategory);
    } else {
      categoryChooser.setSelectedIndex(0);
    }

    typeFilter = null;
    typeChooser.removeAllItems();
    typeChooser.addItem(new DropdownAllItem());
    typeChooser.addItem(new DropdownInstalledLibraryItem(indexer.getIndex()));
    java.util.List<String> types = new LinkedList<String>(indexer.getIndex().getTypes());
    Collections.sort(types, new LibraryTypeComparator());
    for (String type : types) {
      typeChooser.addItem(new DropdownLibraryOfTypeItem(type));
    }
    typeChooser.setEnabled(typeChooser.getItemCount() > 1);
    typeChooser.addActionListener(typeChooserActionListener);
    if (previouslySelectedType != null) {
      typeChooser.setSelectedItem(previouslySelectedType);
    } else {
      typeChooser.setSelectedIndex(0);
    }

    filterField.setEnabled(contribModel.getRowCount() > 0);

    // Create LibrariesInstaller tied with the provided index
    installer = new LibraryInstaller(indexer, platform) {
      @Override
      public void onProgress(Progress progress) {
        setProgress(progress);
      }
    };
  }
Exemplo n.º 5
0
 private void loadStates() {
   boolean b = enableDefaultEncryption.isSelected();
   cboSavpOption.setEnabled(b);
   this.encryptionProtocolPreferences.setEnabled(b);
   enableSipZrtpAttribute.setEnabled(
       b && this.encryptionConfigurationTableModel.isEnabledLabel("ZRTP"));
   tabCiphers.setEnabled(b && this.encryptionConfigurationTableModel.isEnabledLabel("SDES"));
 }
Exemplo n.º 6
0
  @Override
  public void adoptElement(SceneElement elem) {
    if (!(elem instanceof NenyaImageSceneElement
        || elem instanceof NenyaTileSceneElement
        || elem instanceof NenyaComponentSceneElement)) {
      enableEditor(false);
      return;
    }

    DefaultComboBoxModel dcm = (DefaultComboBoxModel) itemList.getModel();

    // Important: Work on a copy, not on the original. Otherwise we mess up the undomanager
    sceneElement = elem.copy();

    if ((sceneElement instanceof NenyaImageSceneElement) && !locked) {
      dcm.removeAllElements();
      String[] tmp = ((NenyaImageSceneElement) sceneElement).getPath();
      dcm.addElement(tmp[tmp.length - 1]);
    }
    if ((sceneElement instanceof NenyaTileSceneElement) && !locked) {
      dcm.removeAllElements();
      dcm.addElement(((NenyaTileSceneElement) sceneElement).getTileName());
    }
    if ((sceneElement instanceof NenyaComponentSceneElement) && !locked) {
      dcm.removeAllElements();
      NenyaComponentItem[] ni = ((NenyaComponentSceneElement) sceneElement).getComponents();
      for (NenyaComponentItem element : ni) {
        dcm.addElement(element);
      }
    }

    try {
      ClassedItem[] cols = null;
      if (elem instanceof NenyaTileSceneElement)
        cols = ((NenyaTileSceneElement) elem).getColorList();
      if (elem instanceof NenyaImageSceneElement)
        cols = ((NenyaImageSceneElement) elem).getColorList();
      if (elem instanceof NenyaComponentSceneElement) {
        NenyaComponentItem nci = (NenyaComponentItem) dcm.getSelectedItem();
        cols = nci.getColorList();
      }
      Vector<TreePath> collect = new Vector<TreePath>();
      TreeNode root = (TreeNode) colors.getModel().getRoot();
      for (ClassedItem col : cols) {
        String[] tmp = {root.toString(), col.getClassName(), col.getItemName()};
        collect.add(TreeUtil.findPath(root, tmp));
      }
      TreePath[] path = collect.toArray(new TreePath[0]);
      colors.getSelectionModel().setSelectionPaths(path);
    } catch (Exception e) {
      // Either the tree is filtered away or the selected item is not colorized.
    }

    enableEditor(true);
    itemList.setEnabled(elem instanceof NenyaComponentSceneElement);
  }
 @NotNull
 JComponent createComponent() {
   myRemoteCombobox = new JComboBox();
   myRemoteCombobox.setRenderer(new RemoteCellRenderer(myRemoteCombobox.getRenderer()));
   for (GitRemote remote : myRemotes) {
     myRemoteCombobox.addItem(remote);
   }
   myRemoteCombobox.setToolTipText("Select remote");
   if (myRemotes.size() == 1) {
     myRemoteCombobox.setEnabled(false);
   }
   return myRemoteCombobox;
 }
 public void updateLists(List<? extends ChangeList> lists) {
   //noinspection unchecked
   myChooser.setModel(new DefaultComboBoxModel(lists.toArray()));
   myChooser.setEnabled(lists.size() > 1);
   if (lists.contains(mySelectedChangeList)) {
     myChooser.setSelectedItem(mySelectedChangeList);
   } else {
     if (myChooser.getItemCount() > 0) {
       myChooser.setSelectedIndex(0);
     }
   }
   mySelectedChangeList = (ChangeList) myChooser.getSelectedItem();
 }
Exemplo n.º 9
0
  public LibraryManagerUI(Frame parent, Platform platform) {
    super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues."));
    this.platform = platform;

    filtersContainer.add(new JLabel(_("Topic")), 1);
    filtersContainer.remove(2);

    typeChooser = new JComboBox();
    typeChooser.setMaximumRowCount(20);
    typeChooser.setEnabled(false);

    filtersContainer.add(Box.createHorizontalStrut(5), 0);
    filtersContainer.add(new JLabel(_("Type")), 1);
    filtersContainer.add(Box.createHorizontalStrut(5), 2);
    filtersContainer.add(typeChooser, 3);
  }
  private void completePanel() {
    if (criterion != null) {
      jtfCode.setText(criterion.getCode());
      jtfCode.setEditable(false);
      jtfLibelle.setText(criterion.getLibelle());

      jcbSortOrder.setSelectedIndex((criterion.getSortOrder() > 0) ? 0 : 1);

      jcbPlacementCriterion.setSelected(criterion.isPlacement());
      jcbClassementCriterion.setSelected(criterion.isClassement());

      jcbSortOrder.setEnabled(!parent.getWorkConfiguration().isOfficialProfile());
      jcbPlacementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile());
      jcbClassementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile());
    }
  }
Exemplo n.º 11
0
  private void updateParams(EDPCellData data) {
    paramComboBox.removeAllItems();
    paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor);
    if (!m_isCrawlRuleEditor) {
      paramComboBox.addItem(STRING_LITERAL);
    }

    for (Iterator it = paramKeys.values().iterator(); it.hasNext(); ) {
      ConfigParamDescr descr = (ConfigParamDescr) it.next();
      int type = descr.getType();
      if (!m_isCrawlRuleEditor
          && (type == ConfigParamDescr.TYPE_SET || type == ConfigParamDescr.TYPE_RANGE)) continue;
      paramComboBox.addItem(descr);
    }
    paramComboBox.setEnabled(true);
    paramComboBox.setSelectedIndex(0);
    paramComboBox.setToolTipText("Select a parameter to insert into the format string");
    insertButton.setEnabled(true);
  }
  private StaticPanel createStaticComboBoxPanel(
      PrimitiveForm primitiveForm, DOTProperty property, String labelText, Object[] items) {
    JLabel label = new JLabel(labelText);
    JComboBox comboBox = new JComboBox(items);
    comboBox.setMaximumSize(new Dimension(300, 25));
    comboBox.setEnabled(_dotDefinitionDialogFrame.isEditable());

    StaticPanel thePanel = new StaticPanel(primitiveForm, property);
    thePanel.setMaximumSize(new Dimension(300, 25));
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(label);
    thePanel.add(comboBox);
    SpringUtilities.makeCompactGrid(thePanel, 2, 5, 5);

    thePanel.setValue(comboBox);
    thePanel.addListener(comboBox);

    return thePanel;
  }
Exemplo n.º 13
0
 private void enableEditor(boolean enable) {
   colors.setEnabled(enable);
   lumberjackAction.setEnabled(enable);
   itemList.setEnabled(enable);
 }
  @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;
  }
 private void onScopeRadioButtonPressed() {
   myScopeCombo.setEnabled(myCustomScopeButton.isSelected());
   myChangeLists.setEnabled(myUncommitedFilesButton.isSelected());
 }
 private void setEnabledOptions() {
   intervalFormattedTextField.setEnabled(scheduledRadioButton.isSelected());
   intervalUnitComboBox.setEnabled(scheduledRadioButton.isSelected());
   everyLabel.setEnabled(scheduledRadioButton.isSelected());
   onDemandLabel.setEnabled(onDemandRadioButton.isSelected());
 }
Exemplo n.º 17
0
 public void setEditable(boolean editable) {
   m_comboBox.setEditable(editable);
   m_comboBox.setEnabled(editable);
 }
  private void calcTypeComboAction(ActionEvent e) {
    String comboCalcType = (String) calcTypeCombo.getSelectedItem();
    ObjEntity objEntity = objEntityViewField.getObjEntityView().getObjEntity();

    if (comboCalcType.equals("No Calculation")) {
      objEntityViewField.setCalcType("nocalc");

      objRelationshipCombo.setEnabled(false);
      lookupViewCombo.setEnabled(false);
      lookupFieldCombo.setEnabled(false);

      ObjAttribute nullAttribute = null;
      java.util.List attributes = new ArrayList();
      attributes.add(nullAttribute);
      if (objEntity != null) {
        attributes.addAll(objEntity.getObjAttributes());
      }

      DefaultComboBoxModel attributesDefaultModel = new DefaultComboBoxModel(attributes.toArray());
      objAttributeCombo.setModel(attributesDefaultModel);
      objAttributeCombo.setEnabled(true);
      if (objEntity != null) {
        if (objEntityViewField.getObjAttribute() != null) {
          objAttributeCombo.setSelectedItem(objEntityViewField.getObjAttribute());
        } else {
          objAttributeCombo.setSelectedIndex(0);
        }
      } else {
        objAttributeCombo.setSelectedIndex(0);
      }
    }
    if (comboCalcType.equals("Lookup")) {
      objEntityViewField.setCalcType("lookup");

      objAttributeCombo.setEnabled(false);
      objRelationshipCombo.setEnabled(true);
      lookupViewCombo.setEnabled(true);
      lookupFieldCombo.setEnabled(true);

      ObjRelationship nullRelationship = null;
      java.util.List relationships = new ArrayList();
      relationships.add(nullRelationship);
      if (objEntity != null) {
        relationships.addAll(objEntity.getDataMap().getObjRelationshipsBySourceToOne(objEntity));
      }

      DefaultComboBoxModel relationshipsDefaultModel =
          new DefaultComboBoxModel(relationships.toArray());
      objRelationshipCombo.setModel(relationshipsDefaultModel);

      ObjRelationship fieldRelationship = objEntityViewField.getObjRelationship();
      if (fieldRelationship != null) {
        boolean flagSetSelectedItem = false;
        for (Iterator itr = relationships.iterator(); itr.hasNext(); ) {
          ObjRelationship relationship = (ObjRelationship) itr.next();
          if ((relationship != null)
              && (fieldRelationship.getName().equals(relationship.getName()))) {
            objRelationshipCombo.setSelectedItem(fieldRelationship);
            flagSetSelectedItem = true;
            break;
          }
        }
        if (!flagSetSelectedItem) {
          objRelationshipCombo.setSelectedIndex(0);
        }
      } else {
        objRelationshipCombo.setSelectedIndex(0);
      }
    }
  }
 void setEnabled(boolean selected) {
   if (myRemotes.size() > 1) {
     myRemoteCombobox.setEnabled(selected);
   }
 }