mActionsPane = new JScrollPane(mPluginsPane);
mConfigBtn = new JButton(mLocalizer.msg("config", "Configure view"));
mConfigBtn.setIcon(TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
ButtonBarBuilder2 buttonBuilder = new ButtonBarBuilder2();
buttonBuilder.addButton(mConfigBtn);
mConfigBtn.setVisible(showSettings);
if (pluginsSize == null) {
mActionsPane.setPreferredSize(new Dimension(250, 500));
} else {
mActionsPane.setPreferredSize(pluginsSize);
}
if (ProgramInfo.getInstance().getSettings().getShowFunctions()) {
JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split.setDividerSize(5);
split.setContinuousLayout(true);
split.setDividerLocation(mActionsPane.getPreferredSize().width + 1);
split.setLeftComponent(mActionsPane);
split.setRightComponent(scrollPane);
mMainPanel.add(split, BorderLayout.CENTER);
mFindAsYouType.installKeyListener(split);
} else {
final JButton functions = new JButton(mLocalizer.msg("functions",
"Functions"));
functions.setFocusable(false);
functions.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
JPopupMenu popupMenu = PluginProxyManager.createPluginContextMenu(
mProgram, ProgramInfoProxy.getInstance());
popupMenu.show(functions, e.getX(), e.getY()
- popupMenu.getPreferredSize().height);
}
}
});
buttonBuilder.addUnrelatedGap();
buttonBuilder.addButton(functions);
mMainPanel.add(scrollPane, BorderLayout.CENTER);
}
// buttons
JPanel buttonPn = new JPanel(new BorderLayout(0, 5));
buttonPn.add(mFindAsYouType.getSearchBar(), BorderLayout.NORTH);
buttonPn.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
mMainPanel.add(buttonPn, BorderLayout.SOUTH);
mConfigBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
exit();
MainFrame.getInstance().showSettingsDialog(SettingsItem.PROGRAMINFO);
}
});
mHighlight = new JCheckBox(mLocalizer
.msg("highlight", "Highlight favorite"), ProgramInfo.getInstance()
.getSettings().getHighlightFavorite());
mHighlight.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ProgramInfo.getInstance().getSettings().setHighlightFavorite(
mHighlight.isSelected());
highlightFavorites();
}
});
buttonBuilder.addUnrelatedGap();
buttonBuilder.addFixed(mHighlight);
mCloseBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CLOSE));
mCloseBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
exit();
}
});
buttonBuilder.addGlue();
buttonBuilder.addButton(mCloseBtn);
buttonPn.add(buttonBuilder.getPanel(), BorderLayout.SOUTH);
/*
* The action for the search button in the function panel.
*/
final Action searchAction = new AbstractAction() {