The main window for PCGen. In addition, this class is responsible for providing global UI functions such as message dialogs.
| 120 | * global UI functions such as message dialogs. |
| 121 | */ |
| 122 | public final class PCGenFrame extends JFrame implements UIDelegate, CharacterSelectionListener |
| 123 | { |
| 124 | |
| 125 | private final PCGenActionMap actionMap; |
| 126 | private final CharacterTabs characterTabs; |
| 127 | private final PCGenStatusBar statusBar; |
| 128 | private final PCGenMenuBar pcGenMenuBar; |
| 129 | |
| 130 | /** |
| 131 | * The context indicating what items are currently loaded/being processed in the UI |
| 132 | */ |
| 133 | private final UIContext uiContext; |
| 134 | |
| 135 | private final DefaultReferenceFacade<SourceSelectionFacade> currentSourceSelection; |
| 136 | private final DefaultReferenceFacade<CharacterFacade> currentCharacterRef; |
| 137 | private final DefaultReferenceFacade<DataSetFacade> currentDataSetRef; |
| 138 | private final FilenameListener filenameListener; |
| 139 | private JDialog sourceSelectionDialog; |
| 140 | private SourceLoadWorker sourceLoader; |
| 141 | private String section15; |
| 142 | private String lastCharacterPath; |
| 143 | /** |
| 144 | * This is a bit of a hack until we're full on JavaFX for showing dialogs |
| 145 | */ |
| 146 | private Stage javaFXStage; |
| 147 | |
| 148 | private AboutDialog javaFXAboutDialog; |
| 149 | |
| 150 | public PCGenFrame(UIContext uiContext) |
| 151 | { |
| 152 | this.uiContext = Objects.requireNonNull(uiContext); |
| 153 | Globals.setRootFrame(this); |
| 154 | this.currentSourceSelection = uiContext.getCurrentSourceSelectionRef(); |
| 155 | this.currentCharacterRef = new DefaultReferenceFacade<>(); |
| 156 | this.currentDataSetRef = new DefaultReferenceFacade<>(); |
| 157 | this.actionMap = new PCGenActionMap(this, uiContext); |
| 158 | this.characterTabs = new CharacterTabs(this); |
| 159 | this.statusBar = new PCGenStatusBar(this); |
| 160 | this.filenameListener = new FilenameListener(); |
| 161 | Observer messageObserver = new ShowMessageGuiObserver(this); |
| 162 | ShowMessageDelegate.getInstance().addObserver(messageObserver); |
| 163 | ChooserFactory.setDelegate(this); |
| 164 | this.pcGenMenuBar = new PCGenMenuBar(this, uiContext); |
| 165 | initComponents(); |
| 166 | pack(); |
| 167 | initSettings(); |
| 168 | Platform.runLater(() -> { |
| 169 | javaFXStage = new Stage(); |
| 170 | javaFXAboutDialog = new AboutDialog(javaFXStage); |
| 171 | } |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | private void initComponents() |
| 176 | { |
| 177 | setLayout(new BorderLayout()); |
| 178 | |
| 179 | JComponent root = getRootPane(); |
nothing calls this directly
no outgoing calls
no test coverage detected