Пример #1
0
  public void populate() {
    productLines = model.getProductLines();
    suppliers = model.getSuppliers();
    createMap();
    products = model.getProducts();

    if (iProductLineList.getItemCount() != 0) {
      iProductLineList.removeAllItems();
    }

    iProductLineList.addItem(" ");
    for (ProductLine productLine : productLines) {
      iProductLineList.addItem(productLine.getProductLineName());
    }

    if (iSupplierList.getItemCount() != 0) {
      iSupplierList.removeAllItems();
    }

    iSupplierList.addItem(" ");
    for (Supplier supplier : suppliers) {
      iSupplierList.addItem(supplier.getSupplierName());
    }

    populateTable();
  }
Пример #2
0
 /**
  * Decoder identify has not matched specific types, but did find manufacturer match
  *
  * @param pMfg Manufacturer name. This is passed to save time, as it has already been determined
  *     once.
  * @param pMfgID Manufacturer ID number (CV8)
  * @param pModelID Model ID number (CV7)
  */
 void updateForDecoderMfgID(String pMfg, int pMfgID, int pModelID) {
   String msg =
       "Found mfg " + pMfgID + " (" + pMfg + ") version " + pModelID + "; no such decoder defined";
   log.warn(msg);
   _statusLabel.setText(msg);
   // try to select all decoders from that MFG
   JComboBox<String> temp =
       DecoderIndexFile.instance()
           .matchingComboBox(null, null, Integer.toString(pMfgID), null, null, null);
   if (log.isDebugEnabled()) {
     log.debug("mfg-only selectDecoder found " + temp.getItemCount() + " matches");
   }
   // install all those in the JComboBox in place of the longer, original list
   if (temp.getItemCount() > 0) {
     decoderBox.setModel(temp.getModel());
     decoderBox.insertItemAt("<from locomotive settings>", 0);
     decoderBox.setSelectedIndex(1);
   } else {
     // if there are none from this mfg, go back to showing everything
     temp = DecoderIndexFile.instance().matchingComboBox(null, null, null, null, null, null);
     decoderBox.setModel(temp.getModel());
     decoderBox.insertItemAt("<from locomotive settings>", 0);
     decoderBox.setSelectedIndex(1);
   }
 }
Пример #3
0
  /**
   * Handle a refresh of the style panel after the fig has moved.
   *
   * <p><em>Warning</em>. There is a circular trap here. Editing the boundary box will also trigger
   * a refresh, and so we reset the boundary box, which causes funny behaviour (the cursor keeps
   * jumping to the end of the text).
   *
   * <p>The solution is to not reset the boundary box field if the boundaries have not changed.
   *
   * <p>
   */
  public void refresh() {
    Fig target = getPanelTarget();
    if (target instanceof FigEdgeModelElement) {
      hasEditableBoundingBox(false);
    } else {
      hasEditableBoundingBox(true);
    }
    if (target == null) return;

    // The boundary box as held in the target fig, and as listed in
    // the
    // boundary box style field (null if we don't have anything
    // valid)

    Rectangle figBounds = target.getBounds();
    Rectangle styleBounds = parseBBox();

    // Only reset the text if the two are not the same (i.e the fig
    // has
    // moved, rather than we've just edited the text, when
    // setTargetBBox()
    // will have made them the same). Note that styleBounds could
    // be null,
    // so we do the test this way round.

    if (!(figBounds.equals(styleBounds))) {
      bboxField.setText(
          figBounds.x + "," + figBounds.y + "," + figBounds.width + "," + figBounds.height);
    }

    // Change the fill colour

    if (target.getFilled()) {
      Color c = target.getFillColor();
      fillField.setSelectedItem(c);
      if (c != null && !fillField.getSelectedItem().equals(c)) {
        fillField.insertItemAt(c, fillField.getItemCount() - 1);
        fillField.setSelectedItem(c);
      }
    } else {
      fillField.setSelectedIndex(0);
    }

    // Change the line colour

    if (target.getLineWidth() > 0) {
      Color c = target.getLineColor();
      lineField.setSelectedItem(c);
      if (c != null && !lineField.getSelectedItem().equals(c)) {
        lineField.insertItemAt(c, lineField.getItemCount() - 1);
        lineField.setSelectedItem(c);
      }
    } else {
      lineField.setSelectedIndex(0);
    }
  }
