public class AddItemWindow
extends javax.swing.JDialog
implements java.awt.event.ActionListener
javax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
(package private) javax.swing.JCheckBox |
armrestsCheckBoxChair |
(package private) javax.swing.JButton |
buttonSwitchChair |
(package private) javax.swing.JButton |
buttonSwitchDesk |
(package private) javax.swing.JButton |
buttonSwitchTable |
(package private) javax.swing.JButton |
cancelButton |
(package private) javax.swing.JPanel |
chairPanel |
(package private) javax.swing.JCheckBox |
chromeCheckBoxTable |
(package private) javax.swing.JSpinner |
depthSpinnerDesk |
(package private) javax.swing.JPanel |
deskPanel |
(package private) javax.swing.JSpinner |
diameterSpinnerTable |
(package private) javax.swing.JSpinner |
drawsSpinnerDesk |
private int |
editIndex |
(package private) javax.swing.JSpinner |
idSpinnerChair |
(package private) javax.swing.JSpinner |
idSpinnerDesk |
(package private) javax.swing.JSpinner |
idSpinnerTable |
private boolean |
isEdit |
private ItemOrder |
order |
(package private) javax.swing.JSpinner |
quantitySpinnerChair |
(package private) javax.swing.JSpinner |
quantitySpinnerTable |
(package private) javax.swing.JPanel |
tablePanel |
(package private) javax.swing.JSpinner |
widthSpinnerDesk |
(package private) javax.swing.JComboBox |
woodComboBoxChair |
(package private) javax.swing.JComboBox |
woodComboBoxDesk |
(package private) javax.swing.JComboBox |
woodComboBoxTable |
private TypeWood[] |
woodTypes |
(package private) javax.swing.JButton |
yesButton |
(package private) javax.swing.JPanel |
yesnoPanel |
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
AddItemWindow(int defaultPanel,
ItemOrder o,
TypeWood[] tw)
Constructor used when adding a new item.
|
AddItemWindow(int defaultPanel,
ItemOrder o,
TypeWood[] tw,
int index,
Furniture f)
Constructor used when editing an existing item.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Action listener for the buttons shown on the window.
|
private void |
changeSelectedPanel(int i)
Changes the currently selected tab.
|
static int |
getTabValue(Furniture f)
Simple method for giving an instance of furnature and getting back the tab index of the object in the window.
|
ItemOrder |
getUpdatedOrder() |
private void |
initSelectButtons()
Initialises the three buttons displayed at the top of the frame (instantiates them, adds their text, creates the actionlistener and adds them to the panel).
|
private void |
initSelectedPanels()
Creates all of the panels and buttons and elements needed for each of the panels for each of the furniture items.
|
private void |
initWindowSettings()
Initialises basic elements of the window (such as layout, the default close operation and the modality type).
|
private void |
initYesNoButtons()
Initialises the 'Yes-No' buttons shown at the bottom of the form (creates them and adds them to the panel).
|
private void |
loadEditSettings(Furniture f)
Loads a given furniture item, and changes the window elements to the attributes of the given furniture item.
|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
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, validateTree
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, getPeer, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private ItemOrder order
private TypeWood[] woodTypes
private boolean isEdit
private int editIndex
javax.swing.JPanel chairPanel
javax.swing.JPanel tablePanel
javax.swing.JPanel deskPanel
javax.swing.JPanel yesnoPanel
javax.swing.JButton buttonSwitchChair
javax.swing.JButton buttonSwitchTable
javax.swing.JButton buttonSwitchDesk
javax.swing.JButton yesButton
javax.swing.JButton cancelButton
javax.swing.JSpinner idSpinnerChair
javax.swing.JSpinner quantitySpinnerChair
javax.swing.JSpinner idSpinnerDesk
javax.swing.JSpinner drawsSpinnerDesk
javax.swing.JSpinner widthSpinnerDesk
javax.swing.JSpinner depthSpinnerDesk
javax.swing.JSpinner idSpinnerTable
javax.swing.JSpinner quantitySpinnerTable
javax.swing.JSpinner diameterSpinnerTable
javax.swing.JComboBox woodComboBoxChair
javax.swing.JComboBox woodComboBoxDesk
javax.swing.JComboBox woodComboBoxTable
javax.swing.JCheckBox armrestsCheckBoxChair
javax.swing.JCheckBox chromeCheckBoxTable
public AddItemWindow(int defaultPanel, ItemOrder o, TypeWood[] tw)
initWindowSettings()
, initSelectButtons()
, initSelectedPanels()
, initYesNoButtons()
.defaultPanel
- Selects the panel that will be shown when the window is first shown (the default panel). Calls/is used in the function changeSelectedPanel(int)
.o
- The current item order that will be edited.tw
- An array if all of the wood types.public AddItemWindow(int defaultPanel, ItemOrder o, TypeWood[] tw, int index, Furniture f)
initWindowSettings()
, initSelectButtons()
, initSelectedPanels()
, initYesNoButtons()
.
loadEditSettings(Furniture)
which shows the current item's attributes in the window.defaultPanel
- Selects the panel that will be shown when the window is first shown (the default panel). Calls/is used in the function changeSelectedPanel(int)
.o
- The current item order that will be edited.tw
- An array if all of the wood types.index
- The index of the currently edited item within the ItemOrder (0-8, if not, will throw an exception).f
- The furniture object of the item that is being edited.private void initWindowSettings()
private void initSelectButtons()
private void initYesNoButtons()
private void initSelectedPanels()
private void loadEditSettings(Furniture f)
f
- Given furniture item.public static int getTabValue(Furniture f)
f
- The furniture item.private void changeSelectedPanel(int i)
i
- The tab index to switch views to. (1-3. If not a valid index, will display an empty panel.)public ItemOrder getUpdatedOrder()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- ActionEvent.