com.instantbank.lettertemplate.editor.applet
Class TemplateEditor.CategoryNameTemplateDialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javax.swing.JDialog
                                |
                                +--com.instantbank.lettertemplate.editor.applet.TemplateEditor.CategoryNameTemplateDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
Enclosing class:
TemplateEditor

class TemplateEditor.CategoryNameTemplateDialog
extends javax.swing.JDialog

Gui that allows to capture/display --fully or partially-- the main attributes of a template: its category, its name, the name of its components. It doesn't deal with the text itself nor its images and variables.

Author:
InstantBank (Rodrigo Lopez)
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Inner classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private  CodeDescription[] bodies
           
(package private)  java.awt.BorderLayout brdLyCtrl
           
(package private)  java.awt.BorderLayout brdLySup
           
(package private)  javax.swing.JButton btnCancel
           
(package private)  javax.swing.JButton btnOK
           
private  CodeDescription[] categories
           
static int CATEGORY
           
private  java.lang.String catName
           
(package private)  javax.swing.JComboBox cbxCategory
           
private  CodeDescription[] cdTempl
          Code and description of the templates in the current category.
private  CodeDescription[] closings
           
(package private)  ComponentNameDisplay cndBody
           
(package private)  ComponentNameDisplay cndClosing
           
(package private)  ComponentNameDisplay cndHeader
           
 CodeDescription[] cntResult
           
(package private)  java.awt.GridBagLayout grbgDialog
           
(package private)  java.awt.GridLayout gridSupLeft
           
(package private)  java.awt.GridLayout gridSupRight
           
private  CodeDescription[] headers
           
(package private)  javax.swing.JLabel lblCategory
           
(package private)  javax.swing.JLabel lblName
           
(package private)  javax.swing.JLabel lblPrintType
           
private  CodeDescription[] localCodes
           
(package private)  javax.swing.JList lstNames
           
private  int mode
           
(package private)  javax.swing.JPanel pnlComp
           
(package private)  javax.swing.JPanel pnlCtrl
           
(package private)  javax.swing.JPanel pnlInf
           
(package private)  javax.swing.JPanel pnlOkCncel
           
(package private)  javax.swing.JPanel pnlSup
           
(package private)  javax.swing.JPanel pnlSupLeft
           
(package private)  javax.swing.JPanel pnlSupRight
           
static int RESPONSE
           
(package private)  javax.swing.JScrollPane scrNames
           
(package private)  javax.swing.JTextField txtPrintType
           
(package private)  javax.swing.JTextField txtTemplateName
           
(package private)  java.lang.String[] voidNames
           
 
Fields inherited from class javax.swing.JDialog
accessibleContext, defaultCloseOperation, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
base, keepBlocking, modal, nameCounter, resizable, serialVersionUID, title
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, state, warningString, weakThis, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TemplateEditor.CategoryNameTemplateDialog(long codeCategory, CodeDescription[] result, int mode)
          CategoryNameTemplateDialog constructor.
 
Method Summary
private  boolean[] checkOverwrite()
          Checks the template and/or components that can be overwritten by a save operation.
private  java.lang.String checkOverwritteWithNew()
          Helper method that aids to produce a convenient message warning about the components that can be modified when saving a template in the LetterOp.SAVEWITHNEW mode.
private  java.lang.String checkValidNames(boolean includeTemplate)
          Checks if the user has chosen valid names for the template and its components.
private  void cleanComponentsNamesCodes()
          Cleans the names of the components in the user interface.
private  void copyResult(CodeDescription[] from, CodeDescription[] to)
          Copies values from a < code,description> array to another < code,description> array.
private  void guiInit(int mode)
          Inits the CategoryNameTemplateDialog Gui after the 'interaction mode'
private  void putResult(CodeDescription[] to)
          Copies the names of the template and components in the result.
private  void refreshComponentsNames(long code)
          Searches code and names of a template and --if they are found-- displays the names in the user interface.
private  java.lang.String saveWarningMessage(boolean[] overwrite)
          Calculates a warning message with names and types of the template and/or components that will be modified.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, createRootPaneException, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
, addNotify, conditionalShow, constructComponentName, dispose, disposeImpl, getTitle, hide, hideAndDisposeHandler, initIDs, interruptBlocking, isModal, isResizable, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, eventEnabled, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postProcessKeyEvent, postWindowEvent, preProcessKeyEvent, processEvent, readObject, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, toBack, toFront, transferFocus, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

CATEGORY

public static final int CATEGORY

RESPONSE

public static final int RESPONSE

grbgDialog

java.awt.GridBagLayout grbgDialog

pnlSup

javax.swing.JPanel pnlSup

pnlSupLeft

javax.swing.JPanel pnlSupLeft

pnlSupRight

javax.swing.JPanel pnlSupRight

pnlInf

javax.swing.JPanel pnlInf

pnlCtrl

javax.swing.JPanel pnlCtrl

pnlComp

javax.swing.JPanel pnlComp

pnlOkCncel

javax.swing.JPanel pnlOkCncel

