WeightConverterGUI(ViewModel viewModel) {
    this.viewModel = viewModel;
    fromUnit.addItem("");
    toUnit.addItem("");
    backBind();

    actionButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            bind();
            WeightConverterGUI.this.viewModel.processKey();
            backBind();
          }
        });

    addCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            WeightConverterGUI.this.viewModel.setAddMode(addCheckBox.isSelected());
            backBind();
          }
        });
  }
Exemplo n.º 2
0
  HDTextureConfig() {
    comboListeners = new AnimationComboListener[4];
    comboListeners[0] = new AnimationComboListener(waterCombo, "Water");
    comboListeners[1] = new AnimationComboListener(lavaCombo, "Lava");
    comboListeners[2] = new AnimationComboListener(fireCombo, "Fire");
    comboListeners[3] = new AnimationComboListener(portalCombo, "Portal");

    waterCombo.addItemListener(comboListeners[0]);
    lavaCombo.addItemListener(comboListeners[1]);
    fireCombo.addItemListener(comboListeners[2]);
    portalCombo.addItemListener(comboListeners[3]);

    otherCombo.addItem("Not Animated");
    otherCombo.addItem("Custom Animated");
    otherCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              switch (otherCombo.getSelectedIndex()) {
                case 0:
                  MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", false);
                  break;

                case 1:
                  MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", true);
                  break;

                default:
                  break;
              }
            }
          }
        });

    textureCacheCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES, "useTextureCache", textureCacheCheckBox.isSelected());
          }
        });

    shrinkGLMemoryCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES, "reclaimGLMemory", shrinkGLMemoryCheckBox.isSelected());
          }
        });

    autoRefreshTexturesCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES,
                "autoRefreshTextures",
                autoRefreshTexturesCheckBox.isSelected());
          }
        });
  }
Exemplo n.º 3
0
  public FontChooser(FormDialog dialog, Font font) {
    super(dialog);
    setTitle("Choose Font");

    setLayout(new FormLayout(FormLayout.VERTICAL, FormLayout.CENTER));
    ((FormLayout) getLayout()).setResizeConstant(true);
    fontBox =
        new JComboBox(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());

    sizeField = new JTextField();
    sizeField.setColumns(2);

    styleBox = new JComboBox();
    styleBox.addItem("Plain");
    styleBox.addItem("Bold");
    styleBox.addItem("Italic");

    setCurrentFont(font);

    FormFactory factory = new FormFactory(this);
    this.add(factory.label(fontBox, "Font"));
    this.add(factory.label(sizeField, "Size"));
    this.add(factory.label(styleBox, "Style"));
  }
Exemplo n.º 4
0
  public void setData(TraceDataSet dataSet) {
    this.dataSet = dataSet;
    this.errorsOnly = false;
    this.traceLabel = null;
    this.minTraceTime = 0;

    btnFilterErrors.setSelected(false);
    txtMinTime.setText("");

    tbmTraces.setDataSet(dataSet, null);

    List<String> traceNames = new ArrayList<String>();

    for (ViewerTraceRecord rec : dataSet.getRecords()) {
      String traceName = rec.getTraceName();
      if (traceName != null && !traceNames.contains(traceName)) {
        traceNames.add(traceName);
      }
    }

    Collections.sort(traceNames);
    cmbTraceType.removeAllItems();
    cmbTraceType.addItem("*");

    for (String traceName : traceNames) {
      cmbTraceType.addItem(traceName);
    }
  }
Exemplo n.º 5
0
  public EditorOptionsPanel() {
    if (SystemInfo.isMac) {
      myCbEnableWheelFontChange.setText(
          ApplicationBundle.message("checkbox.enable.ctrl.mousewheel.changes.font.size.macos"));
    }

    myStripTrailingSpacesCombo.addItem(STRIP_CHANGED);
    myStripTrailingSpacesCombo.addItem(STRIP_ALL);
    myStripTrailingSpacesCombo.addItem(STRIP_NONE);

    myHighlightSettingsPanel.setLayout(new BorderLayout());
    myHighlightSettingsPanel.add(myErrorHighlightingPanel.getPanel(), BorderLayout.CENTER);

    myRichCopyColorSchemeComboBox.setRenderer(
        new ListCellRendererWrapper<String>() {
          @Override
          public void customize(
              JList list, String value, int index, boolean selected, boolean hasFocus) {
            final String textToUse;
            if (RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER.equals(value)) {
              textToUse = ACTIVE_COLOR_SCHEME;
            } else {
              textToUse = value;
            }
            setText(textToUse);
          }
        });

    myConfigurable = new MyConfigurable();
    initQuickDocProcessing();
    initSoftWrapsSettingsProcessing();
  }