Пример #4
0
  @Override
  public JComponent getVisualisation(DataBean data) throws Exception {

    this.data = data;

    refreshAxisBoxes(data);

    List<Variable> vars = getFrame().getVariables();
    if (vars == null || vars.size() < 2) {
      if (xBox.getItemCount() >= 1) {
        xBox.setSelectedIndex(0);
      }
      if (yBox.getItemCount() >= 2) {
        yBox.setSelectedIndex(1);
      } else {
        yBox.setSelectedIndex(0);
      }
    } else {
      xBox.setSelectedItem(vars.get(0));
      yBox.setSelectedItem(vars.get(1));
    }

    xVar = (Variable) xBox.getSelectedItem();
    yVar = (Variable) yBox.getSelectedItem();

    PlotDescription description =
        new PlotDescription(data.getName(), xVar.getName(), yVar.getName());

    NumberAxis domainAxis = new NumberAxis(description.xTitle);
    domainAxis.setAutoRangeIncludesZero(false);
    NumberAxis rangeAxis = new NumberAxis(description.yTitle);
    rangeAxis.setAutoRangeIncludesZero(false);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setLinesVisible(false);
    renderer.setShapesVisible(true);
    renderer.setShape(new Ellipse2D.Float(-2, -2, 4, 4));
    renderer.setSeriesPaint(1, Color.black);

    plot = new XYPlot(new XYSeriesCollection(), domainAxis, rangeAxis, renderer);

    this.updateSelectionsFromApplication(false); // Calls also updateXYSerieses();

    JFreeChart chart = new JFreeChart(description.plotTitle, plot);

    application.addClientEventListener(this);

    selectableChartPanel = new SelectableChartPanel(chart, this);
    return selectableChartPanel;
  }
 @Test
 public void testGetFontComboBox() throws IOException {
   TextSymbolizerEditGUI textSymbolizerEditGUI =
       new TextSymbolizerEditGUI(tr, atlasStyler, STYLED_FS.getFeatureCollection());
   JComboBox jComboBoxFont = textSymbolizerEditGUI.getJComboBoxFont();
   assertEquals("default number of fonts is 5", 5, jComboBoxFont.getItemCount());
 }
  private JComboBox createParameterCombo(String operatorName, PropertyTable propertyTable) {
    JComboBox combo = new JComboBox();

    Operator operator = process.getOperator((String) operatorCombo.getSelectedItem());
    if (operator != null) {
      Iterator<ParameterType> i = operator.getParameters().getParameterTypes().iterator();
      while (i.hasNext()) {
        combo.addItem(i.next().getKey());
      }
    }

    if (combo.getItemCount() == 0) combo.addItem("no parameters");

    combo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            fireParameterChangedEvent();
            fireEditingStopped();
          }
        });

    combo.setSelectedIndex(0);

    return combo;
  }
