Package mgui.interfaces
Class InterfaceSplitPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mgui.interfaces.InterfacePanel
mgui.interfaces.graphics.InterfaceGraphicWindow
mgui.interfaces.InterfaceSplitPanel
- All Implemented Interfaces:
java.awt.event.ComponentListener
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,AttributeListener
,AttributeObject
,DisplayListener
,WindowContainer
,WindowListener
,InterfaceObject
,CategoryObject
,PopupMenuObject
,NamedObject
,ShapeListener
,TreeObject
,CleanableObject
,XMLObject
,IconObject
public class InterfaceSplitPanel extends InterfaceGraphicWindow implements java.awt.event.ComponentListener, WindowContainer
Displays two
InterfaceGraphicWindow
s, split either horizontally or vertically. The split ratio is
adjustable.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class mgui.interfaces.graphics.InterfaceGraphicWindow
InterfaceGraphicWindow.GraphicButton
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<SplitPanelListener>
listeners
protected InterfaceGraphicWindow
panel1
protected InterfaceGraphicWindow
panel2
protected int
split_orientation
Fields inherited from class mgui.interfaces.graphics.InterfaceGraphicWindow
old_panel, panel, parent_panel, title_button, window_listeners
Fields inherited from class mgui.interfaces.InterfacePanel
attributes, displayListeners, isDestroyed, last_click_point, statusBar, tree_nodes, treeNode, type
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors Constructor Description InterfaceSplitPanel(int direction, InterfaceGraphicWindow panel1, InterfaceGraphicWindow panel2)
-
Method Summary
Modifier and Type Method Description void
addSplitPanelListener(SplitPanelListener listener)
void
destroy()
Destroy this object (prepare it to be removed from memory)InterfaceGraphicWindow
findWindow(java.lang.String name)
Searches this split pane for a window with the titlename
.protected void
fireSplitPanelChanged(SplitPanelEvent event)
void
flip()
Flips the orientation of this split panel.java.lang.String
getLocalName()
Returns the local name associated with this XML object.InterfaceGraphicWindow
getOtherWindow(InterfaceGraphicWindow window)
Returns the window that is notwindow
, if one exists.InterfaceGraphic<?>
getPanel()
InterfaceSplitPanel
getParent(InterfaceGraphicWindow window)
Returns the parent panel ofwindow
.InterfaceSplitPanelint
getSide(InterfaceGraphicWindow window)
Returns the side of the split panewindow
is on.int
getSplitOrientation()
Returns the current orientation for this split panel; see JSplitPane.VERTICAL_SPLIT.protected java.util.PriorityQueue<mgui.interfaces.InterfaceSplitPanel.DepthPanel>
getSplitPanelQueue(int depth)
Returns a reversed queue of split panels, with the bottom-most being the highest in the nested treejava.util.Stack<InterfaceGraphicWindow>
getSplitPanelStack()
Returns a stack of split panels, with the top-most being the highest in the nested treedouble
getSplitRatio()
InterfaceGraphicWindow
getWindow(int side)
Returns the window on the specified side of the panel; where 0 = left, 1 = right.protected java.util.ArrayList<InterfaceGraphicWindow>
getWindows(int depth, int max_depth)
java.util.ArrayList<InterfaceGraphicWindow>
getWindowsBreadthFirst()
Returns a breadth-first list of windows contained by this split panel; meaning that the first windows are on the top-most level and later windows are increasingly deep in the nesting tree.java.util.ArrayList<InterfaceGraphicWindow>
getWindowsDepthFirst()
Returns a depth-first list of all windows contained by this split panel or its nested panels (left or top first).protected void
init()
void
removeSplitPanelListener(SplitPanelListener listener)
void
removeWindow(InterfaceGraphicWindow window)
Removechild
from this container, and notify listeners.void
removeWindow(InterfaceGraphicWindow window, boolean notify)
Removechild
from this container.boolean
replace(InterfaceGraphicWindow old, InterfaceGraphicWindow nieuw)
Replaceold
withnieuw
.void
setName(java.lang.String thisName)
Sets the name for this object.void
setPanel(InterfaceGraphic p)
void
setSplitRatio(double loc)
void
swap()
Swaps the two components of this split paneljava.lang.String
toString()
void
updateDisplay()
Requests this panel to update its display.void
updateTitle()
void
windowSourceChanged(WindowEvent e)
void
windowUpdated(WindowEvent e)
void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.graphics.InterfaceGraphicWindow
addWindowListener, firePanelChanged, fireWindowListeners, getDisplayPanel, getDTD, getObjectIcon, getOldPanel, getParentPanel, getPopupLength, getPopupMenu, getShortXML, getTitle, getTitleButton, getXML, getXML, getXMLSchema, handlePopupEvent, handleXMLElementEnd, handleXMLElementStart, handleXMLString, removeWindowListener, setPanelName, setParentPanel, writeXML, writeXML
Methods inherited from class mgui.interfaces.InterfacePanel
_init, addDisplayListener, attributeUpdated, clean, cleanUpPanel, collapseAllCategories, collapseCategory, collapseOtherCategories, componentHidden, componentMoved, componentResized, componentShown, expandAllCategories, expandCategory, fireDisplayListeners, getAttribute, getAttributes, getAttributeValue, getLocalAttributes, getPopupMenu, getSource, getTreeLabel, getType, isDestroyed, issueTreeNode, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, removeDisplayListener, setAttribute, setAttributes, setSource, setStatusBar, setTreeNode, setType, shapeUpdated, showPanel, showPopupMenu, updateDisplays, updateFromDialog, updateTreeNodes
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.event.ComponentListener
componentHidden, componentMoved, componentResized, componentShown
Methods inherited from interface mgui.interfaces.NamedObject
getName
-
Field Details
-
split_orientation
protected int split_orientation -
panel1
-
panel2
-
listeners
-
-
Constructor Details
-
InterfaceSplitPanel
public InterfaceSplitPanel(int direction, InterfaceGraphicWindow panel1, InterfaceGraphicWindow panel2)
-
-
Method Details
-
setSplitRatio
public void setSplitRatio(double loc) -
getSplitRatio
public double getSplitRatio() -
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Specified by:
destroy
in interfaceShapeListener
- Overrides:
destroy
in classInterfaceGraphicWindow
-
addSplitPanelListener
-
removeSplitPanelListener
-
fireSplitPanelChanged
-
getSplitOrientation
public int getSplitOrientation()Returns the current orientation for this split panel; see JSplitPane.VERTICAL_SPLIT.- Returns:
-
getOtherWindow
Returns the window that is notwindow
, if one exists.- Parameters:
window
-- Returns:
- The other window, or
null
if there is none, or ifwindow
is not a child of this split panel
-
windowUpdated
- Specified by:
windowUpdated
in interfaceWindowListener
-
windowSourceChanged
- Specified by:
windowSourceChanged
in interfaceWindowListener
-
getWindowsBreadthFirst
Returns a breadth-first list of windows contained by this split panel; meaning that the first windows are on the top-most level and later windows are increasingly deep in the nesting tree.- Parameters:
max_depth
- The maximum depth in the nesting tree to search- Returns:
-
getWindowsDepthFirst
Returns a depth-first list of all windows contained by this split panel or its nested panels (left or top first).- Returns:
-
getParent
Returns the parent panel ofwindow
.InterfaceSplitPanel- Parameters:
window
-- Returns:
- The parent, or
null
if window is not found.
-
replace
Replaceold
withnieuw
.- Parameters:
old
-nieuw
-- Returns:
true
if window was replaced;false
if there is no such window
-
removeWindow
Description copied from interface:WindowContainer
Removechild
from this container, and notify listeners.- Specified by:
removeWindow
in interfaceWindowContainer
-
removeWindow
Description copied from interface:WindowContainer
Removechild
from this container.- Specified by:
removeWindow
in interfaceWindowContainer
notify
- Whether to notify listeners
-
getSide
Returns the side of the split panewindow
is on.- Returns:
- 0 for left/top; 1 for right/bottom; -1 if not in this panel
-
getWindow
Returns the window on the specified side of the panel; where 0 = left, 1 = right.- Parameters:
side
-- Returns:
-
findWindow
Searches this split pane for a window with the titlename
.- Parameters:
name
-- Returns:
- The window, or
null
if not found.
-
flip
public void flip()Flips the orientation of this split panel. -
swap
public void swap()Swaps the two components of this split panel -
getSplitPanelStack
Returns a stack of split panels, with the top-most being the highest in the nested tree- Returns:
-
getSplitPanelQueue
protected java.util.PriorityQueue<mgui.interfaces.InterfaceSplitPanel.DepthPanel> getSplitPanelQueue(int depth)Returns a reversed queue of split panels, with the bottom-most being the highest in the nested tree- Returns:
-
getWindows
-
init
protected void init()- Overrides:
init
in classInterfaceGraphicWindow
-
setPanel
- Overrides:
setPanel
in classInterfaceGraphicWindow
-
updateTitle
public void updateTitle()- Overrides:
updateTitle
in classInterfaceGraphicWindow
-
setName
public void setName(java.lang.String thisName)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
- Overrides:
setName
in classInterfaceGraphicWindow
-
getPanel
- Overrides:
getPanel
in classInterfaceGraphicWindow
-
updateDisplay
public void updateDisplay()Description copied from class:InterfacePanel
Requests this panel to update its display.- Specified by:
updateDisplay
in interfaceDisplayListener
- Overrides:
updateDisplay
in classInterfaceGraphicWindow
-
toString
public java.lang.String toString()- Overrides:
toString
in classInterfaceGraphicWindow
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Overrides:
getLocalName
in classInterfaceGraphicWindow
- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Specified by:
writeXML
in interfaceXMLObject
- Overrides:
writeXML
in classInterfaceGraphicWindow
- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writeroptions
- XMLOutputOptions defining the write parametersprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-