Changeset 8835


Ignore:
Timestamp:
2004-12-17T09:05:08+13:00 (19 years ago)
Author:
mdewsnip
Message:

Initial unfinished version of the PluginSuggestionPrompt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java

    r8768 r8835  
    4444import org.greenstone.gatherer.gui.GComboBox;
    4545import org.greenstone.gatherer.gui.GLIButton;
     46import org.greenstone.gatherer.gui.ModalDialog;
    4647import org.greenstone.gatherer.gui.WarningDialog;
    4748import org.greenstone.gatherer.util.StaticStrings;
     
    162163
    163164    // Generate a dialog
    164     String[] args = new String[2];
    165     args[0] = file.getName();
    166     args[1] = ((Plugin) suitable_plugins.get(0)).toString();
    167     JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PluginManager.SuggestedPluginList", args), Dictionary.get("CDM.PluginManager.SuggestedPluginListTitle"), JOptionPane.INFORMATION_MESSAGE);
     165    new PluginSuggestionPrompt(file.getName(), suitable_plugins);
    168166    }
    169167
     
    12381236    }
    12391237    }
     1238
     1239
     1240    private class PluginSuggestionPrompt
     1241    extends ModalDialog
     1242    {
     1243    private Dimension size = new Dimension(400, 150);
     1244
     1245    public PluginSuggestionPrompt(String filename, ArrayList suitable_plugins)
     1246    {
     1247        super(Gatherer.g_man, true);
     1248        setModal(true);
     1249        setSize(size);
     1250        Dictionary.setText(this, "CDM.PluginManager.SuggestedPluginListTitle");
     1251
     1252        String[] args = new String[1];
     1253        args[0] = filename;
     1254
     1255        JTextArea instructions_textarea = new JTextArea();
     1256        instructions_textarea.setCaretPosition(0);
     1257        instructions_textarea.setEditable(false);
     1258        instructions_textarea.setLineWrap(true);
     1259        instructions_textarea.setRows(5);
     1260        instructions_textarea.setWrapStyleWord(true);
     1261        Dictionary.setText(instructions_textarea, "CDM.PluginManager.Plugin_Suggestion_Prompt", args);
     1262
     1263        JLabel suitable_plugins_label = new JLabel();
     1264        Dictionary.registerText(suitable_plugins_label, "CDM.PlugInManager.PlugIn");
     1265        suitable_plugins_label.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
     1266
     1267        GComboBox suitable_plugins_combobox = new GComboBox(suitable_plugins);
     1268        suitable_plugins_combobox.setBackgroundNonSelectionColor(Configuration.getColor("coloring.editable_background", false));
     1269        suitable_plugins_combobox.setBackgroundSelectionColor(Configuration.getColor("coloring.collection_selection_background", false));
     1270        suitable_plugins_combobox.setTextNonSelectionColor(Configuration.getColor("coloring.workspace_tree_foreground", false));
     1271        suitable_plugins_combobox.setTextSelectionColor(Configuration.getColor("coloring.collection_selection_foreground", false));
     1272
     1273        JPanel suitable_plugins_pane = new JPanel();
     1274        suitable_plugins_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
     1275        suitable_plugins_pane.setLayout(new BorderLayout(5,0));
     1276        suitable_plugins_pane.add(suitable_plugins_label, BorderLayout.WEST);
     1277        suitable_plugins_pane.add(suitable_plugins_combobox, BorderLayout.CENTER);
     1278
     1279        JPanel content_pane = (JPanel) getContentPane();
     1280        content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     1281        content_pane.setLayout(new BorderLayout());
     1282        content_pane.add(instructions_textarea, BorderLayout.NORTH);
     1283        content_pane.add(suitable_plugins_pane, BorderLayout.SOUTH);
     1284
     1285        // Show
     1286        Dimension screen_size = Configuration.screen_size;
     1287        setLocation((screen_size.width - size.width) / 2, (screen_size.height - size.height) / 2);
     1288        setVisible(true);
     1289    }
     1290    }
     1291
     1292
    12401293    /** Creates a list separator.
    12411294     * Found on Google Groups. Code courtesy of Paul Farwell.
Note: See TracChangeset for help on using the changeset viewer.