Пример #7
0
  public JComboBox buildComboBox(String labelText, Object[] options, int numDefault) {
    JComboBox comboBox = buildComboBox(labelText, options); // call default
    if (numDefault > comboBox.getItemCount() - 1) {
      numDefault = 0;
    } else {
      comboBox.setSelectedIndex(numDefault);
    }
    // TODO: get renderer to truncate long names
    /*comboBox.setRenderer(new ListCellRenderer() {
        DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();

        public Component getListCellRendererComponent(JList list,
                Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if(index == -1 && value.toString().length() > 23) {
                renderer.setText(value.toString().substring(0, 23)+"...");
            } else {
                //renderer.setBounds(0, 0, 300, 20);
            }
            System.out.println(value+" "+index);
            return renderer;

        }
    });*/
    return comboBox;
  }
  public void verSudoku(String pId) {
    Sudoku sud = GestorSudokus.getGestor().buscarSudokuPorCodigo(Integer.parseInt(pId));
    String mSol = sud.toStringMatrizSolucion();
    String mInic = sud.toStringMatrizInicial();
    int dif = sud.getDificultad();
    boolean estaActivo = sud.getEstaActivo();
    String activo;
    if (estaActivo) {
      activo = "S";
      getPmBtnActivardesactivar().setText("Desactivar");
    } else {
      activo = "N";
      getPmBtnActivardesactivar().setText("Activar");
    }
    getPmLblIdNum().setText(pId);
    getPmCampoSudokuCompleto().setText(mSol);
    getPmCampoSudokuIncompleto().setText(mInic);
    getPmLblActivadoValor().setText(activo);

    JComboBox<String> cbox = getPmComboBoxDificultad();
    String aux;
    for (int i = 0; i < cbox.getItemCount(); i++) {
      aux = getPmComboBoxDificultad().getItemAt(i);
      if (aux.equals(dif + "")) getPmComboBoxDificultad().setSelectedItem(aux);
    }
  }
  public void selectDropDownStrategy(int index) {
    logger.debug("selectDropDownStrategy() index: " + index);

    if (getStrategiesList().size() != strategiesDropDown.getItemCount()) {
      return;
    }

    strategiesDropDown.setSelectedIndex(index);

    StrategyT tempStrategy = getStrategiesList().get(index);

    if (!strategiesDropDown
        .getItemAt(index)
        .equals(Atdl4jHelper.getStrategyUiRepOrName(tempStrategy))) {
      throw new IllegalStateException(
          "UNEXPECTED ERROR: strategiesDropDown.getItem("
              + index
              + "): "
              + strategiesDropDown.getItemAt(index)
              + " DID NOT MATCH tempStrategy: "
              + Atdl4jHelper.getStrategyUiRepOrName(tempStrategy));
    }

    fireStrategySelectedEvent(tempStrategy);
  }
 public void selectFirstDropDownStrategy() {
   if ((strategiesDropDown != null) && (strategiesDropDown.getItemCount() > 0)) {
     strategiesDropDown.setSelectedItem(null);
     logger.debug("selectFirstDropDownStrategy() invoking selectDropDownStrategy( 0 )");
     selectDropDownStrategy(0);
   }
 }
  /** Creates the combobox holding the channel list. */
  private void createComboBox() {
    Object[][] channelCols = new Object[channelName.size()][2];
    List<ChannelData> metadata = model.getMetadata();
    Iterator<ChannelData> i = metadata.iterator();
    ChannelData channelData;
    int channel;
    int index = 0;
    while (i.hasNext()) {
      channelData = i.next();
      channel = channelData.getIndex();
      if (channelName.containsKey(channel)) {
        channelCols[index] = new Object[] {channelColour.get(channel), channelName.get(channel)};
        index++;
      }
    }
    // if (channelCols.length == 0)
    // return;

    channelSelection.setModel(new DefaultComboBoxModel(channelCols));
    channelSelection.setRenderer(new ColorListRenderer());
    if (selectedChannelName != null)
      if (nameMap.containsKey(selectedChannelName))
        selectedChannel = nameMap.get(selectedChannelName);
      else selectedChannel = 0;
    else selectedChannel = 0;
    if (selectedChannel >= channelSelection.getItemCount() || selectedChannel < 0) return;
    channelSelection.setSelectedIndex(selectedChannel);
    channelSelection.setEnabled(true);
  }
  private void completePanel() {
    jlFederationLocaleNiveau.setText(profile.getConfiguration().getLangue());

    if (federation == null) return;

    jtfFederatonSigle.setText(federation.getSigleFederation());
    jtfFederatonName.setText(federation.getNomFederation());
    ccbCountryFederation.setSelectedCountry(federation.getCodeCountry());

    for (CompetitionLevel cl : federation.getCompetitionLevels()) {
      if (cl.getLang().equals(profile.getConfiguration().getLangue())) {
        String tmp = ""; // $NON-NLS-1$
        if (!jtfFederationNiveau.getText().isEmpty())
          tmp = jtfFederationNiveau.getText() + ","; // $NON-NLS-1$
        tmp += cl.getLibelle();
        jtfFederationNiveau.setText(tmp);
      } else {
        if (!mTraduction.containsKey(cl.getLang())) {
          addLocaleLevelField(cl.getLang());
          jcbAvailableLocale.removeItem(new Locale(cl.getLang()));
          if (jcbAvailableLocale.getItemCount() == 0) {
            jcbAvailableLocale.setEnabled(false);
            jbAddLocale.setEnabled(false);
          }
          jlAddLocaleInfo.setVisible(true);
        }
        String tmp = ""; // $NON-NLS-1$
        JTextField tmpTF = mTraduction.get(cl.getLang());
        if (!tmpTF.getText().isEmpty()) tmp = tmpTF.getText() + ","; // $NON-NLS-1$
        tmp += cl.getLibelle();
        tmpTF.setText(tmp);
      }
    }
  }
 private void nextButtonAction() {
   log.debug("next button activated");
   if (trackComboBox.getItemCount() > 1) {
     int index = trackComboBox.getSelectedIndex();
     // index = -1 if first item (null) in trainComboBox
     if (index == -1) {
       index = 1;
     } else {
       index++;
     }
     if (index >= trackComboBox.getItemCount()) {
       index = 0;
     }
     trackComboBox.setSelectedIndex(index);
   }
 }
