private void resetSettings() {
    downloadDirectoryTextField.setText(Groovesquid.getConfig().getDownloadDirectory());
    maxParallelDownloadsSpinner.setValue(Groovesquid.getConfig().getMaxParallelDownloads());
    fileNameSchemeTextField.setText(Groovesquid.getConfig().getFileNameScheme());

    String[] downloadCompleteActions = Config.DownloadComplete.names();
    DefaultComboBoxModel downloadCompleteComboBoxModel = new DefaultComboBoxModel();
    downloadCompletedComboBox.setModel(downloadCompleteComboBoxModel);
    for (String downloadCompleteAction : downloadCompleteActions) {
      downloadCompleteComboBoxModel.addElement(I18n.getLocaleString(downloadCompleteAction));
    }
    downloadCompletedComboBox.setSelectedIndex(Groovesquid.getConfig().getDownloadComplete());

    String[] startTabs = Config.StartTab.names();
    DefaultComboBoxModel startTabComboBoxModel = new DefaultComboBoxModel();
    startTabComboBox.setModel(startTabComboBoxModel);
    for (String startTab : startTabs) {
      startTabComboBoxModel.addElement(I18n.getLocaleString(startTab));
    }
    startTabComboBox.setSelectedIndex(Groovesquid.getConfig().getStartTab());

    String[] fileExistsActions = Config.FileExists.names();
    DefaultComboBoxModel fileExistsComboBoxModel = new DefaultComboBoxModel();
    fileExistsComboBox.setModel(fileExistsComboBoxModel);
    for (String fileExistsAction : fileExistsActions) {
      fileExistsComboBoxModel.addElement(I18n.getLocaleString(fileExistsAction));
    }
    fileExistsComboBox.setSelectedIndex(Groovesquid.getConfig().getFileExists());

    if (Groovesquid.getConfig().getProxyHost() != null
        && Groovesquid.getConfig().getProxyPort() != null) {
      proxyHostTextField.setText(Groovesquid.getConfig().getProxyHost());
      proxyPortTextField.setText(Groovesquid.getConfig().getProxyPort().toString());
    }
  }
  // atualiza os dados gerias do automato
  protected void refresh() {
    // modelo de combobox para os estados existentes
    DefaultComboBoxModel<Estado> modelcb = new DefaultComboBoxModel<>();
    // modelo para a tabela de estados
    Object[][] o = new Object[a.getEstados().size()][2];
    int i = 0; // variavel para indicar a posi__o da linha na matriz
    for (Estado e : a.getEstados()) {
      modelcb.addElement(e);
      // se for incinicial aparece ->, se for final aparece (F), se for ambos, (F)->
      o[i][0] = (e.isFinal() ? "(f)" : "") + "" + (e.equals(a.getInicial()) ? "->" : "");
      o[i][1] = e.getNome();
      i++;
    }
    cbEstadosDestinos.setModel(modelcb);
    tblEstados.setModel(new DefaultTableModel(o, new String[] {"", ""}));

    // modelo para combox de simbolos do alfabeto
    DefaultComboBoxModel modelsim = new DefaultComboBoxModel();
    modelsim.addElement('E');
    for (char c : a.getAlfabeto()) {
      modelsim.addElement(c);
    }
    cbAlfabeto.setModel(modelsim);

    // atualiza o modelo texto do automato
    textArea.setText(a.toString());
    // atualiza o modelo gr_fico do automato
    painelView.repaint();
  }
  private void initOtherComponents() {
    Calendar now = Calendar.getInstance();
    toDatejSpinner.setValue(now.getTime());
    now.add(Calendar.MONTH, -6);
    fromDatejSpinner.setValue(now.getTime());

    exchangeJComboBox.setModel(
        new DefaultComboBoxModel(mainJFrame.mappingExchangeID_Assets.keySet().toArray()));
    exchangeComboKeyHandler = new ComboKeyHandler(exchangeJComboBox);
    JTextField fieldExchange = (JTextField) exchangeJComboBox.getEditor().getEditorComponent();
    fieldExchange.addKeyListener(exchangeComboKeyHandler);

    assetJComboBox.setModel(
        new DefaultComboBoxModel(
            mainJFrame.mappingExchangeID_Assets.get(
                (ExchangeEntity) exchangeJComboBox.getSelectedItem())));
    assetComboKeyHandler = new ComboKeyHandler(assetJComboBox);
    JTextField fieldSymbol = (JTextField) assetJComboBox.getEditor().getEditorComponent();
    fieldSymbol.addKeyListener(assetComboKeyHandler);

    asset = (AssetEntity) assetJComboBox.getSelectedItem();
    toDate = (Date) toDatejSpinner.getValue();
    fromDate = (Date) fromDatejSpinner.getValue();

    newAddDecAlgJDialog();
    newAddCriteriaJDialog();
    newImportPortfolioJDialog();
  }
  public ShiftEntryDialog(Shift shift) {
    super(Application.getInstance().getBackOfficeWindow(), true);
    setTitle(com.floreantpos.POSConstants.NEW_SHIFT);

    setContentPane(contentPane);
    getRootPane().setDefaultButton(buttonOK);

    hours = new Vector<Integer>();
    for (int i = 1; i <= 12; i++) {
      hours.add(Integer.valueOf(i));
    }

    mins = new Vector<Integer>();
    for (int i = 0; i < 60; i++) {
      mins.add(Integer.valueOf(i));
    }

    startHour.setModel(new DefaultComboBoxModel(hours));
    endHour.setModel(new DefaultComboBoxModel(hours));

    startMin.setModel(new DefaultComboBoxModel(mins));
    endMin.setModel(new DefaultComboBoxModel(mins));

    buttonOK.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onOK();
          }
        });

    buttonCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        });

    // call onCancel() when cross is clicked
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            onCancel();
          }
        });

    // call onCancel() on ESCAPE
    contentPane.registerKeyboardAction(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        },
        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    setSize(350, 250);

    setShift(shift);
  }
  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);
  }