gridSupLeft

java.awt.GridLayout gridSupLeft

gridSupRight

java.awt.GridLayout gridSupRight

brdLySup

java.awt.BorderLayout brdLySup

brdLyCtrl

java.awt.BorderLayout brdLyCtrl

lblPrintType

javax.swing.JLabel lblPrintType

lblCategory

javax.swing.JLabel lblCategory

lblName

javax.swing.JLabel lblName

txtPrintType

javax.swing.JTextField txtPrintType

cbxCategory

javax.swing.JComboBox cbxCategory

txtTemplateName

javax.swing.JTextField txtTemplateName

lstNames

javax.swing.JList lstNames

scrNames

javax.swing.JScrollPane scrNames

btnOK

javax.swing.JButton btnOK

btnCancel

javax.swing.JButton btnCancel

cndHeader

ComponentNameDisplay cndHeader

cndBody

ComponentNameDisplay cndBody

cndClosing

ComponentNameDisplay cndClosing

categories

private CodeDescription[] categories

headers

private CodeDescription[] headers

bodies

private CodeDescription[] bodies

closings

private CodeDescription[] closings

voidNames

java.lang.String[] voidNames

catName

private java.lang.String catName

cdTempl

private CodeDescription[] cdTempl
Code and description of the templates in the current category.

localCodes

private CodeDescription[] localCodes

cntResult

public CodeDescription[] cntResult

mode

private int mode
Constructor Detail

TemplateEditor.CategoryNameTemplateDialog

public TemplateEditor.CategoryNameTemplateDialog(long codeCategory,
                                                 CodeDescription[] result,
                                                 int mode)
CategoryNameTemplateDialog constructor.
Parameters:
codeCategory - Template's category code. It can be undefined and the user will have to choose one.
result - An array of < code, description> that must be provided by the caller. It will be filled with the results so it can be used by the caller. The entries are arranged in the THBCCR order . Moreover, the last entry follows the convention,
  • code = JOptionPane.OK_OPTION if the OK button is pressed.
  • code = JOptionPane.CANCEL_OPTION if the Cancel button is pressed.
mode - Establishes the way the Gui can be used. Conventions are:
  • LetterOp.SAVEAS =>
    • The template is new (it is the first time it is going to be saved), or
    • It is an old template and the user wants to change its name and/or the component's names.
  • LetterOp.SAVEWITHNEW => It is an old template and the user wants to change one of its components.
  • LetterOp.LOAD => An existing template will be opened. This Gui is used to choose it and to display --not to change-- its main attributes.
Method Detail

guiInit

private void guiInit(int mode)
              throws java.lang.Exception
Inits the CategoryNameTemplateDialog Gui after the 'interaction mode'
Parameters:
mode - The mode of interaction: SAVEAS, LOAD, SAVEWITHNEW. See CategoryNameTemplateDialog main constructor
Throws:
java.lang.Exception - Description of the Exception

refreshComponentsNames

private void refreshComponentsNames(long code)
                             throws java.lang.Exception
Searches code and names of a template and --if they are found-- displays the names in the user interface. Moreover, it updates the template and components codes in the localCodes array.
Parameters:
code - Template's code.
Throws:
java.lang.Exception - Description of the Exception

cleanComponentsNamesCodes

private void cleanComponentsNamesCodes()
Cleans the names of the components in the user interface. Morover, it cleans the codes in the localCodes array.

copyResult

private void copyResult(CodeDescription[] from,
                        CodeDescription[] to)
Copies values from a < code,description> array to another < code,description> array. The arrays follow the THBCCR order but the RESPONSE entry is not copied.
Parameters:
from - The array the values will be copied from.
to - The array the values will be copied to.

putResult

private void putResult(CodeDescription[] to)
Copies the names of the template and components in the result. Moreover, copies the code and name of the selected category.
Parameters:
to - Array where the results --in the gui interface-- are moved to.

checkOverwrite

private boolean[] checkOverwrite()
Checks the template and/or components that can be overwritten by a save operation.
Returns:
A 4 positions boolean array following the THBC order .

For each entry in the returned array:

  • True = component will change.
  • False = component will not change.

Moreover, if every entry is going to be false, the value actually produced is null instead of the array of booleans.


checkOverwritteWithNew

private java.lang.String checkOverwritteWithNew()
Helper method that aids to produce a convenient message warning about the components that can be modified when saving a template in the LetterOp.SAVEWITHNEW mode.
Returns:
  • The type names of the components being modified.
  • "null" If there is no such components

checkValidNames

private java.lang.String checkValidNames(boolean includeTemplate)
Checks if the user has chosen valid names for the template and its components.
Parameters:
includeTemplate - When true, the template name is included in the verification.
Returns:
Null if all names are valid. Otherwise, a String explaining the first names which is invalid.

saveWarningMessage

private java.lang.String saveWarningMessage(boolean[] overwrite)
Calculates a warning message with names and types of the template and/or components that will be modified.
Parameters:
overwrite -  
Returns:
The warning message.