Exemplo n.º 6
0
    public Component getTableCellEditorComponent(
        JTable table, Object value, boolean isSelected, int row, int column) {

      ((JComboBox) editorComponent).removeAllItems();
      if (options.containTrait(table.getValueAt(row, 0).toString())) {
        if (column == 5) {
          for (Object ob : options.getPartitionTraitsSubstitutionModels()) {
            ((JComboBox) editorComponent).addItem(ob);
          }
        } else if (column == 6) {
          for (Object ob : options.getPartitionTraitsClockModels()) {
            ((JComboBox) editorComponent).addItem(ob);
          }
        }
      } else {
        if (column == 5) {
          for (Object ob : options.getPartitionNonTraitsSubstitutionModels()) {
            ((JComboBox) editorComponent).addItem(ob);
          }
        } else if (column == 6) {
          for (Object ob : options.getPartitionNonTraitsClockModels()) {
            ((JComboBox) editorComponent).addItem(ob);
          }
        }
      }

      //            if (((JComboBox) editorComponent).contains(value)) // todo need validate whether
      // value in the editorComponent

      ((JComboBox) editorComponent).setSelectedItem(value);
      delegate.setValue(value);

      return editorComponent;
    }
  public Initialize() {
    setTitle("");
    setSize(400, 300);
    setLocationRelativeTo(null);
    JPanel p = new JPanel();
    p.setLayout(new GridLayout(3, 2));
    typel = new JLabel("Animal Type:");
    typef = new JComboBox();
    typef.addItem("Cow");
    typef.addItem("Deer");
    typef.addItem("Horse");
    tot_popl = new JLabel("Initial population:");
    tot_pop = new JTextField(12);
    annuler = new JButton("Cancel");
    validate = new JButton("Create");

    annuler.addActionListener(this);
    validate.addActionListener(this);
    p.add(typel);
    p.add(typef);
    p.add(tot_popl);
    p.add(tot_pop);
    p.add(annuler);
    p.add(validate);
    setContentPane(p);
    this.pack(); // bien regrouper les éléments
  }
Exemplo n.º 8
0
 /**
  * The constructor
  *
  * @param project the context project
  */
 public GitVcsPanel(@NotNull Project project) {
   myVcs = GitVcs.getInstance(project);
   myAppSettings = GitVcsApplicationSettings.getInstance();
   myProjectSettings = GitVcsSettings.getInstance(project);
   myProject = project;
   mySSHExecutableComboBox.addItem(IDEA_SSH);
   mySSHExecutableComboBox.addItem(NATIVE_SSH);
   mySSHExecutableComboBox.setSelectedItem(
       GitVcsSettings.isDefaultIdeaSsh() ? IDEA_SSH : NATIVE_SSH);
   mySSHExecutableComboBox.setToolTipText(
       GitBundle.message(
           "git.vcs.config.ssh.mode.tooltip",
           ApplicationNamesInfo.getInstance().getFullProductName()));
   myTestButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           testConnection();
         }
       });
   myConvertTextFilesComboBox.addItem(CRLF_DO_NOT_CONVERT);
   myConvertTextFilesComboBox.addItem(CRLF_CONVERT_TO_PROJECT);
   myConvertTextFilesComboBox.addItem(CRLF_ASK);
   myConvertTextFilesComboBox.setSelectedItem(CRLF_ASK);
   myGitField.addBrowseFolderListener(
       GitBundle.getString("find.git.title"),
       GitBundle.getString("find.git.description"),
       project,
       new FileChooserDescriptor(true, false, false, false, false, false));
 }