Beispiel #6
0
  public KeHuChaXun() {
    super();
    setIconifiable(true);
    setClosable(true);
    setTitle("客户信息查询");
    getContentPane().setLayout(new GridBagLayout());
    setBounds(100, 100, 640, 375);

    table = new JTable();
    table.setEnabled(false);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    String[] tableHeads =
        new String[] {
          "客户ID", "客户全称", "客户地址", "客户简称", "邮政编码", "电  话", "传  真", "联  系  人", "联系电话", "E-Mail",
          "开户银行", "银行账号"
        };
    final DefaultTableModel dftm = (DefaultTableModel) table.getModel();
    dftm.setColumnIdentifiers(tableHeads);

    final JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setAutoscrolls(true);
    final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
    gridBagConstraints_6.weighty = 1.0;
    gridBagConstraints_6.insets = new Insets(0, 10, 5, 10);
    gridBagConstraints_6.fill = GridBagConstraints.BOTH;
    gridBagConstraints_6.gridwidth = 6;
    gridBagConstraints_6.gridy = 1;
    gridBagConstraints_6.gridx = 0;
    getContentPane().add(scrollPane, gridBagConstraints_6);

    setupComponet(new JLabel(" 选择查询条件:"), 0, 0, 1, 1, false);
    conditionBox1 = new JComboBox();
    conditionBox1.setModel(new DefaultComboBoxModel(new String[] {"客户全称", "客户简称"}));
    setupComponet(conditionBox1, 1, 0, 1, 30, true);

    conditionBox2 = new JComboBox();
    conditionBox2.setModel(new DefaultComboBoxModel(new String[] {"等于", "包含"}));
    setupComponet(conditionBox2, 2, 0, 1, 30, true);

    conditionContent = new JTextField();
    setupComponet(conditionContent, 3, 0, 1, 140, true);

    final JButton queryButton = new JButton();
    queryButton.addActionListener(new queryAction(dftm));
    queryButton.setText("查询");
    setupComponet(queryButton, 4, 0, 1, 1, false);

    showAllButton = new JButton();
    showAllButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            conditionContent.setText("");
            List list = Dao.getKhInfos();
            updateTable(list, dftm);
          }
        });
    setupComponet(showAllButton, 5, 0, 1, 1, false);
    showAllButton.setText("显示全部数据");
  }
