Exemple #1
0
  public SolverViewFrame(Frame frame) {
    identifierChooser = new JComboBoxEx();
    for (CharacterFacade pcf : CharacterManager.getCharacters()) {
      String pcname = pcf.getNameRef().get();
      CharID id = pcf.getCharID();
      identifierChooser.addItem(new PCRef(pcname, id));
    }
    identifierChooser.addActionListener(new IdentifierActionListener());

    objectChooser = new JComboBoxEx();
    objectChooser.addActionListener(new ObjectActionListener());

    scopeChooser = new JComboBoxEx();
    scopeChooser.addActionListener(new ScopeActionListener());

    identifierChooser.setSelectedItem(identifierChooser.getItemAt(0));
    scopeChooser.setSelectedItem(scopeChooser.getItemAt(0));

    varName = new JTextField();
    varName.setText(varNameText);
    varName.getDocument().addDocumentListener(new VarNameListener());

    initialize();
    objectChooser.setSelectedItem(objectChooser.getItemAt(0));
  }
Exemple #2
0
 private void updateObjects() {
   if (activeIdentifier != null) {
     Collection<VarScoped> objects = scopeFacet.getObjectsWithVariables(activeIdentifier);
     objectChooser.removeAllItems();
     String scopeName = selectedScope.getName();
     for (VarScoped cdo : objects) {
       if (cdo.getLocalScopeName().equals(scopeName)) {
         if (scopeFacet.get(activeIdentifier, selectedScope, cdo) != null) {
           objectChooser.addItem(new ObjectNameDisplayer(cdo));
         }
       }
     }
     if (objectChooser.getItemCount() != 0) {
       objectChooser.setSelectedIndex(0);
     }
   }
 }
Exemple #3
0
  /* (non-Javadoc)
   * @see pcgen.gui2.prefs.PreferencesPanel#initPreferences()
   */
  @Override
  public void applyOptionValuesToControls() {
    switch (SettingsHandler.getTabPlacement()) {
      case SwingConstants.TOP:
        mainTabPlacementCombo.setSelectedIndex(0);

        break;

      case SwingConstants.BOTTOM:
        mainTabPlacementCombo.setSelectedIndex(1);

        break;

      case SwingConstants.LEFT:
        mainTabPlacementCombo.setSelectedIndex(2);

        break;

      case SwingConstants.RIGHT:
        mainTabPlacementCombo.setSelectedIndex(3);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.applyOptionValuesToControls (tab placement) the tab option "
                + SettingsHandler.getTabPlacement()
                + " is unsupported.");

        break;
    }

    switch (SettingsHandler.getChaTabPlacement()) {
      case SwingConstants.TOP:
        charTabPlacementCombo.setSelectedIndex(0);

        break;

      case SwingConstants.BOTTOM:
        charTabPlacementCombo.setSelectedIndex(1);

        break;

      case SwingConstants.LEFT:
        charTabPlacementCombo.setSelectedIndex(2);

        break;

      case SwingConstants.RIGHT:
        charTabPlacementCombo.setSelectedIndex(3);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.applyOptionValuesToControls (cha tab placement) the tab option "
                + SettingsHandler.getChaTabPlacement()
                + " is unsupported.");

        break;
    }

    switch (SettingsHandler.getNameDisplayStyle()) {
      case Constants.DISPLAY_STYLE_NAME:
        tabLabelsCombo.setSelectedIndex(0);

        break;

      case Constants.DISPLAY_STYLE_NAME_CLASS:
        tabLabelsCombo.setSelectedIndex(1);

        break;

      case Constants.DISPLAY_STYLE_NAME_RACE:
        tabLabelsCombo.setSelectedIndex(2);

        break;

      case Constants.DISPLAY_STYLE_NAME_RACE_CLASS:
        tabLabelsCombo.setSelectedIndex(3);

        break;

      case Constants.DISPLAY_STYLE_NAME_FULL:
        tabLabelsCombo.setSelectedIndex(4);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.applyOptionValuesToControls (name display style) the tab option "
                + SettingsHandler.getNameDisplayStyle()
                + " is unsupported.");

        break;
    }

    displayAbilitiesAsTab.setSelected(SettingsHandler.isAbilitiesShownAsATab());
    expertGUICheckBox.setSelected(SettingsHandler.isExpertGUI());
  }
Exemple #4
0
  /* (non-Javadoc)
   * @see pcgen.gui2.prefs.PreferencesPanel#applyPreferences()
   */
  @Override
  public void setOptionsBasedOnControls() {
    switch (mainTabPlacementCombo.getSelectedIndex()) {
      case 0:
        SettingsHandler.setTabPlacement(SwingConstants.TOP);

        break;

      case 1:
        SettingsHandler.setTabPlacement(SwingConstants.BOTTOM);

        break;

      case 2:
        SettingsHandler.setTabPlacement(SwingConstants.LEFT);

        break;

      case 3:
        SettingsHandler.setTabPlacement(SwingConstants.RIGHT);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.setOptionsBasedOnControls (mainTabPlacementCombo) the index "
                + mainTabPlacementCombo.getSelectedIndex()
                + " is unsupported.");

        break;
    }

    switch (charTabPlacementCombo.getSelectedIndex()) {
      case 0:
        SettingsHandler.setChaTabPlacement(SwingConstants.TOP);

        break;

      case 1:
        SettingsHandler.setChaTabPlacement(SwingConstants.BOTTOM);

        break;

      case 2:
        SettingsHandler.setChaTabPlacement(SwingConstants.LEFT);

        break;

      case 3:
        SettingsHandler.setChaTabPlacement(SwingConstants.RIGHT);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.setOptionsBasedOnControls (charTabPlacementCombo) the index "
                + charTabPlacementCombo.getSelectedIndex()
                + " is unsupported.");

        break;
    }

    switch (tabLabelsCombo.getSelectedIndex()) {
      case 0:
        SettingsHandler.setNameDisplayStyle(Constants.DISPLAY_STYLE_NAME);

        break;

      case 1:
        SettingsHandler.setNameDisplayStyle(Constants.DISPLAY_STYLE_NAME_CLASS);

        break;

      case 2:
        SettingsHandler.setNameDisplayStyle(Constants.DISPLAY_STYLE_NAME_RACE);

        break;

      case 3:
        SettingsHandler.setNameDisplayStyle(Constants.DISPLAY_STYLE_NAME_RACE_CLASS);

        break;

      case 4:
        SettingsHandler.setNameDisplayStyle(Constants.DISPLAY_STYLE_NAME_FULL);

        break;

      default:
        Logging.errorPrint(
            "In PreferencesDialog.setOptionsBasedOnControls (tabLabelsCombo) the index "
                + tabLabelsCombo.getSelectedIndex()
                + " is unsupported.");

        break;
    }

    SettingsHandler.setAbilitiesShownAsATab(displayAbilitiesAsTab.isSelected());
    SettingsHandler.setExpertGUI(expertGUICheckBox.isSelected());
  }