use of pcgen.gui2.UIPropertyContext in project pcgen by PCGen.
the class ExportDialog method initComponents.
private void initComponents() {
characterBox.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
CharacterFacade character = (CharacterFacade) value;
return super.getListCellRendererComponent(list, character.getNameRef().get(), index, isSelected, cellHasFocus);
}
});
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fileList.addListSelectionListener(this);
exportButton.setDefaultCapable(true);
getRootPane().setDefaultButton(exportButton);
partyBox.setActionCommand(PARTY_COMMAND);
exportBox.setActionCommand(EXPORT_TO_COMMAND);
exportButton.setActionCommand(EXPORT_COMMAND);
closeButton.setActionCommand(CLOSE_COMMAND);
exportBox.addActionListener(this);
partyBox.addActionListener(this);
exportButton.addActionListener(this);
closeButton.addActionListener(this);
exportButton.setEnabled(false);
progressBar.setStringPainted(true);
progressBar.setString("Loading Templates");
progressBar.setIndeterminate(true);
setTitle("Export a PC or Party");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
UIPropertyContext context = UIPropertyContext.createContext("ExportDialog");
String defaultOSType = context.getProperty(UIPropertyContext.DEFAULT_OS_TYPE);
if (defaultOSType != null) {
for (SheetFilter filter : SheetFilter.values()) {
if (defaultOSType.equals(filter.toString())) {
exportBox.setSelectedItem(filter);
}
}
}
}
use of pcgen.gui2.UIPropertyContext in project pcgen by PCGen.
the class ChooserDialog method overridePrefs.
/**
* We don't want some things recalled in preferences (e.g. tree sorting) as they
* aren't the same for all choose data. Ensure we put out desired values in first.
*/
private void overridePrefs() {
UIPropertyContext baseContext = UIPropertyContext.createContext("tablePrefs");
PropertyContext context = baseContext.createChildContext(treeViewModel.getDataView().getPrefsKey());
final String VIEW_INDEX_PREFS_KEY = "viewIdx";
context.setInt(VIEW_INDEX_PREFS_KEY, treeViewModel.getDefaultTreeViewIndex());
}
Aggregations