Beispiel #7
0
  public void initUI() {
    scrollingToBottomCheckbox.setSelected(applicationPreferences.isScrollingToBottom());
    coloringWholeRowCheckbox.setSelected(applicationPreferences.isColoringWholeRow());
    showFullCallstackCheckbox.setSelected(applicationPreferences.isShowingFullCallstack());
    showStackTraceCheckbox.setSelected(applicationPreferences.isShowingStackTrace());
    usingWrappedExceptionStyleCheckbox.setSelected(
        applicationPreferences.isUsingWrappedExceptionStyle());

    // look and feel
    {
      ArrayList<String> lookAndFeels = new ArrayList<>();
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        lookAndFeels.add(info.getName());
      }
      Collections.sort(lookAndFeels);
      int selectedIndex = 0;
      String lookAndFeel = applicationPreferences.getLookAndFeel();
      if (lookAndFeel == null || "".equals(lookAndFeel)) {
        lookAndFeel = UIManager.getLookAndFeel().getName();
      }
      int idx = lookAndFeels.indexOf(lookAndFeel);
      if (idx > -1) {
        selectedIndex = idx;
      } else {
        idx = lookAndFeels.indexOf(ApplicationPreferences.STARTUP_LOOK_AND_FEEL);
        if (idx > -1) {
          selectedIndex = idx;
        }
      }
      lookAndFeelCombo.setModel(
          new DefaultComboBoxModel<>(lookAndFeels.toArray(new String[lookAndFeels.size()])));
      lookAndFeelCombo.setSelectedIndex(selectedIndex);
    }

    // default condition name
    {
      List<String> conditionNames = applicationPreferences.retrieveAllConditions();
      String defaultName = applicationPreferences.getDefaultConditionName();
      int idx = conditionNames.indexOf(defaultName);
      if (idx < 0) {
        idx = 0;
      }

      defaultConditionCombo.setModel(
          new DefaultComboBoxModel<>(conditionNames.toArray(new String[conditionNames.size()])));
      defaultConditionCombo.setSelectedIndex(idx);
    }
    String appPath = applicationPreferences.getApplicationPath().getAbsolutePath();
    appPathTextField.setText(appPath);
    appPathTextField.setToolTipText(appPath);

    globalLoggingEnabledCheckbox.setSelected(applicationPreferences.isGlobalLoggingEnabled());
    loggingStatsEnabledCheckbox.setSelected(applicationPreferences.isLoggingStatisticEnabled());
    trayActiveCheckbox.setSelected(applicationPreferences.isTrayActive());
    trayActiveCheckbox.setEnabled(TraySupport.isAvailable());
    hidingOnCloseCheckbox.setSelected(applicationPreferences.isHidingOnClose());
    hidingOnCloseCheckbox.setEnabled(TraySupport.isAvailable());
  }
 /*-------------------------------------------------------------------------*/
 public void initForeignKeys() {
   Vector<String> vec = new Vector<String>(Database.getInstance().getBodyParts().keySet());
   Collections.sort(vec);
   head.setModel(new DefaultComboBoxModel(vec));
   torso.setModel(new DefaultComboBoxModel(vec));
   leg.setModel(new DefaultComboBoxModel(vec));
   hand.setModel(new DefaultComboBoxModel(vec));
   foot.setModel(new DefaultComboBoxModel(vec));
 }
 private void updateComboBox() {
   if (dfmResults.isPresent()) {
     comboBox.setModel(toComboBoxModel(dfmResults.get().getDescriptions()));
     comboBox.setEnabled(true);
   } else {
     comboBox.setModel(new DefaultComboBoxModel());
     comboBox.setEnabled(false);
   }
 }
 public void loadTable() {
   fromUnit.removeAllItems();
   toUnit.removeAllItems();
   fromUnit.setModel(
       new DefaultComboBoxModel<String>(
           viewModel.unitList.toArray(new String[viewModel.unitList.size()])));
   toUnit.setModel(
       new DefaultComboBoxModel<String>(
           viewModel.unitList.toArray(new String[viewModel.unitList.size()])));
 }
  private void setComboBoxModels() {

    ArrayList<User> users = main.getPersons();
    userComboModel = new UserComboBoxModel(users);
    personsCombo.setModel(userComboModel);

    ArrayList<Group> groups = main.getGroups();
    groupComboModel = new GroupComboBoxModel(groups);
    groupCombo.setModel(groupComboModel);
  }
  private void updateView() {
    DefaultComboBoxModel algorithmModel = new DefaultComboBoxModel(model.getAlgorithmNames());
    cmbAlgorithmCombo.setModel(algorithmModel);

    DefaultComboBoxModel depthModel = new DefaultComboBoxModel(model.getDepth());
    cmbDepthCombo.setModel(depthModel);

    DefaultComboBoxModel evaluationModel = new DefaultComboBoxModel(model.getEvaluationNames());
    cmbEvaluationCombo.setModel(evaluationModel);
  }