Exemplo n.º 9
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.º 10
0
 public AnimationComboListener(JComboBox comboBox, String tag) {
   this.comboBox = comboBox;
   customTag = "custom" + tag;
   animatedTag = "animated" + tag;
   comboBox.addItem("Default");
   comboBox.addItem("Not Animated");
   comboBox.addItem("Custom Animated");
 }
Exemplo n.º 11
0
 public void loadCategorie() {
   ArrayList<String> collectionCategorie = liste.obtenirCles();
   collectionCategorie = removeNulls(collectionCategorie);
   collectionCategorie = removeDuplicates(collectionCategorie);
   for (String categorie : collectionCategorie) {
     selectionCategorie.addItem(categorie);
   }
   selectionCategorie.addItem("Autres...");
 }
Exemplo n.º 12
0
  public LicenseDialog(Component parent) {
    setTitle("Licensing information");

    pnlButtons.add(bttnOk);

    cbLang.addItem("English");
    cbLang.addItem("Eesti");

    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);

    pnlHeader.setLayout(fl);

    pnlHeader.add(lblLang);
    pnlHeader.add(cbLang);

    pnlMain.setLayout(new BorderLayout());
    pnlMain.add(pnlHeader, BorderLayout.NORTH);
    pnlMain.add(scrollPane, BorderLayout.CENTER);
    pnlMain.add(pnlButtons, BorderLayout.SOUTH);

    taLicenseText.setText(getLicenseText());
    taLicenseText.setCaretPosition(0);
    taLicenseText.setLineWrap(true);
    taLicenseText.setEditable(false);
    taLicenseText.setWrapStyleWord(true);

    getContentPane().add(pnlMain);
    setPreferredSize(new Dimension(500, 600));
    setLocationRelativeTo(parent);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    bttnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (evt.getSource() == bttnOk) {
              dispose();
            }
          } // end actionPerformed
        }); // end bttnOk Action Listener

    cbLang.addItemListener(
        new ItemListener() {
          public void itemStateChanged(final ItemEvent event) {
            if (event.getSource() == cbLang
                && event.getStateChange() == ItemEvent.SELECTED
                && cbLang.getItemCount() > 0) {
              taLicenseText.setText(getLicenseText());
              taLicenseText.setCaretPosition(0);
            }
          }
        }); // end cbLang item listener

    pack();
    setVisible(true);
  } // PortPropertiesDialog
  public void fillFields(final Subscription subscription, Project project) {
    this.subscription = subscription;

    subscriptionComboBox.addItem(subscription.getName());

    regionOrAffinityGroupComboBox.addItem("<Loading...>");

    ProgressManager.getInstance()
        .run(
            new Task.Backgroundable(project, "Loading regions...", false) {
              @Override
              public void run(ProgressIndicator progressIndicator) {

                progressIndicator.setIndeterminate(true);

                try {
                  final java.util.List<AffinityGroup> affinityGroups =
                      AzureSDKManagerImpl.getManager()
                          .getAffinityGroups(subscription.getId().toString());
                  final java.util.List<Location> locations =
                      AzureSDKManagerImpl.getManager()
                          .getLocations(subscription.getId().toString());

                  ApplicationManager.getApplication()
                      .invokeLater(
                          new Runnable() {
                            @Override
                            public void run() {
                              final Vector<Object> vector = new Vector<Object>();
                              vector.add("Regions");
                              vector.addAll(locations);
                              if (affinityGroups.size() > 0) {
                                vector.add("Affinity Groups");
                                vector.addAll(affinityGroups);
                              }

                              regionOrAffinityGroupComboBox.removeAllItems();
                              regionOrAffinityGroupComboBox.setModel(
                                  new DefaultComboBoxModel(vector) {
                                    public void setSelectedItem(Object o) {
                                      if (!(o instanceof String)) {
                                        super.setSelectedItem(o);
                                      }
                                    }
                                  });

                              regionOrAffinityGroupComboBox.setSelectedIndex(1);
                            }
                          });

                } catch (AzureCmdException e) {
                  UIHelper.showException("Error getting regions", e);
                }
              }
            });
  }
