Package com.j3d.ui.engine
Class EngineFrame
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
com.j3d.ui.engine.EngineFrame
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants
Possibly. The most chaotic, most important UI. This is the main UI of the entire app where the user
will spend ALL of their time and where just everything has to connect.
As a result, this class is also the orchestrator of all the important references storted
within StaticRefs.
Like all other UI, it's generated with NetBeans, hence the initComponents().
- Author:
- Lehlogonolo Poole
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CommandPaletteThe command palette instance.private ContextMenuprivate JMenuItemprivate static booleanBoolean flag to runFloatingPanelinstances only if the engine is in a "running" stateprivate JMenuprivate JMenuItemprivate JMenuThe arraylist of runnables to initialise floaters whenEngineFrameis ready.private GuideManagerprivate JMenuprivate JMenuItemprivate static booleanA flag to indicate if an old project file version was loaded during thereadFileUsingVers(File, int)process.private JMenuItemprivate JMenuprivate JMenustatic JPanelprivate static MOwnerThe defaultMouseOwner. being selectionstatic ScreenPointThe position of the mouse that is suspected by this frame.private JMenuItemprivate JMenuItemprivate JMenuItemprivate final intprivate JMenuItemprivate JMenuItemprivate JMenuItemprivate JMenuprivate JMenuItemprivate JMenuItemprivate JMenuItemprivate JMenustatic ScreenPoint[]The selection area of the actual selectionprivate JMenuItemprivate JMenuItemprivate JMenuItemprivate JMenuItemprivate JMenuItemprivate JMenuFields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.EngineFrame(Artefact artifact, boolean showTutorial) Constructor with a boolean flag to initialise the executor.EngineFrame(File file) Constructor to initialise the engine frame and immediately load up a project file. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddFloaterAt(FloatingPanel p, Point lastLocation) Adds a floating panel to the engine.static voidBrings a floating panel forward in the layer pane.private voidvoidCompletes by manually initialising almost everything.private voidvoiddispose()private voidstatic MOwnerRetries the mouse owner.private voidThis method is called from within the constructor to initialize the form.private voidAdds all the mouse owners.private voidprivate voidstatic voidprivate voidprivate voidprivate voidstatic voidreadFileUsingVers(File file, int vers) Reads a project file using a specified protocol version.private voidreadProjectFile(File file) Extracts all the file stuff like its path and name, logs the read and also actually reads it by wrapping it in aLongTaskso it runs off the EDTprivate voidprivate voidstatic voidRemoves a floating panel from the EngineFramestatic voidrepaintL()Repaints the debug panel, command pallete, and main frame on the Event Dispatch Thread.private voidprivate voidprivate voidprivate voidprivate voidSets all the closing operations:static voidsetMouseOwner(MOwner owner) Sets the mouse owner.private voidvoidshowContextMenu(int x, int y) private voidprivate voidprivate voidprivate voidMethods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
defer
private static boolean deferBoolean flag to runFloatingPanelinstances only if the engine is in a "running" state -
mouseOwner
The defaultMouseOwner. being selection- See Also:
-
mousePos
The position of the mouse that is suspected by this frame. Do not trust this value. you might need to do offset magic withStaticConfig.jMenuBarOffsetY -
selectionArea
The selection area of the actual selection- See Also:
-
commandPalette
The command palette instance.- See Also:
-
contextMenu
-
guideManager
-
floats
The arraylist of runnables to initialise floaters whenEngineFrameis ready. -
PF_VERSION
private final int PF_VERSION- See Also:
-
LOADED_OLD
private static boolean LOADED_OLDA flag to indicate if an old project file version was loaded during thereadFileUsingVers(File, int)process. This is used to prevent redundant processing when attempting to load newer versions after a fallback to an older version has already occurred. -
copyMenuItem
-
editJMenu
-
exportAsPNGJMenuItem
-
exportJMenuItemDropDown
-
jMenu1
-
jMenuBar1
-
jMenuItem1
-
macroEditorMenu
-
macroJMenu
-
macroMainMenu
-
mainPanel
-
newProjectJMenuItem
-
openProjectMenuItem
-
pasteMenuItem
-
redoJMenuItem
-
redrawJMenuItem
-
resetCameraJMenuItem
-
resetJMenuItemDropDown
-
resetOrientationJMenuItem
-
resetPositionJMenuItem
-
saveProjectJMenuItem
-
sceneJMenu
-
settingsMenuItem
-
toggleViewJMenuItem
-
undoJMenuItem
-
viewAsNormalJMenuItem
-
viewAsWireframeJMenuItem
-
viewJMenu
-
-
Constructor Details
-
EngineFrame
public EngineFrame()Default constructor. Initialises the entire engine in a clean state. -
EngineFrame
Constructor to initialise the engine frame and immediately load up a project file.- Parameters:
file- The File instance to load up.- See Also:
-
EngineFrame
Constructor with a boolean flag to initialise the executor.- Parameters:
artifact- The artefact to run
-
-
Method Details
-
showContextMenu
public void showContextMenu(int x, int y) -
getCommandPalette
-
setMouseOwner
Sets the mouse owner.- Parameters:
owner- The mouse owner's enum identifier- See Also:
-
getMouseOwner
Retries the mouse owner.- Returns:
- The mouse owner's enum identifier.
- See Also:
-
addFloaterAt
Adds a floating panel to the engine. Or otherwise if the engine hasn't been built will add it later via aRunnable- Parameters:
p- The floating panel to addlastLocation- The last location the mouse was at- See Also:
-
bringForward
Brings a floating panel forward in the layer pane.- Parameters:
p- The floating panel
-
removeFloater
Removes a floating panel from the EngineFrame- Parameters:
p- The floating panel
-
dispose
public void dispose() -
complete
Completes by manually initialising almost everything. I have no more words.- Parameters:
artefact- The artefact to run.
-
getGuideManager
-
buildContextMenu
private void buildContextMenu() -
readProjectFile
Extracts all the file stuff like its path and name, logs the read and also actually reads it by wrapping it in aLongTaskso it runs off the EDT- Parameters:
file- The file to read.- See Also:
-
readFileUsingVers
Reads a project file using a specified protocol version. This method extracts file information, sets the project output file, and initiates an asynchronous read operation using aLongTask. It includes error handling that can trigger a fallback to an older project file version if the initial read fails.- Parameters:
file- TheFileobject representing the project file to read.vers- The version number of theProjectFileprotocol to attempt reading with. For example, `2` forPF2.- See Also:
-
setCloseOperations
private void setCloseOperations()Sets all the closing operations:1. The window will do nothing when it closes
2. If the user made a change and hasn't saved since, will prompt the user with and are you sure dialogue. Similar to running the command
ExitCmd -
initMouseOwners
private void initMouseOwners()Adds all the mouse owners.- See Also:
-
repaintL
public static void repaintL()Repaints the debug panel, command pallete, and main frame on the Event Dispatch Thread. This should only be called from non-EDT threads. e.g. from the SceneManager thread. -
getDrawPanel
-
getMacroJMenu
-
initComponents
private void initComponents()This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. -
resetPositionJMenuItemActionPerformed
-
undoJMenuItemActionPerformed
-
redoJMenuItemActionPerformed
-
resetOrientationJMenuItemActionPerformed
-
resetCameraJMenuItemActionPerformed
-
redrawJMenuItemActionPerformed
-
viewAsWireframeJMenuItemActionPerformed
-
viewAsNormalJMenuItemActionPerformed
-
openProjectMenuItemActionPerformed
-
saveProjectJMenuItemActionPerformed
-
newProjectJMenuItemActionPerformed
-
exportAsPNGJMenuItemActionPerformed
-
settingsMenuItemActionPerformed
-
jMenuItem1ActionPerformed
-
pasteMenuItemActionPerformed
-
copyMenuItemActionPerformed
-
toggleViewJMenuItemActionPerformed
-
macroEditorMenuActionPerformed
-
main
- Parameters:
args- the command line arguments
-