Beispiel #13
0
 private void updateDisplayChoices() {
   String resolution = (String) displayResCombo.getSelectedItem();
   // grab available depths
   String[] depths = getDepths(resolution, modes);
   colorDepthCombo.setModel(new DefaultComboBoxModel(depths));
   colorDepthCombo.setSelectedItem(source.getDepth() + " bpp");
   // grab available frequencies
   String[] freqs = getFrequencies(resolution, modes);
   displayFreqCombo.setModel(new DefaultComboBoxModel(freqs));
   displayFreqCombo.setSelectedItem(source.getFrequency() + " Hz");
 }
  public inventoryReportDialog() {
    final inventoryReport invRep = loaders.loadInventoryReport();
    List<String> repDates = invRep.dates;
    String[] str_repDates = repDates.toArray(new String[repDates.size()]);

    setAlwaysOnTop(true);
    setResizable(false);
    setTitle("Inventory Report");
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 265, 180);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblStartDate = new JLabel("Start Date:");
    lblStartDate.setBounds(6, 12, 82, 16);
    contentPane.add(lblStartDate);

    JLabel lblEndDate = new JLabel("End Date:");
    lblEndDate.setBounds(6, 52, 67, 16);
    contentPane.add(lblEndDate);

    startField = new JComboBox();
    startField.setBounds(100, 6, 151, 28);
    startField.setModel(new DefaultComboBoxModel(str_repDates));
    startField.setSelectedIndex(repDates.size() - 1);
    contentPane.add(startField);

    endField = new JComboBox();
    endField.setBounds(100, 46, 151, 28);
    endField.setModel(new DefaultComboBoxModel(str_repDates));
    endField.setSelectedIndex(repDates.size() - 1);
    contentPane.add(endField);

    JLabel lblPleaseNoteDate = new JLabel("Please Note: Date format is yyyyMMdd.");
    lblPleaseNoteDate.setBounds(6, 80, 245, 21);
    contentPane.add(lblPleaseNoteDate);

    JButton btnGenerateReports = new JButton("Generate Report");
    btnGenerateReports.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            inventoryReportCreator.createReport(
                invRep, (String) startField.getSelectedItem(), (String) endField.getSelectedItem());
            setVisible(false);
            dispose();
          }
        });
    btnGenerateReports.setBounds(6, 113, 245, 29);
    contentPane.add(btnGenerateReports);
  }
  private void initComponents() {
    filterField = new JComboBox();
    createSortField();
    createFilterText();
    ascending = new JCheckBox("Ascending (uncheck = Descending)");
    JLabel filterLabel = new JLabel("Filter:");
    JLabel sortLabel = new JLabel("Sort:");

    filterField.setModel(new DefaultComboBoxModel(Task.getFields()));
    sortField.setModel(new DefaultComboBoxModel(Task.getFields()));
    ascending.setSelected(true);

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                    .addComponent(filterLabel)
                    .addComponent(sortLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(filterField)
                    .addComponent(sortField))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(filterText)
                    .addComponent(ascending)));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(filterLabel)
                    .addComponent(filterField)
                    .addComponent(filterText))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(sortLabel)
                    .addComponent(sortField)
                    .addComponent(ascending)));
  }