Exemplo n.º 14
0
 protected void createButtons(JPanel panel) {
   panel.add(new Filler(24, 20));
   JComboBox drawingChoice = new JComboBox();
   drawingChoice.addItem(fgUntitled);
   String param = getParameter("DRAWINGS");
   if (param == null) {
     param = "";
   }
   StringTokenizer st = new StringTokenizer(param);
   while (st.hasMoreTokens()) {
     drawingChoice.addItem(st.nextToken());
   }
   if (drawingChoice.getItemCount() > 1) {
     panel.add(drawingChoice);
   } else {
     panel.add(new JLabel(fgUntitled));
   }
   drawingChoice.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           if (e.getStateChange() == ItemEvent.SELECTED) {
             loadDrawing((String) e.getItem());
           }
         }
       });
   panel.add(new Filler(6, 20));
   JButton button;
   button = new CommandButton(new DeleteCommand("Delete", this));
   panel.add(button);
   button = new CommandButton(new DuplicateCommand("Duplicate", this));
   panel.add(button);
   button = new CommandButton(new GroupCommand("Group", this));
   panel.add(button);
   button = new CommandButton(new UngroupCommand("Ungroup", this));
   panel.add(button);
   button = new JButton("Help");
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           showHelp();
         }
       });
   panel.add(button);
   fUpdateButton = new JButton("Simple Update");
   fUpdateButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           if (fSimpleUpdate) {
             setBufferedDisplayUpdate();
           } else {
             setSimpleDisplayUpdate();
           }
         }
       });
 }
  public GlobalCvsSettingsPanel() {
    myPServerPanel.setLayout(new BorderLayout());
    myPServerPanel.add(myPServerSettingsPanel.getPanel(), BorderLayout.CENTER);

    Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();

    myCharset.addItem(CvsApplicationLevelConfiguration.DEFAULT);
    for (Charset charset : availableCharsets) {
      myCharset.addItem(charset.name());
    }
  }
  public PartDelPanel() {
    JPanel infoPanel = new JPanel();
    manufacturer.removeAllItems();
    manufacturer.addItem("ARS");
    manufacturer.addItem("MOD");
    manufacturer.addItem("BEH");
    manufacturer.addItem("DAN");

    infoPanel.setLayout(new GridLayout(2, 2));
    infoPanel.setPreferredSize(new Dimension(500, 100));
    infoPanel.add(new JLabel("Select a Manufacturer: "));
    infoPanel.add(manufacturer);
    infoPanel.add(new JLabel("Enter Part Number to DELETE: "));
    infoPanel.add(pNumBox);

    JPanel botPanel = new JPanel();
    JButton delBut = new JButton("Delete");
    delBut.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int m = 0;
            String manu = (String) manufacturer.getSelectedItem();
            if (manu.equals("ARS")) m = PartOperations.mARS;
            if (manu.equals("BEH")) m = PartOperations.mBEH;
            if (manu.equals("MOD")) m = PartOperations.mMOD;
            if (manu.equals("DAN")) m = PartOperations.mDAN;
            String pnum = pNumBox.getText();
            PartOperations.delPart(con, m, pnum);
          }
        });

    JButton resBut = new JButton("Reset");
    resBut.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            pNumBox.setText("");
          }
        });

    JButton cancelBut = new JButton("Cancel");
    cancelBut.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            PartModPanel.frameDel.dispose();
          }
        });

    botPanel.add(delBut);
    botPanel.add(resBut);
    botPanel.add(cancelBut);
    botPanel.add(warning);
    add(infoPanel, BorderLayout.NORTH);
    add(botPanel, BorderLayout.SOUTH);
  }
Exemplo n.º 17
0
  public RendererOptions() {
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    renderers.addItem("Parallel");
    renderers.addItem("Serial");
    renderers.addActionListener(actionProvider.actionDelegate());
    renderers.setSelectedItem("Parallel");

    JPanel upper = new JPanel();
    upper.add(new LabeledItem("Render:", renderers));
    this.add(upper);
  }
