use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class PCGenFrame method saveAllCharacters.
boolean saveAllCharacters() {
boolean ok = true;
for (CharacterFacade character : CharacterManager.getCharacters()) {
File file = character.getFileRef().get();
if (file == null || StringUtils.isEmpty(file.getName())) {
ok &= showSaveCharacterChooser(character);
} else {
prepareForSave(character, true);
ok &= reallySaveCharacter(character);
}
}
return ok;
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class PurchaseInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
//$NON-NLS-1$
FlippingSplitPane splitPane = new FlippingSplitPane("PurchaseTop");
splitPane.setOrientation(HORIZONTAL_SPLIT);
{
// Top Left panel
FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
{
// Filters
filterBar.addDisplayableFilter(new SearchFilterPanel());
FilterButton<CharacterFacade, EquipmentFacade> premadeFilter = //$NON-NLS-1$
new FilterButton<>("EqQualified");
//$NON-NLS-1$
premadeFilter.setText(LanguageBundle.getString("in_igQualFilter"));
premadeFilter.setFilter(CharacterFacade::isQualifiedFor);
FilterButton<CharacterFacade, EquipmentFacade> customFilter = //$NON-NLS-1$
new FilterButton<>("EqAffordable");
//$NON-NLS-1$
customFilter.setText(LanguageBundle.getString("in_igAffordFilter"));
customFilter.setFilter(new Filter<CharacterFacade, EquipmentFacade>() {
@Override
public boolean accept(CharacterFacade context, EquipmentFacade element) {
return context.getInfoFactory().getCost(element) <= context.getFundsRef().get().floatValue();
}
});
filterBar.addDisplayableFilter(premadeFilter);
filterBar.addDisplayableFilter(customFilter);
}
JPanel panel = new JPanel(new BorderLayout());
panel.add(filterBar, BorderLayout.NORTH);
availableTable.setTreeCellRenderer(equipmentRenderer);
availableTable.setDisplayableFilter(filterBar);
panel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(autoResizeBox);
box.add(Box.createHorizontalGlue());
addCustomButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addCustomButton);
box.add(Box.createHorizontalStrut(5));
addEquipmentButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addEquipmentButton);
box.add(Box.createHorizontalStrut(5));
box.setBorder(new EmptyBorder(0, 0, 5, 0));
panel.add(box, BorderLayout.SOUTH);
splitPane.setLeftComponent(panel);
}
{
// Top Right panel
FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
JPanel panel = new JPanel(new BorderLayout());
panel.add(filterBar, BorderLayout.NORTH);
purchasedTable.setDisplayableFilter(filterBar);
purchasedTable.setTreeCellRenderer(equipmentRenderer);
panel.add(new JScrollPane(purchasedTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(removeEquipmentButton);
box.add(Box.createHorizontalGlue());
box.setBorder(new EmptyBorder(0, 0, 5, 0));
panel.add(box, BorderLayout.SOUTH);
splitPane.setRightComponent(panel);
}
setTopComponent(splitPane);
//$NON-NLS-1$
splitPane = new FlippingSplitPane("PurchaseBottom");
splitPane.setOrientation(HORIZONTAL_SPLIT);
{
// Bottom Left Panel
JPanel panel = new JPanel();
initMoneyPanel(panel);
splitPane.setLeftComponent(panel);
}
{
// Bottom Right Panel
//$NON-NLS-1$
infoPane.setTitle(LanguageBundle.getString("in_igEqInfo"));
splitPane.setRightComponent(infoPane);
}
splitPane.setResizeWeight(0.25);
setResizeWeight(1);
setBottomComponent(splitPane);
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class AbilityChooserTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
availableTreeViewPanel.setDefaultRenderer(Boolean.class, new BooleanRenderer());
availableTreeViewPanel.setTreeCellRenderer(qualifiedRenderer);
selectedTreeViewPanel.setTreeCellRenderer(abilityRenderer);
FilterBar<CharacterFacade, AbilityFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
filterBar.addDisplayableFilter(qFilterButton);
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTreeViewPanel, filterBar);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
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);
JPanel selPanel = new JPanel(new BorderLayout());
selPanel.add(new JScrollPane(selectedTreeViewPanel), BorderLayout.CENTER);
AbilityTreeTableModel.initializeTreeTable(selectedTreeViewPanel);
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);
FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, selPanel, "abilityTop");
setTopComponent(topPane);
FilterButton<CharacterFacade, AbilityCategoryFacade> gainedFilterButton = new FilterButton<>("AbilityGained", true);
//$NON-NLS-1$
gainedFilterButton.setText(LanguageBundle.getString("in_gained"));
gainedFilterButton.setEnabled(true);
gainedFilterButton.setFilter(new Filter<CharacterFacade, AbilityCategoryFacade>() {
@Override
public boolean accept(CharacterFacade context, AbilityCategoryFacade element) {
return context.getActiveAbilityCategories().containsElement(element);
}
});
categoryBar.addDisplayableFilter(gainedFilterButton);
JPanel filterPanel = new JPanel(new BorderLayout());
filterPanel.add(categoryBar, BorderLayout.NORTH);
filterPanel.add(new JScrollPane(categoryTable), BorderLayout.CENTER);
FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "abilityBottom");
bottomPane.setLeftComponent(filterPanel);
bottomPane.setRightComponent(infoPane);
setBottomComponent(bottomPane);
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class DomainInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
deityTable.setTreeCellRenderer(qualifiedRenderer);
JPanel panel = new JPanel(new BorderLayout());
FilterBar<Object, DeityFacade> bar = new FilterBar<>();
bar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qDeityButton.setText(LanguageBundle.getString("in_igQualFilter"));
bar.addDisplayableFilter(qDeityButton);
deityTable.setDisplayableFilter(bar);
panel.add(bar, BorderLayout.NORTH);
ListSelectionModel selectionModel = deityTable.getSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
panel.add(new JScrollPane(deityTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
box.add(new JLabel(LanguageBundle.getString("in_domDeityLabel")));
box.add(Box.createHorizontalStrut(5));
box.add(selectedDeity);
box.add(Box.createHorizontalStrut(5));
box.add(selectDeity);
box.add(Box.createHorizontalGlue());
panel.add(box, BorderLayout.SOUTH);
FlippingSplitPane splitPane = new FlippingSplitPane("DomainTop");
splitPane.setLeftComponent(panel);
panel = new JPanel(new BorderLayout());
FilterBar<CharacterFacade, DomainFacade> dbar = new FilterBar<>();
dbar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qDomainButton.setText(LanguageBundle.getString("in_igQualFilter"));
dbar.addDisplayableFilter(qDomainButton);
domainFilter = dbar;
panel.add(dbar, BorderLayout.NORTH);
selectionModel = domainTable.getSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
domainTable.setAutoCreateColumnsFromModel(false);
domainTable.setColumnModel(createDomainColumnModel());
JScrollPane scrollPane = TableUtils.createCheckBoxSelectionPane(domainTable, domainRowHeaderTable);
panel.add(scrollPane, BorderLayout.CENTER);
box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
box.add(new JLabel(LanguageBundle.getString("in_domRemainDomLabel")));
box.add(Box.createHorizontalStrut(5));
box.add(selectedDomain);
box.add(Box.createHorizontalGlue());
panel.add(box, BorderLayout.SOUTH);
splitPane.setRightComponent(panel);
setTopComponent(splitPane);
splitPane = new FlippingSplitPane("DomainBottom");
splitPane.setLeftComponent(deityInfo);
splitPane.setRightComponent(domainInfo);
setBottomComponent(splitPane);
setResizeWeight(0.65);
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class SkillInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
setResizeWeight(0.70);
JSpinner spinner = new JSpinner();
//$NON-NLS-1$
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#0.#"));
skillTable.setDefaultRenderer(Float.class, new SpinnerRenderer(spinner));
skillTable.setDefaultRenderer(Integer.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setDefaultRenderer(String.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setRowHeight(26);
FilterBar<CharacterFacade, SkillFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
cFilterButton.setText(LanguageBundle.getString("in_classString"));
cFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(cFilterButton);
//$NON-NLS-1$
trainedFilterButton.setText(LanguageBundle.getString("in_trained"));
trainedFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(trainedFilterButton);
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(skillTable, filterBar);
availPanel.setPreferredSize(new Dimension(650, 300));
JScrollPane tableScrollPane;
JPanel tablePanel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
constraints.fill = java.awt.GridBagConstraints.BOTH;
constraints.weightx = 1.0;
constraints.ipady = 0;
constraints.weighty = 1.0;
SkillPointTableModel.initializeTable(skillpointTable);
tableScrollPane = new JScrollPane(skillpointTable);
tablePanel.add(tableScrollPane, constraints);
htmlPane.setOpaque(false);
htmlPane.setEditable(false);
htmlPane.setFocusable(false);
//$NON-NLS-1$
htmlPane.setContentType("text/html");
skillFilterBox.setRenderer(new DefaultListCellRenderer());
JScrollPane selScrollPane = new JScrollPane(htmlPane);
JPanel skillPanel = new JPanel(new BorderLayout());
skillPanel.add(skillFilterBox, BorderLayout.NORTH);
skillPanel.add(selScrollPane, BorderLayout.CENTER);
selScrollPane.setPreferredSize(new Dimension(530, 300));
FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, skillPanel, "SkillTop");
setTopComponent(topPane);
FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "SkillBottom");
bottomPane.setLeftComponent(tablePanel);
tablePanel.setPreferredSize(new Dimension(650, 100));
bottomPane.setRightComponent(infoPane);
infoPane.setPreferredSize(new Dimension(530, 100));
setBottomComponent(bottomPane);
}
Aggregations