Esempio n. 1
0
 private void initPlugins() {
   plugins.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   plugins.addListSelectionListener(
       new ListSelectionListener() {
         @Override
         public void valueChanged(ListSelectionEvent e) {
           if (plugins.getSelectedIndex() != -1) {
             PluginLoader loader = getCurrentLoader();
             description.setText(loader.getDescription());
             description.revalidate();
             config.setEnabled(loader.getConfigDialog(SelectionFrame.this) != null);
             StringBuilder sb = new StringBuilder();
             if (stat.isEmpty()) {
               sb = sb.append(loader.getName());
             } else {
               sb = sb.append(stat).append(" > ").append(loader.getName());
             }
             for (int i = 0;
                 i < InterfaceConfig.SELECTION_FRAME_PROPERTIES.getInt("tabs-count");
                 i++) {
               sb = sb.insert(0, "    ");
             }
             status.setText(sb.toString());
           }
         }
       });
   setLoaders(TaskState.getLoaders());
 }
Esempio n. 2
0
  public void setLoaders(final List<PluginLoader> loaders) {
    this.loaders = loaders;
    plugins.setModel(
        new AbstractListModel() {
          @Override
          public int getSize() {
            return loaders.size();
          }

          @Override
          public Object getElementAt(int i) {
            return loaders.get(i).getName();
          }
        });
    plugins.setSelectedIndex(0);
    plugins.revalidate();
  }
Esempio n. 3
0
 public PluginLoader getCurrentLoader() {
   return loaders.get(plugins.getSelectedIndex());
 }