Exemplo n.º 18
0
 public void setPuolustajat(Pelaaja[] pelaaja) {
   puolustajat = pelaaja;
   for (int i = 0; i < puolustajat.length; i++) {
     puolustaja1.addItem(puolustajat[i].getNimi());
   }
   for (int i = 0; i < puolustajat.length; i++) {
     puolustaja2.addItem(puolustajat[i].getNimi());
   }
   for (int i = 0; i < puolustajat.length; i++) {
     puolustaja3.addItem(puolustajat[i].getNimi());
   }
 }
 public ejemplo6_javaya() {
   setLayout(null);
   combo1 = new JComboBox();
   combo1.setBounds(10, 10, 80, 20);
   add(combo1);
   combo1.addItem("rojo");
   combo1.addItem("vede");
   combo1.addItem("azul");
   combo1.addItem("amarillo");
   combo1.addItem("negro");
   combo1.addItemListener(this);
 }
Exemplo n.º 20
0
 public void setHyokkaajat(Pelaaja[] pelaaja) {
   hyokkaajat = pelaaja;
   for (int i = 0; i < hyokkaajat.length; i++) {
     hyokkaaja1.addItem(hyokkaajat[i].getNimi());
   }
   for (int i = 0; i < hyokkaajat.length; i++) {
     hyokkaaja2.addItem(hyokkaajat[i].getNimi());
   }
   for (int i = 0; i < hyokkaajat.length; i++) {
     hyokkaaja3.addItem(hyokkaajat[i].getNimi());
   }
 }
Exemplo n.º 21
0
  // WTF: this does not update packs!!
  // only updating info for selected pack. pulldown menus and info area!
  void updatePacks() {
    for (int i = 0; i < packPanels.size(); i++) {
      if (selectedPack == i && getIndex() >= 0) {
        ModPack pack = ModPack.getPackArray().get(getIndex());
        if (pack != null) {
          String mods = "";
          if (pack.getMods() != null) {
            mods += "<p>This pack contains the following mods by default:</p><ul>";
            for (String name : pack.getMods()) {
              mods += "<li>" + name + "</li>";
            }
            mods += "</ul>";
          }
          packPanels.get(i).setBackground(UIManager.getColor("control").darker().darker());
          packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
          File tempDir =
              new File(
                  OSUtils.getCacheStorageLocation(), "ModPacks" + File.separator + pack.getDir());
          packInfo.setText(
              "<html><img src='file:///"
                  + tempDir.getPath()
                  + File.separator
                  + pack.getImageName()
                  + "' width=400 height=200></img> <br>"
                  + pack.getInfo()
                  + mods);
          packInfo.setCaretPosition(0);

          if (ModPack.getSelectedPack(isFTB()).getServerUrl().equals("")
              || ModPack.getSelectedPack(isFTB()).getServerUrl() == null) {
            server.setEnabled(false);
          } else {
            server.setEnabled(true);
          }
          String tempVer = Settings.getSettings().getPackVer(pack.getDir());
          version.removeActionListener(al);
          version.removeAllItems();
          version.addItem("Recommended");
          if (pack.getOldVersions() != null) {
            for (String s : pack.getOldVersions()) {
              version.addItem(s);
            }
            version.setSelectedItem(tempVer);
          }
          version.addActionListener(al);
        }
      } else {
        packPanels.get(i).setBackground(UIManager.getColor("control"));
        packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      }
    }
  }
Exemplo n.º 22
0
 /**
  * Method which updates the value of the bands
  *
  * @param img New image
  * @param n Number of bands
  */
 public void updateBandsFrame(JIPImage img, int n) {
   bandSel.removeAllItems();
   if (img instanceof JIPBmpColor) {
     bandSel.addItem("COLOR-Bands RGB");
   } else if (img instanceof JIPImgGeometric) {
     bandSel.addItem("Geometric image");
   } else {
     for (int i = 0; i < ((JIPImgBitmap) img).getNumBands(); i++)
       bandSel.addItem(prop.getProperty("Band") + " " + i);
     tamFrame.setText(
         prop.getProperty("FrameSize") + ": " + img.getWidth() + "x" + img.getHeight());
   }
 }
