use of pcgen.gui2.tools.FlippingSplitPane in project pcgen by PCGen.
the class SpellsPreparedTab method initComponents.
private void initComponents() {
availableTable.setTreeCellRenderer(spellRenderer);
selectedTable.setTreeCellRenderer(spellRenderer);
selectedTable.setRowSorter(new SortableTableRowSorter() {
@Override
public SortableTableModel getModel() {
return (SortableTableModel) selectedTable.getModel();
}
});
selectedTable.getRowSorter().toggleSortOrder(0);
FilterBar<CharacterFacade, SuperNode> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
filterBar.addDisplayableFilter(qFilterButton);
FlippingSplitPane upperPane = new FlippingSplitPane("SpellsPreparedTop");
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, filterBar);
Box box = Box.createVerticalBox();
box.add(Box.createVerticalStrut(5));
{
Box hbox = Box.createHorizontalBox();
addMMSpellButton.setHorizontalTextPosition(SwingConstants.LEADING);
hbox.add(addMMSpellButton);
box.add(hbox);
}
box.add(Box.createVerticalStrut(2));
{
Box hbox = Box.createHorizontalBox();
hbox.add(Box.createHorizontalStrut(5));
hbox.add(slotsBox);
hbox.add(Box.createHorizontalGlue());
hbox.add(Box.createHorizontalStrut(10));
hbox.add(addSpellButton);
hbox.add(Box.createHorizontalStrut(5));
box.add(hbox);
}
box.add(Box.createVerticalStrut(5));
availPanel.add(box, BorderLayout.SOUTH);
upperPane.setLeftComponent(availPanel);
box = Box.createVerticalBox();
box.add(new JScrollPane(selectedTable));
box.add(Box.createVerticalStrut(4));
{
Box hbox = Box.createHorizontalBox();
hbox.add(Box.createHorizontalStrut(5));
hbox.add(removeSpellButton);
hbox.add(Box.createHorizontalStrut(10));
hbox.add(new JLabel(LanguageBundle.getString("InfoPreparedSpells.preparedList")));
hbox.add(Box.createHorizontalStrut(3));
hbox.add(spellListField);
hbox.add(Box.createHorizontalStrut(3));
hbox.add(addSpellListButton);
hbox.add(Box.createHorizontalStrut(3));
hbox.add(removeSpellListButton);
hbox.add(Box.createHorizontalStrut(5));
box.add(hbox);
}
box.add(Box.createVerticalStrut(5));
upperPane.setRightComponent(box);
upperPane.setResizeWeight(0);
setTopComponent(upperPane);
FlippingSplitPane bottomPane = new FlippingSplitPane("SpellsPreparedBottom");
bottomPane.setLeftComponent(spellsPane);
bottomPane.setRightComponent(classPane);
setBottomComponent(bottomPane);
setOrientation(VERTICAL_SPLIT);
}
use of pcgen.gui2.tools.FlippingSplitPane in project pcgen by PCGen.
the class FlippingSplitPane method setDividerLocation.
/**
* {@code setDividerLocation} calls {@link JSplitPane#setDividerLocation(int)}
* unless the {@code FlippingSplitPane} is locked.
*
* @param location {@code int}, the location
*/
@Override
public void setDividerLocation(int location) {
PropertyContext context = baseContext.createChildContext(prefsKey);
context.setInt(DIVIDER_LOC_PREF_KEY, location);
if (isLocked()) {
super.setDividerLocation(getLastDividerLocation());
} else {
super.setDividerLocation(location);
}
}
use of pcgen.gui2.tools.FlippingSplitPane in project pcgen by PCGen.
the class PreferencesPluginsPanel method getCenter.
@Override
protected JComponent getCenter() {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode characterNode;
DefaultMutableTreeNode pcGenNode;
DefaultMutableTreeNode appearanceNode;
DefaultMutableTreeNode gameModeNode;
panelList = new ArrayList<>(15);
// Build the settings panel
settingsPanel = new JPanel();
settingsPanel.setLayout(new CardLayout());
settingsPanel.setPreferredSize(new Dimension(780, 420));
// Build the selection tree
characterNode = new DefaultMutableTreeNode(in_character);
settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_charTip")), in_character);
characterStatsPanel = new CharacterStatsPanel(this);
addPanelToTree(characterNode, characterStatsPanel);
hitPointsPanel = new HitPointsPanel();
addPanelToTree(characterNode, hitPointsPanel);
houseRulesPanel = new HouseRulesPanel();
addPanelToTree(characterNode, houseRulesPanel);
monsterPanel = new MonsterPanel();
addPanelToTree(characterNode, monsterPanel);
defaultsPanel = new DefaultsPanel();
addPanelToTree(characterNode, defaultsPanel);
rootNode.add(characterNode);
appearanceNode = new DefaultMutableTreeNode(in_appearance);
settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_appearanceTip")), in_appearance);
colorsPanel = new ColorsPanel();
addPanelToTree(appearanceNode, colorsPanel);
displayOptionsPanel = new DisplayOptionsPanel();
addPanelToTree(appearanceNode, displayOptionsPanel);
levelUpPanel = new LevelUpPanel();
addPanelToTree(appearanceNode, levelUpPanel);
lookAndFeelPanel = new LookAndFeelPanel(this);
addPanelToTree(appearanceNode, lookAndFeelPanel);
// tabsPanel = new TabsPanel();
// addPanelToTree(appearanceNode, tabsPanel);
rootNode.add(appearanceNode);
pcGenNode = new DefaultMutableTreeNode(Constants.APPLICATION_NAME);
settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_pcgenTip")), Constants.APPLICATION_NAME);
equipmentPanel = new EquipmentPanel();
addPanelToTree(pcGenNode, equipmentPanel);
languagePanel = new LanguagePanel();
addPanelToTree(pcGenNode, languagePanel);
locationPanel = new LocationPanel();
addPanelToTree(pcGenNode, locationPanel);
inputPanel = new InputPanel();
addPanelToTree(pcGenNode, inputPanel);
outputPanel = new OutputPanel();
addPanelToTree(pcGenNode, outputPanel);
sourcesPanel = new SourcesPanel();
addPanelToTree(pcGenNode, sourcesPanel);
rootNode.add(pcGenNode);
String in_gamemode = LanguageBundle.getString("in_mnuSettingsCampaign");
gameModeNode = new DefaultMutableTreeNode(in_gamemode);
settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_mnuSettingsCampaignTip")), in_gamemode);
copySettingsPanel = new CopySettingsPanel();
addPanelToTree(gameModeNode, copySettingsPanel);
rootNode.add(gameModeNode);
DefaultMutableTreeNode pluginNode = new DefaultMutableTreeNode(//$NON-NLS-1$
LanguageBundle.getString("in_Prefs_plugins"));
addPluginPanes(rootNode, pluginNode);
settingsModel = new DefaultTreeModel(rootNode);
settingsTree = new JTree(settingsModel);
settingsTree.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
settingsTree.setRootVisible(false);
settingsTree.setShowsRootHandles(true);
settingsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
settingsScroll = new JScrollPane(settingsTree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// Turn off the icons
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
renderer.setLeafIcon(null);
renderer.setOpenIcon(null);
renderer.setClosedIcon(null);
settingsTree.setCellRenderer(renderer);
// Expand all of the branch nodes
settingsTree.expandPath(new TreePath(characterNode.getPath()));
settingsTree.expandPath(new TreePath(pcGenNode.getPath()));
settingsTree.expandPath(new TreePath(appearanceNode.getPath()));
settingsTree.expandPath(new TreePath(gameModeNode.getPath()));
settingsTree.expandPath(new TreePath(pluginNode.getPath()));
// Add the listener which switches panels when a node of the tree is selected
settingsTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) settingsTree.getLastSelectedPathComponent();
if (node == null) {
return;
}
CardLayout cl = (CardLayout) (settingsPanel.getLayout());
cl.show(settingsPanel, String.valueOf(node));
}
});
// Build the split pane
splitPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, settingsScroll, settingsPanel, "Prefs");
splitPane.setOneTouchExpandable(true);
splitPane.setDividerSize(10);
return splitPane;
}
use of pcgen.gui2.tools.FlippingSplitPane in project pcgen by PCGen.
the class ClassInfoTab method initComponents.
private void initComponents() {
FlippingSplitPane topPane = new FlippingSplitPane("ClassTop");
setTopComponent(topPane);
setOrientation(VERTICAL_SPLIT);
JPanel availPanel = new JPanel(new BorderLayout());
FilterBar<Object, ClassFacade> bar = new FilterBar<>();
bar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
bar.addDisplayableFilter(qFilterButton);
availPanel.add(bar, BorderLayout.NORTH);
availableTable.setTreeCellRenderer(qualifiedRenderer);
availableTable.setDisplayableFilter(bar);
availPanel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
{
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
spinner.setMaximumSize(spinner.getPreferredSize());
box.add(spinner);
box.add(Box.createHorizontalStrut(5));
addButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addButton);
box.add(Box.createHorizontalStrut(5));
box.setBorder(new EmptyBorder(0, 0, 5, 0));
availPanel.add(box, BorderLayout.SOUTH);
}
topPane.setLeftComponent(availPanel);
JPanel selPanel = new JPanel(new BorderLayout());
JScrollPane tablePane = new JScrollPane(classTable);
selPanel.add(tablePane, BorderLayout.CENTER);
{
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(removeButton);
box.add(Box.createHorizontalGlue());
box.setBorder(new EmptyBorder(0, 0, 5, 0));
selPanel.add(box, BorderLayout.SOUTH);
}
{
classTable.setDragEnabled(true);
classTable.setTransferHandler(classTransferHandler);
availableTable.setDragEnabled(true);
availableTable.setTransferHandler(classTransferHandler);
}
initListeners();
topPane.setRightComponent(selPanel);
setBottomComponent(infoPane);
setResizeWeight(0.75);
}
use of pcgen.gui2.tools.FlippingSplitPane in project pcgen by PCGen.
the class AdvancedSourceSelectionPanel method initComponents.
private void initComponents() {
FlippingSplitPane mainPane = new FlippingSplitPane(JSplitPane.VERTICAL_SPLIT, "advSrcMain");
FlippingSplitPane topPane = new FlippingSplitPane("advSrcTop");
topPane.setResizeWeight(0.6);
JPanel panel = new JPanel(new BorderLayout());
//$NON-NLS-1$
panel.add(new JLabel(LanguageBundle.getString("in_src_gameLabel")), BorderLayout.WEST);
FacadeComboBoxModel<GameModeDisplayFacade> gameModes = new FacadeComboBoxModel<>();
gameModes.setListFacade(FacadeFactory.getGameModeDisplays());
gameModeList.setModel(gameModes);
gameModeList.addActionListener(this);
panel.add(gameModeList, BorderLayout.CENTER);
FilterBar<Object, CampaignFacade> bar = new FilterBar<>(false);
bar.add(panel, BorderLayout.WEST);
bar.addDisplayableFilter(new SearchFilterPanel());
panel = new JPanel(new BorderLayout());
panel.add(bar, BorderLayout.NORTH);
availableTable.setDisplayableFilter(bar);
availableTable.setTreeViewModel(availTreeViewModel);
availableTable.getSelectionModel().addListSelectionListener(this);
availableTable.setTreeCellRenderer(new CampaignRenderer());
((DynamicTableColumnModel) availableTable.getColumnModel()).getAvailableColumns().get(2).setCellRenderer(new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
JScrollPane pane = new JScrollPane(availableTable);
pane.setPreferredSize(new Dimension(600, 310));
panel.add(pane, BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
unloadAllButton.setAction(new UnloadAllAction());
box.add(unloadAllButton);
box.add(Box.createHorizontalGlue());
addButton.setHorizontalTextPosition(SwingConstants.LEADING);
addButton.setAction(new AddAction());
box.add(addButton);
box.add(Box.createHorizontalStrut(5));
box.setBorder(new EmptyBorder(0, 0, 5, 0));
panel.add(box, BorderLayout.SOUTH);
topPane.setLeftComponent(panel);
JPanel selPanel = new JPanel(new BorderLayout());
FilterBar<Object, CampaignFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
selectedTable.setDisplayableFilter(filterBar);
selectedTable.setTreeViewModel(selTreeViewModel);
selectedTable.getSelectionModel().addListSelectionListener(this);
selectedTable.setTreeCellRenderer(new CampaignRenderer());
((DynamicTableColumnModel) selectedTable.getColumnModel()).getAvailableColumns().get(2).setCellRenderer(new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
JScrollPane scrollPane = new JScrollPane(selectedTable);
scrollPane.setPreferredSize(new Dimension(300, 350));
selPanel.add(scrollPane, BorderLayout.CENTER);
box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
removeButton.setAction(new RemoveAction());
box.add(removeButton);
box.add(Box.createHorizontalGlue());
box.setBorder(new EmptyBorder(0, 0, 5, 0));
selPanel.add(box, BorderLayout.SOUTH);
topPane.setRightComponent(selPanel);
mainPane.setTopComponent(topPane);
linkAction.install();
infoPane.setPreferredSize(new Dimension(800, 150));
mainPane.setBottomComponent(infoPane);
mainPane.setResizeWeight(0.7);
setLayout(new BorderLayout());
add(mainPane, BorderLayout.CENTER);
}
Aggregations