Beispiel #16
0
 private void LoadComboBoxPieces() {
   cmbWhitePlayer.setModel(
       new DefaultComboBoxModel(this.gameCtrl.getGame().getWhite().getPiecesAviables().toArray()));
   cmbBlackPlayer.setModel(
       new DefaultComboBoxModel(this.gameCtrl.getGame().getBlack().getPiecesAviables().toArray()));
   Piece pieceWhite = (Piece) cmbWhitePlayer.getSelectedItem();
   txtWhiteX.setText(String.valueOf(pieceWhite.getX()));
   txtWhiteY.setText(String.valueOf(pieceWhite.getY()));
   Piece pieceBlack = (Piece) cmbBlackPlayer.getSelectedItem();
   txtBlackX.setText(String.valueOf(pieceBlack.getX()));
   txtBlackY.setText(String.valueOf(pieceBlack.getY()));
   // cmbStoredGames.setModel(new DefaultComboBoxModel(getStoredGames().toArray()));
 }
  private void lookupViewComboAction(ActionEvent e) {
    ObjEntityView fieldLookupView = objEntityViewField.getLookup().getLookupObjEntityView();
    ObjEntityView selectedLookupView = (ObjEntityView) lookupViewCombo.getSelectedItem();

    if (selectedLookupView != fieldLookupView) {
      objEntityViewField.getLookup().setLookupObjEntityView(selectedLookupView);

      dataViewTreeModel.fieldChanged(objEntityViewField);
      dataMapTreeModel.fieldChanged(objEntityViewField);
      fieldsTableModel.fireTableCellUpdated(
          objEntityViewField.getObjEntityView().getIndexOfObjEntityViewField(objEntityViewField),
          4);
    }

    if (selectedLookupView != null) {
      ObjEntityViewField nullField = null;
      java.util.List lookupFields = new ArrayList();
      lookupFields.add(nullField);
      lookupFields.addAll(selectedLookupView.getObjEntityViewFields());

      DefaultComboBoxModel lookupFieldsDefaultModel =
          new DefaultComboBoxModel(lookupFields.toArray());
      lookupFieldCombo.setModel(lookupFieldsDefaultModel);
      ObjEntityViewField fieldLookupField = objEntityViewField.getLookup().getLookupField();
      if (fieldLookupField != null) {
        boolean flagSetSelectedItem = false;
        for (Iterator itr = lookupFields.iterator(); itr.hasNext(); ) {
          ObjEntityViewField field = (ObjEntityViewField) itr.next();
          if ((field != null) && (fieldLookupField.getName().equals(field.getName()))) {
            lookupFieldCombo.setSelectedItem(fieldLookupField);
            flagSetSelectedItem = true;
            break;
          }
        }
        if (!flagSetSelectedItem) {
          lookupFieldCombo.setSelectedIndex(0);
        }
      } else {
        lookupFieldCombo.setSelectedIndex(0);
      }
    } else {
      ObjEntityViewField nullField = null;
      ObjEntityViewField[] fields = new ObjEntityViewField[] {nullField};

      DefaultComboBoxModel fieldsModel = new DefaultComboBoxModel(fields);
      lookupFieldCombo.setModel(fieldsModel);
      lookupFieldCombo.setSelectedIndex(0);
    }
  }
Beispiel #18
0
  private void populateTileCombo() {
    DefaultComboBoxModel<String> dcbm = new DefaultComboBoxModel<String>();

    dcbm.addElement(String.format("%04d - Block Coin", LevelDrawer.BLOCK_COIN));
    dcbm.addElement(String.format("%04d - Block Empty", LevelDrawer.BLOCK_EMPTY));
    dcbm.addElement(String.format("%04d - Block Powerup", LevelDrawer.BLOCK_POWERUP));
    dcbm.addElement(String.format("%04d - Coin", LevelDrawer.COIN));
    dcbm.addElement(String.format("%04d - Ground", LevelDrawer.GROUND));
    dcbm.addElement(String.format("%04d - Hill Fill", LevelDrawer.HILL_FILL));
    dcbm.addElement(String.format("%04d - Hill Left", LevelDrawer.HILL_LEFT));
    dcbm.addElement(String.format("%04d - Hill Right", LevelDrawer.HILL_RIGHT));
    dcbm.addElement(String.format("%04d - Hill Top", LevelDrawer.HILL_TOP));
    dcbm.addElement(String.format("%04d - Hill Top Left", LevelDrawer.HILL_TOP_LEFT));
    dcbm.addElement(String.format("%04d - Hill Top Left In", LevelDrawer.HILL_TOP_LEFT_IN));
    dcbm.addElement(String.format("%04d - Hill Top Right", LevelDrawer.HILL_TOP_RIGHT));
    dcbm.addElement(String.format("%04d - Hill Top Right In", LevelDrawer.HILL_TOP_RIGHT_IN));
    dcbm.addElement(String.format("%04d - Left Grass Edge", LevelDrawer.LEFT_GRASS_EDGE));
    dcbm.addElement(String.format("%04d - Left Pocket Grass", LevelDrawer.LEFT_POCKET_GRASS));
    dcbm.addElement(String.format("%04d - Left Up Grass Edge", LevelDrawer.LEFT_UP_GRASS_EDGE));
    dcbm.addElement(String.format("%04d - Right Grass Edge", LevelDrawer.RIGHT_GRASS_EDGE));
    dcbm.addElement(String.format("%04d - Right Pocket Grass", LevelDrawer.RIGHT_POCKET_GRASS));
    dcbm.addElement(String.format("%04d - Right Up Grass Edge", LevelDrawer.RIGHT_UP_GRASS_EDGE));
    dcbm.addElement(String.format("%04d - Rock", LevelDrawer.ROCK));
    dcbm.addElement(String.format("%04d - Tube Side Left", LevelDrawer.TUBE_SIDE_LEFT));
    dcbm.addElement(String.format("%04d - Tube Side Right", LevelDrawer.TUBE_SIDE_RIGHT));
    dcbm.addElement(String.format("%04d - Tube Top Left", LevelDrawer.TUBE_TOP_LEFT));
    dcbm.addElement(String.format("%04d - Tube Top Right", LevelDrawer.TUBE_TOP_RIGHT));

    tileCombo.setModel(dcbm);
    tileCombo.setSelectedIndex(0);
    currentTile = LevelDrawer.BLOCK_COIN;
  }