Exemplo n.º 23
0
 public void init() {
   SELECT_logBuffer.removeAllItems();
   for (SizeType st : SizeType.values()) {
     SELECT_logBuffer.addItem(st.getName());
   }
   SELECT_charset.removeAllItems();
   for (CharsetType ct : CharsetType.values()) {
     SELECT_charset.addItem(ct.getName());
   }
   loadData(this.settingConfig);
   bindListeners();
   checkSeek();
   generateSeekInfo();
 }
Exemplo n.º 24
0
 public void setKeskikentta(Pelaaja[] pelaaja) {
   keskikentta = pelaaja;
   for (int i = 0; i < keskikentta.length; i++) {
     keskikentta1.addItem(keskikentta[i].getNimi());
   }
   for (int i = 0; i < keskikentta.length; i++) {
     keskikentta2.addItem(keskikentta[i].getNimi());
   }
   for (int i = 0; i < keskikentta.length; i++) {
     keskikentta3.addItem(keskikentta[i].getNimi());
   }
   for (int i = 0; i < keskikentta.length; i++) {
     keskikentta4.addItem(keskikentta[i].getNimi());
   }
 }
Exemplo n.º 25
0
 /**
  * Setup remotes combobox. The default remote for the current branch is selected by default.
  *
  * @param project the project
  * @param root the git root
  * @param currentBranch the current branch
  * @param remoteCombobox the combobox to update
  * @param fetchUrl if true, the fetch url is shown for remotes, push otherwise
  */
 public static void setupRemotes(
     final Project project,
     final VirtualFile root,
     final String currentBranch,
     final JComboBox remoteCombobox,
     final boolean fetchUrl) {
   try {
     List<GitDeprecatedRemote> remotes = GitDeprecatedRemote.list(project, root);
     String remote = null;
     if (currentBranch != null) {
       remote = GitConfigUtil.getValue(project, root, "branch." + currentBranch + ".remote");
     }
     remoteCombobox.setRenderer(
         getGitRemoteListCellRenderer(remote, fetchUrl, remoteCombobox.getRenderer()));
     GitDeprecatedRemote toSelect = null;
     remoteCombobox.removeAllItems();
     for (GitDeprecatedRemote r : remotes) {
       remoteCombobox.addItem(r);
       if (r.name().equals(remote)) {
         toSelect = r;
       }
     }
     if (toSelect != null) {
       remoteCombobox.setSelectedItem(toSelect);
     }
   } catch (VcsException e) {
     GitVcs.getInstance(project)
         .showErrors(Collections.singletonList(e), GitBundle.getString("pull.retrieving.remotes"));
   }
 }
Exemplo n.º 26
0
 /**
  * Setup root chooser with specified elements and link selection to the current branch label.
  *
  * @param project a context project
  * @param roots git roots for the project
  * @param defaultRoot a default root
  * @param gitRootChooser git root selector
  * @param currentBranchLabel current branch label (might be null)
  */
 public static void setupRootChooser(
     @NotNull final Project project,
     @NotNull final List<VirtualFile> roots,
     @Nullable final VirtualFile defaultRoot,
     @NotNull final JComboBox gitRootChooser,
     @Nullable final JLabel currentBranchLabel) {
   for (VirtualFile root : roots) {
     gitRootChooser.addItem(root);
   }
   gitRootChooser.setRenderer(getVirtualFileListCellRenderer(gitRootChooser.getRenderer()));
   gitRootChooser.setSelectedItem(defaultRoot != null ? defaultRoot : roots.get(0));
   if (currentBranchLabel != null) {
     final ActionListener listener =
         new ActionListener() {
           public void actionPerformed(final ActionEvent e) {
             VirtualFile root = (VirtualFile) gitRootChooser.getSelectedItem();
             assert root != null : "The root must not be null";
             GitRepository repo =
                 GitRepositoryManager.getInstance(project).getRepositoryForRoot(root);
             assert repo != null : "The repository must not be null";
             GitBranch current = repo.getCurrentBranch();
             if (current == null) {
               currentBranchLabel.setText(NO_CURRENT_BRANCH);
             } else {
               currentBranchLabel.setText(current.getName());
             }
           }
         };
     listener.actionPerformed(null);
     gitRootChooser.addActionListener(listener);
   }
 }