Пример #14
0
  private void handleEntryAction(ActionEvent actionEvent)
      throws IOException, ParserConfigurationException, XPathExpressionException, SAXException,
          NoItemException {
    if (this.getGazetteer() == null) {
      Util.getLogger().severe("No gazeteer is registered");
      return;
    }

    String lookupString;

    JComboBox cmb = ((JComboBox) actionEvent.getSource());
    lookupString = cmb.getSelectedItem().toString();

    if (lookupString == null || lookupString.length() < 1) return;

    java.util.List<PointOfInterest> results = this.gazetteer.findPlaces(lookupString);
    if (results == null || results.size() == 0) return;

    this.controller.moveToLocation(results.get(0));

    // Add it to the list if not already there
    for (int i = 0; i < cmb.getItemCount(); i++) {
      Object oi = cmb.getItemAt(i);
      if (oi != null && oi.toString().trim().equals(lookupString)) return; // item exists
    }
    cmb.insertItemAt(lookupString, 0);
  }
Пример #15
0
  protected void jComboBoxItemStateChanged() {

    try {

      XYDataset dataset;
      String yTitle;

      if (comboBox.getItemCount() != 0) {

        dataset = createDataset(comboBox.getSelectedItem().toString());
        yTitle = comboBox.getSelectedItem().toString();
      } else {
        dataset = null;
        yTitle = new String();
      }

      createChart(dataset, chartTitle, xTitle, yTitle);

      chartPanel.removeAll();

      chartPanel.setChart(chart);

      chartPanel.repaint();

    } catch (Exception e) {
    }
  }
 public void setSelectedFile(String name) {
   for (int i = 0; i < cycleName.getItemCount(); i++) {
     if (cycleName.getItemAt(i).toString().equalsIgnoreCase(name)) {
       cycleName.setSelectedIndex(i);
     }
   }
 }
Пример #17
0
 public String[] getItems() {
   String[] res = new String[choice.getItemCount()];
   for (int i = 0; i < res.length; i++) {
     res[i] = (String) choice.getItemAt(i);
   }
   return res;
 }
 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);
   }
 }
Пример #19
0
  private void handleNavigationKeys(boolean suggest, int next, int sel, int max) {
    if (!suggest && !comboBox.isPopupVisible()) {
      comboBox.setPopupVisible(true);
      return;
    }

    if (comboBox.getItemCount() > 0) {
      if (next < 0) {
        next = 0;
      }

      if (next > max) {
        next = max;
      }

      if (next != sel) {
        if (suggest) {
          suggestionList.setSelectedIndex(next);
        } else {
          comboBox.setPopupVisible(true);
          comboBox.setSelectedIndex(next);
        }
      }
      textEditor.requestFocus();
    }
  }
Пример #20
0
  // 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());
  }
Пример #21
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);
      }
    };
  }
Пример #22
0
    EvolutionPanel() {
      super(new FlowLayout(FlowLayout.LEFT, 0, 0));
      Container innerPanel = new JPanel(new SpringLayout());

      populationLabel = new JLabel("Population Size: ");
      populationSpinner = new JSpinner(new SpinnerNumberModel(300, 2, 10000, 1));
      populationLabel.setLabelFor(populationSpinner);
      innerPanel.add(populationLabel);
      innerPanel.add(populationSpinner);

      elitismLabel = new JLabel("Elitism: ");
      elitismSpinner = new JSpinner(new SpinnerNumberModel(3, 0, 10000, 1));
      elitismLabel.setLabelFor(elitismSpinner);
      innerPanel.add(elitismLabel);
      innerPanel.add(elitismSpinner);

      generationsLabel = new JLabel("Number of Generations: ");
      generationsSpinner = new JSpinner(new SpinnerNumberModel(100, 1, 10000, 1));
      generationsLabel.setLabelFor(generationsSpinner);
      innerPanel.add(generationsLabel);
      innerPanel.add(generationsSpinner);

      selectionLabel = new JLabel("Selection Strategy: ");
      innerPanel.add(selectionLabel);

      SelectionStrategy<?>[] selectionStrategies = {
        new RankSelection(),
        new RouletteWheelSelection(),
        new StochasticUniversalSampling(),
        new TournamentSelection(new Probability(0.95)),
        new TruncationSelection(0.5)
      };

      selectionCombo = new JComboBox(selectionStrategies);
      selectionCombo.setRenderer(
          new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(
                JList list, Object value, int index, boolean isSelected, boolean hasFocus) {
              SelectionStrategy<?> strategy = (SelectionStrategy<?>) value;
              String text = strategy.getClass().getSimpleName();
              return super.getListCellRendererComponent(list, text, index, isSelected, hasFocus);
            }
          });
      selectionCombo.setSelectedIndex(selectionCombo.getItemCount() - 1);
      innerPanel.add(selectionCombo);

      crossoverCheckbox = new JCheckBox("Cross-over", true);
      mutationCheckbox = new JCheckBox("Mutation", true);
      distributedCheckbox = new JCheckBox("Distributed (Mahout)", false);

      innerPanel.add(crossoverCheckbox);
      innerPanel.add(mutationCheckbox);
      innerPanel.add(distributedCheckbox);
      innerPanel.add(new JLabel()); // pour avoir un nombre paire de components

      SpringUtilities.makeCompactGrid(innerPanel, 6, 2, 30, 6, 6, 6);
      add(innerPanel);
    }
