mPluginArr = channelArr;
mResultPluginArr = channelArr;
}
JPanel contentPane = (JPanel)getContentPane();
FormLayout layout = new FormLayout("fill:pref:grow", "");
contentPane.setLayout(layout);
contentPane.setBorder(Borders.DLU4_BORDER);
CellConstraints cc = new CellConstraints();
PluginAccess[] pluginAccess = Plugin.getPluginManager().getActivatedPlugins();
ArrayList<Marker> list = new ArrayList<Marker>();
list.add(FavoritesPluginProxy.getInstance());
list.add(ReminderPluginProxy.getInstance());
for (PluginAccess plugin : pluginAccess) {
if (plugin.getMarkIcon() != null) {
list.add(plugin);
}
}
Collections.sort(list, new Comparator<Marker>() {
public int compare(Marker arg0, Marker arg1) {
return (arg0.toString().compareTo(arg1.toString()));
}});
mPluginItemList = new SelectableItemList(mResultPluginArr, list.toArray());
int pos = 1;
layout.appendRow(RowSpec.decode("fill:default:grow"));
layout.appendRow(RowSpec.decode("3dlu"));
contentPane.add(mPluginItemList, cc.xy(1,pos));
pos += 2;
if (description != null) {
JLabel lb = new JLabel(description);
layout.appendRow(RowSpec.decode("pref"));
layout.appendRow(RowSpec.decode("3dlu"));
contentPane.add(lb, cc.xy(1,pos));
pos += 2;
}
JButton okBt = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
JButton cancelBt = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
okBt.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event) {
Object[] o = mPluginItemList.getSelection();
mResultPluginArr = new Marker[o.length];
for (int i=0;i<o.length;i++) {
mResultPluginArr[i]=(Marker)o[i];
}
setVisible(false);
}
});
cancelBt.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event) {
mResultPluginArr = null;
setVisible(false);
}
});
ButtonBarBuilder2 builder = new ButtonBarBuilder2();
builder.addGlue();
builder.addButton(new JButton[] {okBt, cancelBt});
layout.appendRow(RowSpec.decode("pref"));
contentPane.add(builder.getPanel(), cc.xy(1,pos));
pack();
}