Exemplo n.º 27
0
 void populateEndDate() {
   endDateS.removeAllItems();
   for (int i = Math.max(0, startDateS.getSelectedIndex()); i < dateRange.size(); i++) {
     endDateS.addItem(dateFormatter.format(dateRange.get(i)));
   }
   endDateS.setEnabled(true);
 }
Exemplo n.º 28
0
  void populateStartDate() throws SQLException, Exception {
    startDateS.removeActionListener(this);
    startDateS.removeAllItems();
    dateRange.clear();
    if (sourceTable.sourceListModel.isSelectionEmpty() == false
        && sourceTable.getValueAt(sourceTable.getSelectedRow(), 0).toString() != null) {
      Statement MySQL_Statement = dbConn.createStatement();
      String getMinMaxSQL =
          "SELECT UNIX_TIMESTAMP(DATE_ADD(DATE(MIN(date_time)),INTERVAL 1 DAY)) AS min_date,UNIX_TIMESTAMP(DATE(MAX(date_time))) AS max_date FROM data_sa WHERE site_id = "
              + siteTable.getValueAt(siteTable.getSelectedRow(), 0)
              + " AND source_id = "
              + sourceTable.getValueAt(sourceTable.getSelectedRow(), 0);
      ResultSet minMaxResults = MySQL_Statement.executeQuery(getMinMaxSQL);
      if (minMaxResults.next()) {
        Calendar minCal = Calendar.getInstance();
        minCal.setTimeZone(TimeZone.getTimeZone("GMT+10"));
        minCal.setTimeInMillis(minMaxResults.getLong("min_date") * 1000);
        long maxCal = minMaxResults.getLong("max_date") * 1000;

        while (minCal.getTimeInMillis() <= maxCal) {
          dateRange.add(minCal.getTimeInMillis());
          startDateS.addItem(dateFormatter.format(minCal.getTimeInMillis()));
          minCal.add(Calendar.DATE, 1);
        }
        startDateS.setEnabled(true);
        populateEndDate();
      } else {
        throw new Exception("ERR:NoData");
      }
    } else { // This should never be able to happen
      throw new Exception("NoSource");
    }
    startDateS.addActionListener(this);
  }
  public TableCellRenderFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    TableModel model = new PlanetTableModel();
    JTable table = new JTable(model);
    table.setRowSelectionAllowed(false);

    // set up renderers and editors

    table.setDefaultRenderer(Color.class, new ColorTableCellRenderer());
    table.setDefaultEditor(Color.class, new ColorTableCellEditor());

    JComboBox<Integer> moonCombo = new JComboBox<>();
    for (int i = 0; i <= 20; i++) moonCombo.addItem(i);

    TableColumnModel columnModel = table.getColumnModel();
    TableColumn moonColumn = columnModel.getColumn(PlanetTableModel.MOONS_COLUMN);
    moonColumn.setCellEditor(new DefaultCellEditor(moonCombo));
    moonColumn.setHeaderRenderer(table.getDefaultRenderer(ImageIcon.class));
    moonColumn.setHeaderValue(new ImageIcon(getClass().getResource("Moons.gif")));

    // show table

    table.setRowHeight(100);
    add(new JScrollPane(table), BorderLayout.CENTER);
  }
  public AddCssPropertyDialog(final CssPropertyTableModel tableModel) {
    setSize(400, 200);
    setTitle("Add new css property");
    UIHelper.setIcon(this);

    for (CssPropertyEnum type : CssPropertyEnum.values()) {
      if (!tableModel.isExistCssProperty(type)) {
        cssPropertyComobBox.addItem(type);
      }
    }

    setContentPane(contentPane);
    setModal(true);
    getRootPane().setDefaultButton(addButton);

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

    addButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            tableModel.addRow(
                new CssPropertyEntity(
                    (CssPropertyEnum) cssPropertyComobBox.getSelectedItem(),
                    cssClassValueInput.getText()));
            dispose();
          }
        });
  }