Пример #23
0
 public static List getItems(JComboBox comboBox) {
   List result = new ArrayList();
   for (int i = 0; i < comboBox.getItemCount(); i++) {
     Object element = comboBox.getItemAt(i);
     result.add(element);
   }
   return result;
 }
 public void setMidiOutDevice(MidiDevice.Info midiOutDeviceInfo) {
   int n = _midiOutComboBox.getItemCount();
   for (int i = 0; i < n; i++) {
     if (((MidiDevice.Info) _midiOutComboBox.getItemAt(i)) == midiOutDeviceInfo) {
       _midiOutComboBox.setSelectedIndex(i);
     }
   }
 }
Пример #25
0
 private int getIndexByCustomer(String customerCode) {
   for (int i = 0; i < txtCustomer.getItemCount(); i++) {
     if (txtCustomer.getItemAt(i).getKey().equals(customerCode)) {
       return i;
     }
   }
   return 0;
 }
  @SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI
  public RasterAssetSetStep(
      TemplateWizardState state,
      @Nullable Project project,
      @Nullable Module module,
      @Nullable Icon sidePanelIcon,
      UpdateListener updateListener,
      @Nullable VirtualFile invocationTarget) {
    super(state, project, module, sidePanelIcon, updateListener, invocationTarget);

    // Speed the scrolling of myScrollPane
    myScrollPane.getVerticalScrollBar().setUnitIncrement(16);

    register(ATTR_TEXT, myText);
    register(ATTR_SCALING, myCropRadioButton, Scaling.CROP);
    register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER);
    register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE);
    register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE);
    register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE);
    register(ATTR_SHAPE, myVerticalRadioButton, GraphicGenerator.Shape.VRECT);
    register(ATTR_SHAPE, myHorizontalRadioButton, GraphicGenerator.Shape.HRECT);
    register(ATTR_DOGEAR, myDogEarEffectCheckBox);
    register(ATTR_PADDING, myPaddingSlider);
    register(ATTR_TRIM, myTrimBlankSpace);
    register(ATTR_FONT, myFontFamily);
    register(ATTR_SOURCE_TYPE, myImageRadioButton, AssetStudioAssetGenerator.SourceType.IMAGE);
    register(ATTR_SOURCE_TYPE, myClipartRadioButton, AssetStudioAssetGenerator.SourceType.CLIPART);
    register(ATTR_SOURCE_TYPE, myTextRadioButton, AssetStudioAssetGenerator.SourceType.TEXT);
    register(ATTR_FOREGROUND_COLOR, myForegroundColor);
    register(ATTR_BACKGROUND_COLOR, myBackgroundColor);
    register(ATTR_ASSET_TYPE, myAssetTypeComboBox);
    register(ATTR_ASSET_THEME, myChooseThemeComboBox);
    register(ATTR_ASSET_NAME, myResourceNameField);

    myImageFile.addBrowseFolderListener(
        null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
    myForegroundColor.setSelectedColor(Color.BLUE);
    myBackgroundColor.setSelectedColor(Color.WHITE);

    for (String font :
        GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) {
      myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1));
      if (font.equals(myTemplateState.get(ATTR_FONT))) {
        myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1);
      }
    }

    myChooseClipart.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            displayClipartDialog();
          }
        });

    populateComboBox(myAssetTypeComboBox, AssetType.class);
    populateComboBox(myChooseThemeComboBox, ActionBarIconGenerator.Theme.class);
  }