Beispiel #19
0
  protected void updateClassType() {
    if (TRACE) System.out.println("# updating class " + m_goe.getClassType().getName());

    if (Proxy.isProxyClass(m_goe.getClassType())) {
      if (TRACE)
        System.out.println(
            "PROXY! original was "
                + ((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) m_goe.getValue())))
                    .getOriginalClass()
                    .getName());
      m_ClassesLongName =
          new Vector<String>(
              GenericObjectEditor.getClassesFromProperties(
                  ((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) m_goe.getValue())))
                      .getOriginalClass()
                      .getName()));
    } else {
      m_ClassesLongName =
          new Vector<String>(
              GenericObjectEditor.getClassesFromProperties(m_goe.getClassType().getName()));
    }
    m_ObjectChooser.setModel(new DefaultComboBoxModel(m_ClassesLongName));
    if (m_ClassesLongName.size() > 1) // testhu
    add(m_ObjectChooser, BorderLayout.NORTH);
    else remove(m_ObjectChooser);
    if (TRACE) System.out.println("# done updating class " + m_goe.getClassType().getName());
  }
  public void init() {
    if (initialized) {
      return;
    }
    initialized = true;
    final DefaultComboBoxModel<ExpressionMetaData> model =
        new DefaultComboBoxModel<ExpressionMetaData>();
    model.addElement(null);

    final ExpressionMetaData[] datas = ExpressionRegistry.getInstance().getAllExpressionMetaDatas();
    for (int i = 0; i < datas.length; i++) {
      final ExpressionMetaData expressionMetaData = datas[i];
      if (expressionMetaData.isHidden()) {
        continue;
      }
      if (WorkspaceSettings.getInstance().isShowExpertItems() == false
          && expressionMetaData.isExpert()) {
        continue;
      }
      if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false
          && expressionMetaData.isDeprecated()) {
        continue;
      }

      if (StructureFunction.class.isAssignableFrom(expressionMetaData.getExpressionType())) {
        model.addElement(expressionMetaData);
      }
    }
    expressionEditor.setModel(model);
  }
  protected void setFields() {

    final ComboBoxModel jComboBoxFieldModel =
        new DefaultComboBoxModel(
            Utils.getFieldLayerNumericFields(mapCtrl, (String) layerGriglia.getSelectedItem()));
    jComboBoxModelLayer.setModel(jComboBoxFieldModel);
  }
  private JComboBox getComboBox_ILC() {
    if (comboBox_ILC == null) {
      comboBox_ILC = new JComboBox();
      comboBox_ILC.setBounds(91, 119, 88, 21);
    }

    ArrayList<InterLayerConnection> ilcMember = interEdges.getInterLayerConnectionMember();
    ArrayList<String> targets = new ArrayList<String>();
    for (InterLayerConnection ilc : ilcMember) {
      State[] states = ilc.getInterConnects();
      if (states != null) {
        State target = null;
        if (states[0].equals(state)) {
          target = states[1];
        } else if (states[1].equals(state)) {
          target = states[0];
        } else {
          continue;
        }

        targets.add(target.getGmlID());
      }
    }

    if (!targets.isEmpty()) {
      String[] items = new String[targets.size()];
      items = targets.toArray(items);
      DefaultComboBoxModel model = new DefaultComboBoxModel(items);
      comboBox_ILC.setModel(model);
    }

    return comboBox_ILC;
  }
  private void refreshRanksCombo() {
    // Clear everything and start over! Wee!
    rankModel.removeAllElements();

    // Determine correct profession to pass into the loop
    int profession = Person.getProfessionFromPrimaryRole((choiceType.getSelectedIndex() + 1));
    while (campaign.getRanks().isEmptyProfession(profession) && profession != Ranks.RPROF_MW) {
      profession = campaign.getRanks().getAlternateProfession(profession);
    }

    for (Rank rank : campaign.getRanks().getAllRanks()) {
      int p = profession;
      // Grab rank from correct profession as needed
      while (rank.getName(p).startsWith("--") && p != Ranks.RPROF_MW) {
        if (rank.getName(p).equals("--")) {
          p = campaign.getRanks().getAlternateProfession(p);
        } else if (rank.getName(p).startsWith("--")) {
          p = campaign.getRanks().getAlternateProfession(rank.getName(p));
        }
      }
      if (rank.getName(p).equals("-")) {
        continue;
      }

      rankModel.addElement(rank.getName(p));
    }
    choiceRanks.setModel(rankModel);
    choiceRanks.setSelectedIndex(0);
  }
  /**
   * Sets internal model for this combo. If comboModelField is set, this method is useless (combo
   * model is automatically read from YModel).
   *
   * @param data the collection of POJOs
   */
  public void setComboModel(Collection data) {
    this.originalComboModel = data;
    int i = 0;
    if (addEmpty) {
      items = new YListItem[data.size() + 1];
      items[0] = emptyItem;
      i = 1;
    } else {
      items = new YListItem[data.size()];
    }
    Iterator it = data.iterator();
    while (it.hasNext()) {
      YListItem comboItem = new YListItem();
      if (formatter != null) {
        comboItem.setFormatter(formatter);
      }
      comboItem.setItemModel(it.next());
      items[i++] = comboItem;
    }
    if (sort) {
      Arrays.sort(items, YCoreToolkit.LEXICAL_COMPARATOR);
    }

    super.setModel(new DefaultComboBoxModel(items));
  }
  private void jComboBox1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jComboBox1ActionPerformed
    // crset1.setConnectionSource(pConnDB);
    //            crset1.execute("select description from st_stock_item where department =
    // '"+jComboBox1.getSelectedItem().toString()+"' order by description");
    cmbox2 = new javax.swing.JComboBox();
    cmbox3 = new javax.swing.JComboBox();

    cmbox2.setModel(
        com.afrisoftech.lib.ComboBoxModel.ComboBoxModel(
            connectDB,
            "select description from st_stock_item where department = '"
                + jComboBox1.getSelectedItem().toString()
                + "' order by description"));

    javax.swing.table.TableColumn seditor = this.jTable1.getColumn("Item Description");

    seditor.setCellEditor(new javax.swing.DefaultCellEditor(cmbox2));

    cmbox2.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent evt) {

            cmbox2ActionPerformed(evt);
          }
        });
    // Add your handling code here:
  } // GEN-LAST:event_jComboBox1ActionPerformed
