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

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javax.swing.JDialog
                                |
                                +--com.instantbank.lettertemplate.editor.applet.TemplateEditor.MarginDialog
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.MarginDialog
extends javax.swing.JDialog

User dialog that allows to define margins for a template.

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  int[] answer
          Place holder for values sent to the client.
private  int bottom
          Bottom margin value (in twips)
(package private)  javax.swing.JButton btnCancel
           
(package private)  javax.swing.JButton btnOK
           
private  java.text.DecimalFormat df
          Formatter for margin values.
(package private)  javax.swing.JLabel lblBottom
           
(package private)  javax.swing.JLabel lblLeft
           
(package private)  javax.swing.JLabel lblRight
           
(package private)  javax.swing.JLabel lblTitle
           
(package private)  javax.swing.JLabel lblTop
           
private  int left
          Left margin value (in twips)
static int MAX_HOR
          Maximum horizontal margin (left+right) in twips.
private static int MAX_HOR_INCH
          Maximum horizontal margin, in inches.
static int MAX_VERT
          Maximum vertical margin (top+bottom) in twips.
private static int MAX_VERT_INCH
          Maximum vertical margin, in inches.
(package private)  javax.swing.JPanel pnlCtrl
           
(package private)  javax.swing.JPanel pnlInf
           
private  int right
          Right margin value (in twips)
private  int top
          Top margin value (in twips)
static int TWIPS_IN_INCH
          Number of twips in one inch
(package private)  javax.swing.JTextField txtBottom
           
(package private)  javax.swing.JTextField txtLeft
           
(package private)  javax.swing.JTextField txtRight
           
(package private)  javax.swing.JTextField txtTop
           
 
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.MarginDialog(int[] answer, int left, int right, int top, int bottom)
          MarginDialog constructor.
 
Method Summary
private  void checkAdd(int first, int snd, int maxadd, javax.swing.JTextField sndTxt)
          Checks if the sum of two opposed margins does not exceed a limit.
private  int checkDouble(java.lang.String msg, javax.swing.JTextField txt, int max)
          Checks if the value typed in a text box does not exceed a margin limit.
private  void guiInit()
          User controls initialization
 void setMargin(int twips, javax.swing.JTextField txt)
          Displays a value (converted to inches) in a text field.
 void setTitle(java.lang.String s)
          Setter for the title attribute.
 
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, 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

TWIPS_IN_INCH

public static final int TWIPS_IN_INCH
Number of twips in one inch

MAX_HOR_INCH

private static final int MAX_HOR_INCH
Maximum horizontal margin, in inches.

MAX_VERT_INCH

private static final int MAX_VERT_INCH
Maximum vertical margin, in inches.

MAX_HOR

public static final int MAX_HOR
Maximum horizontal margin (left+right) in twips.

MAX_VERT

public static final int MAX_VERT
Maximum vertical margin (top+bottom) in twips.

lblTitle

javax.swing.JLabel lblTitle

pnlInf

javax.swing.JPanel pnlInf

btnOK

javax.swing.JButton btnOK

btnCancel

javax.swing.JButton btnCancel

pnlCtrl

javax.swing.JPanel pnlCtrl

lblLeft

javax.swing.JLabel lblLeft

lblRight

javax.swing.JLabel lblRight

lblTop

javax.swing.JLabel lblTop

lblBottom

javax.swing.JLabel lblBottom

txtLeft

javax.swing.JTextField txtLeft

txtRight

javax.swing.JTextField txtRight

txtTop

javax.swing.JTextField txtTop

txtBottom

javax.swing.JTextField txtBottom

answer

private int[] answer
Place holder for values sent to the client. Must be provided by the client.

left

private int left
Left margin value (in twips)

right

private int right
Right margin value (in twips)

top

private int top
Top margin value (in twips)

bottom

private int bottom
Bottom margin value (in twips)

df

private java.text.DecimalFormat df
Formatter for margin values.
Constructor Detail

TemplateEditor.MarginDialog

public TemplateEditor.MarginDialog(int[] answer,
                                   int left,
                                   int right,
                                   int top,
                                   int bottom)
MarginDialog constructor.
Parameters:
answer - Array where values captured by this dialog are stored. Must be provided by the client.
left - Left margin value (in twips)
right - Right margin value (in twips)
top - Top margin value (in twips)
bottom - margin value (in twips)
Method Detail

guiInit

private void guiInit()
User controls initialization

checkDouble

private int checkDouble(java.lang.String msg,
                        javax.swing.JTextField txt,
                        int max)
                 throws java.lang.NumberFormatException,
                        java.lang.Exception
Checks if the value typed in a text box does not exceed a margin limit.
Parameters:
txt - The text box where the value is typed.
max - The limit not to be exceeded.
msg - A short message identifying the type of margin.
Returns:
The accepted value converted to twips.
Throws:
java.lang.NumberFormatException - if the value is not numeric.
java.lang.Exception - If the limit is exceeded.

checkAdd

private void checkAdd(int first,
                      int snd,
                      int maxadd,
                      javax.swing.JTextField sndTxt)
               throws java.lang.Exception
Checks if the sum of two opposed margins does not exceed a limit.
Parameters:
first - First margin (in twips)
snd - Second margin (in twips)
sndTxt - Text box that is zeroed if limit is exceeded.
maxadd - Description of the Parameter
Throws:
java.lang.Exception - If the limit is exceeded.

setMargin

public void setMargin(int twips,
                      javax.swing.JTextField txt)
Displays a value (converted to inches) in a text field.
Parameters:
twips - Value to be displayed (in twips)
txt - Field where the value is displayed.

setTitle

public void setTitle(java.lang.String s)
Setter for the title attribute.
Overrides:
setTitle in class java.awt.Dialog
Parameters:
s - The new title value