Пример #27
0
 /**
  * Prompts the user for a new custom color and adds that color to the combo box.
  *
  * @param field the combobox to enter a new color for
  * @param title the title for the dialog box
  * @param targetColor the initial Color set when the color-chooser is shown
  */
 protected void handleCustomColor(JComboBox field, String title, Color targetColor) {
   Color newColor = JColorChooser.showDialog(ArgoFrame.getInstance(), title, targetColor);
   if (newColor != null) {
     field.insertItemAt(newColor, field.getItemCount() - 1);
     field.setSelectedItem(newColor);
   } else if (getPanelTarget() != null) {
     field.setSelectedItem(targetColor);
   }
 }
Пример #28
0
 @Override
 public Parameter duplicate(String newLabel, String newId) {
   String[] values = new String[choice.getItemCount()];
   for (int i = 0; i < values.length; i++) {
     values[i] = (String) choice.getItemAt(i);
   }
   Object def = choice.getSelectedItem();
   return new ChoiceParameter(newLabel, newId, values, def != null ? (String) def : null);
 }
Пример #29
0
    public void valueChanged(TreeSelectionEvent arg0) {

      DefaultMutableTreeNode curTreeNode =
          (DefaultMutableTreeNode) ((MyTree) arg0.getSource()).getLastSelectedPathComponent();
      if (curTreeNode == null) return;

      if (!(curTreeNode.getUserObject() instanceof Caliber)) {
        return;
      }
      Caliber cal = (Caliber) curTreeNode.getUserObject();

      // 数据源组合框
      dataSourceCbx.setValue(cal.getACal().getSourceID());

      // 根据字段列名得到字段类型
      // cbxFieldName.setSelectedIndex(-1);
      JComboBox cbxFieldNameTmp = (JComboBox) cbxFieldName.getEditor();
      int count = cbxFieldNameTmp.getItemCount();
      String value;
      for (int i = 0; i < count; i++) {
        value = ((FComboBoxItem) cbxFieldNameTmp.getItemAt(i)).getValue().toString();
        if (value.substring(0, value.indexOf(":")).equals(cal.getACal().getSourceColID())) {
          cbxFieldName.setSelectedIndex(i);
          break;
        }
      }

      // 字段名称组合框
      // cbxFieldName.setValue(cal.getACal().getSourceColID());
      // 比较类型
      cbxCompare.setValue(cal.getACal().getCompareType());

      // 根据sFieldEname返回字段类型
      String sFieldTyp = getFieldType();
      // 根据字段类型判断参数加不加引号(')
      // 条件值
      if (DefinePub.checkCharVal(sFieldTyp)) {
        String paraValue = cal.getACal().getValue();
        // 判断是不是in或not in比较符
        if (CompareType.IN_TYPE.equalsIgnoreCase(cal.getACal().getCompareType())
            || CompareType.NOTIN_TYPE.equalsIgnoreCase(cal.getACal().getCompareType())) {
          // 去掉左右括号
          paraValue = paraValue.substring(1, paraValue.length() - 1);
          // 去掉逗号旁的引号
          paraValue = paraValue.replaceAll("','", ",");
        }
        // 去掉最外层引号
        cbxWhereValue.setValue(paraValue.substring(1, paraValue.length() - 1));

      } else {
        cbxWhereValue.setValue(cal.getACal().getValue());
      }

      // 定义条件类型
      if (!Common.isNullStr(cal.getACal().getJoinBefore()))
        frdoType.setValue(cal.getACal().getJoinBefore());
    }
Пример #30
0
 private void updateTypeComboBoxes() {
   CarTypes.instance().updateComboBox(comboBoxTypes);
   // remove car types not serviced by this location and track
   for (int i = comboBoxTypes.getItemCount() - 1; i >= 0; i--) {
     String type = comboBoxTypes.getItemAt(i);
     if (_track != null && !_track.acceptsTypeName(type)) {
       comboBoxTypes.removeItem(type);
     }
   }
   CarTypes.instance().updateComboBox(comboBoxShipTypes);
   // remove car types not serviced by this location and track
   for (int i = comboBoxShipTypes.getItemCount() - 1; i >= 0; i--) {
     String type = comboBoxShipTypes.getItemAt(i);
     if (_track != null && !_track.acceptsTypeName(type)) {
       comboBoxShipTypes.removeItem(type);
     }
   }
 }