Beispiel #26
0
  private void doneButtonMouseClicked(MouseEvent evt) {
    for (int i = 0; i < nodesetModel.size(); i++) {
      try {
        Node node = network.getNode(nodesetModel.get(i).toString());
        network.removeNode(node);
      } catch (CustomException e) {
        JOptionPane.showMessageDialog(
            this,
            "The node " + nodesetModel.get(i).toString() + " doesn't exist",
            "Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
    nodesetModel.removeAllElements();

    DefaultComboBoxModel nodesetComboBoxModel = new DefaultComboBoxModel();
    String str = "";
    Hashtable<String, Node> nodes = network.getNodes();
    Set<String> set = nodes.keySet();

    Iterator<String> itr = set.iterator();
    while (itr.hasNext()) {
      str = itr.next();
      nodesetComboBoxModel.addElement(nodes.get(str).getIdentifier());
    }
    nodesetComboBox.setModel(nodesetComboBoxModel);

    frame.getNodesTreePanel1().initGUI();
    frame.getNodesTreePanel1().validate();
    frame.getNodesTreePanel1().repaint();

    this.repaint();
    this.validate();
  }
 /*
  * (non-Javadoc)
  *
  * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
  */
 @Override
 public void update(Observable o, Object arg) {
   if (o instanceof qcevolutionbackend) {
     if (null != backend.getCurrentse()) {
       backend.getCurrentse().addObserver(this);
     }
   } else if (o instanceof ProblemManager) {
     Set<String> probs = backend.getProbmanager().getAvailableProblems();
     String[] options = new String[probs.size() + 1];
     options[0] = "Please Select Problem";
     int index = 1;
     Iterator<String> iter = probs.iterator();
     while (iter.hasNext()) {
       options[index++] = iter.next();
     }
     selection_model = new DefaultComboBoxModel(options);
     if (backend.getQproblem() != null) {
       String key = backend.getQproblem().getName();
       selection_model.setSelectedItem(key);
       description.setText(backend.getProbmanager().getSearchEngineDesc(key));
     }
     selection.setModel(selection_model);
   } else {
     if (backend.getCurrentse() != null) {
       if (backend.getCurrentse().getState() == SearchEngineState.Searching) {
         selection.setEnabled(false);
       } else {
         selection.setEnabled(true);
       }
       validate();
     }
   }
 }
Beispiel #28
0
  public TeamEntry(ITeam team, int relatedTeam) {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
            }));
    setBorder(
        new CompoundBorder(
            UIManager.getBorder("TitledBorder.aquaVariant"), new EmptyBorder(0, 5, 0, 5)));
    {
      JLabel lblTeamname = new JLabel("TeamName");
      if (team != null) {
        this.team = team;
        lblTeamname.setText(team.getName());
      }

      lblTeamname.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      add(lblTeamname, "2, 2, right, default");
    }
    {
      comboBox = new JComboBox();
      comboBox.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      comboBox.setModel(new DefaultComboBoxModel(new String[] {"Red", "Yellow", "Green", "Blue"}));
      if (relatedTeam >= 0 && relatedTeam < 4) {
        comboBox.setSelectedIndex(relatedTeam);
      }
      add(comboBox, "4, 2, fill, default");
    }
  }
Beispiel #29
0
  public static void bindModelToView(ArrayList fieldsToBind, DomainObject model) {

    BeanAdapter adapter = new BeanAdapter(model, true);
    ValueModel valueModel = null;
    Object field = null;
    ATFieldInfo fieldInfo;
    String fieldName = "";
    ComboBoxAdapter comboBoxAdapter = null;

    for (int i = 0; i < fieldsToBind.size(); i++) {
      field = fieldsToBind.get(i);
      fieldName = ((JComponent) field).getName();
      valueModel = adapter.getValueModel(fieldName);
      if (!ignoreArray.contains(fieldName)) {
        if (field instanceof JFormattedTextField) {
          Bindings.bind((JFormattedTextField) field, valueModel);
        } else if (field instanceof JTextComponent) {
          //						Bindings.bind((JTextComponent) field, valueModel);
        } else if (field instanceof JCheckBox) {
          Bindings.bind((JCheckBox) field, valueModel);
        } else if (field instanceof JComboBox) {
          fieldInfo = ATFieldInfo.getFieldInfo(model.getClass().getName() + "." + fieldName);
          if (fieldInfo != null) {
            Vector<String> values = LookupListUtils.getLookupListValues(fieldInfo.getLookupList());
            if (values != null) {
              comboBoxAdapter = new ComboBoxAdapter(values, valueModel);
              ((JComboBox) field).setModel(comboBoxAdapter);
            }
          }
        } else {
          System.out.println(fieldName + " not bound");
        }
      }
    }
  }
  public ColorMapVisualization(MRAPanel panel, String defaultEntity, String fieldToPlot) {
    this.logSource = panel.getSource();
    this.curEntity = defaultEntity;
    setLayout(new MigLayout());

    // Parse field to plot
    String part[] = fieldToPlot.split("\\.");
    messageName = part[0];
    varName = part[1];

    // Initialize entityList with the ALL shorthand
    entityList.add("ALL");

    // Misc setups and interface build
    redrawButton.addActionListener(this);
    entCombo.setModel(new DefaultComboBoxModel<String>(entityList));

    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(cmapMinValue);
    toolbar.add(cmapMaxValue);
    toolbar.add(cmapCombo);
    toolbar.add(entCombo);
    toolbar.add(redrawButton);
    toolbar.add(savePng);
    toolbar.add(savePdf);

    add(toolbar, "w 100%, wrap");
    add(container, "w 100%, h 100%");

    cmapCombo.setSelectedItem(ColorMapFactory.createJetColorMap());
    cmapCombo.setRenderer(new ColorMapListRenderer());

    revalidate();
  }