Produced by Araxis Merge on 4/18/2019 5:56:03 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink\VistaLink\src\main\java\gov\va\med\vistalink\security | DialogLogon.java | Wed Apr 3 02:27:40 2019 UTC |
2 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink\VistaLink\src\main\java\gov\va\med\vistalink\security | DialogLogon.java | Tue Apr 16 16:29:35 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1296 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | package go v.va.med.v istalink.s ecurity; | |
2 | ||
3 | import gov .va.med.vi stalink.se curity.m.S ecurityVOS etupAndInt roText; | |
4 | ||
5 | import jav a.awt.Comp onent; | |
6 | import jav a.awt.Cont ainer; | |
7 | import jav a.awt.Dime nsion; | |
8 | import jav a.awt.Flow Layout; | |
9 | import jav a.awt.Focu sTraversal Policy; | |
10 | import jav a.awt.Font ; | |
11 | import jav a.awt.Fram e; | |
12 | import jav a.awt.Grid BagConstra ints; | |
13 | import jav a.awt.Grid BagLayout; | |
14 | import jav a.awt.Inse ts; | |
15 | import jav a.awt.even t.ActionEv ent; | |
16 | import jav a.awt.even t.ActionLi stener; | |
17 | import jav a.awt.even t.FocusEve nt; | |
18 | import jav a.awt.even t.FocusLis tener; | |
19 | import jav a.awt.even t.KeyEvent ; | |
20 | ||
21 | import jav ax.swing.B orderFacto ry; | |
22 | import jav ax.swing.B oxLayout; | |
23 | import jav ax.swing.I mageIcon; | |
24 | import jav ax.swing.J Button; | |
25 | import jav ax.swing.J CheckBox; | |
26 | import jav ax.swing.J Component; | |
27 | import jav ax.swing.J Dialog; | |
28 | import jav ax.swing.J Label; | |
29 | import jav ax.swing.J Panel; | |
30 | import jav ax.swing.J PasswordFi eld; | |
31 | import jav ax.swing.J ScrollPane ; | |
32 | import jav ax.swing.J TextArea; | |
33 | import jav ax.swing.J TextField; | |
34 | import jav ax.swing.S wingConsta nts; | |
35 | import jav ax.swing.T imer; | |
36 | import jav ax.swing.U IManager; | |
37 | import jav ax.swing.b order.Bord er; | |
38 | ||
39 | /** | |
40 | * Swing D ialog to c ollect use r input fo r a "enter accessPas swordField and verif yPasswordF ield code" event | |
41 | * @see Vi staLoginMo dule | |
42 | * @see Ca llbackHand lerSwing | |
43 | */ | |
44 | final clas s DialogLo gon extend s JDialog { | |
45 | ||
46 | // used by o ther logon dialogs t oo | |
47 | st atic final String DE FAULT_TITL E = "Healt heVet-Vist A Sign-on" ; | |
48 | st atic final String SI GNON_STRIN G = "Sign- on"; | |
49 | ||
50 | pr ivate stat ic final S tring ACCE SS_LABEL = "Access C ode: "; | |
51 | pr ivate stat ic final c har ACCESS _MNEMONIC = KeyEvent .VK_A; | |
52 | pr ivate stat ic final S tring ACCE SS_TOOLTIP = "Enter your VistA access co de"; | |
53 | ||
54 | pr ivate stat ic final S tring VERI FY_LABEL = "Verify C ode: "; | |
55 | pr ivate stat ic final c har VERIFY _MNEMONIC = KeyEvent .VK_V; | |
56 | pr ivate stat ic final S tring VERI FY_TOOLTIP = "Enter your VistA Verify co de"; | |
57 | ||
58 | pr ivate stat ic final S tring OK_B UTTON_LABE L = "OK"; | |
59 | pr ivate stat ic final c har OK_BUT TON_MNEMON IC = KeyEv ent.VK_O; | |
60 | pr ivate stat ic final S tring OK_B UTTON_TOOL TIP = "Sub mits your login requ est to the server"; | |
61 | ||
62 | pr ivate stat ic final S tring CANC EL_BUTTON_ LABEL = "C ancel"; | |
63 | pr ivate stat ic final c har CANCEL _BUTTON_MN EMONIC = K eyEvent.VK _C; | |
64 | pr ivate stat ic final S tring CANC EL_BUTTON_ TOOLTIP = "Cancels y our login request"; | |
65 | ||
66 | pr ivate stat ic final S tring CVC_ CHECKBOX_L ABEL = "Ch ange Verif y Code"; | |
67 | pr ivate stat ic final c har CVC_CH ECKBOX_MNE MONIC = Ke yEvent.VK_ E; | |
68 | pr ivate stat ic final S tring CVC_ CHECKBOX_T OOLTIP = " Ask to cha nge your v erify code "; | |
69 | ||
70 | // private s tatic fina l String V A_LOGO = " images/VAl ogo.gif"; | |
71 | pr ivate stat ic final S tring VA_L OGO = "ima ges/Health eVetVistaS mallBlueSm .gif"; | |
72 | pr ivate stat ic final S tring VA_L OGO_TOOLTI P = "Healt heVet-Vist A logo"; | |
73 | ||
74 | pr ivate stat ic final S tring SERV ER_LABEL = "Server: "; | |
75 | pr ivate stat ic final S tring VOLU ME_LABEL = "Volume: "; | |
76 | pr ivate stat ic final S tring UCI_ LABEL = "U C I: "; | |
77 | pr ivate stat ic final S tring DEVI CE_LABEL = "Device: "; | |
78 | ||
79 | pr ivate stat ic final S tring SERV ER_INFO_LA BEL = "Ser ver Inform ation: "; | |
80 | pr ivate stat ic final S tring SERV ER_INFO_TO OLTIP = "I nformation about the M server in use for the curre nt connect ion"; | |
81 | pr ivate stat ic final c har SERVER _INFO_MNEM ONIC = Key Event.VK_S ; | |
82 | ||
83 | pr ivate stat ic final S tring BUTT ON_508_TEX T = "Secti on 508 Inf ormation"; | |
84 | pr ivate stat ic final S tring BUTT ON_508_TOO LTIP = "Di splay Sect ion 508 co mpliance i nformation for this applicatio n"; | |
85 | pr ivate stat ic final i nt BUTTON_ 508_MNEMON IC = KeyEv ent.VK_5; | |
86 | pr ivate stat ic final S tring[] TE XT_508_DIS CLAIMER = | |
87 | { | |
88 | "V A's Office of Informati on & Techn ology, Vet eran Healt h Informat ion Techno logy staff have made ", | |
89 | "every effort du ring the d esign, dev elopment a nd testing of this l ogin scree n to ensur e full", | |
90 | "acces sibility t o all user s in compl iance with Section 5 08 of the Rehabilita tion Act o f 1973, as ", | |
91 | "amend ed. Please send any comments, questions or concern s regardin g the acce ssibility of this", | |
92 | "login mod ule to Sec tion508 @ v a dot go v [ PII ]." }; | |
93 | ||
94 | pr ivate stat ic final S tring JTEX TAREA_TOOL TIP = "Sys tem Announ cements"; | |
95 | pr ivate stat ic final S tring JTEX TAREA_LABE L = "Syste m Announce ments:"; | |
96 | pr ivate stat ic final c har JTEXTA REA_MNEMON IC = KeyEv ent.VK_N; | |
97 | ||
98 | pr ivate stat ic final i nt CODE_FI ELD_COLUMN S = 13; | |
99 | ||
100 | pr ivate JScr ollPane in troScrollP ane; | |
101 | pr ivate JPas swordField accessPas swordField ; | |
102 | pr ivate JPas swordField verifyPas swordField ; | |
103 | pr ivate JLab el accessL abel; | |
104 | pr ivate JLab el verifyL abel; | |
105 | pr ivate JLab el introLa bel; | |
106 | pr ivate JChe ckBox cvcC heckBox; | |
107 | pr ivate JBut ton okButt on; | |
108 | pr ivate JBut ton cancel Button; | |
109 | pr ivate JBut ton sectio n508Button ; | |
110 | pr ivate JTex tArea intr oTextArea; | |
111 | pr ivate Bord er introFo cusBorder; | |
112 | pr ivate Bord er introNo FocusBorde r; | |
113 | pr ivate Bord er serverI nfoFocusBo rder; | |
114 | pr ivate Bord er serverI nfoNoFocus Border; | |
115 | pr ivate Fram e parentFr ame; | |
116 | pr ivate JLab el serverI nfoLabel; | |
117 | pr ivate JTex tField ser verInfoTex tField; | |
118 | ||
119 | pr ivate Call backLogon callbackAV ; | |
120 | ||
121 | /* * | |
122 | * Create a modal Swin g dialog t o get acce ssPassword Field and verifyPass wordField codes from the user | |
123 | * @param pa rent paren t frame | |
124 | * @param ca llbackAV c allback to retrieve informatio n from and place res ult in | |
125 | * / | |
126 | st atic void showVistaA VSwingGetA V(Frame pa rent, Call backLogon callbackAV ) { | |
127 | ||
128 | Dial ogLogon di alog = new DialogLog on(parent, callbackA V); | |
129 | if ( (parent != null) && (!"".equal s(parent.g etTitle()) )) { | |
130 | dialog .setTitle( parent.get Title() + ": " + DEF AULT_TITLE ); | |
131 | } el se { | |
132 | dialog .setTitle( DEFAULT_TI TLE); | |
133 | } | |
134 | Vist aLoginSwin gUtilities .goldenMea nCenterDia log(parent , dialog); | |
135 | dial og.setVisi ble(true); | |
136 | } | |
137 | ||
138 | pr ivate Dial ogLogon(Fr ame parent , Callback Logon call backAV) { | |
139 | supe r(parent, DEFAULT_TI TLE, true) ; | |
140 | this .callbackA V = callba ckAV; | |
141 | this .parentFra me = paren t; | |
142 | ||
143 | BoxL ayout main Layout = n ew BoxLayo ut(getCont entPane(), BoxLayout .Y_AXIS); | |
144 | getC ontentPane ().setLayo ut(mainLay out); | |
145 | ||
146 | crea teIntroPan e(); | |
147 | // c reate afte r infoPane since we' re doing s etLabelFor | |
148 | JPan el annLabe lPanel = c reateIntro LabelPane( ); | |
149 | JPan el content Pane = cre ateContent Pane(); | |
150 | ||
151 | getC ontentPane ().add(ann LabelPanel ); | |
152 | getC ontentPane ().add(int roScrollPa ne); | |
153 | getC ontentPane ().add(con tentPane); | |
154 | // g etContentP ane().add( serverInfo Panel); | |
155 | ||
156 | getC ontentPane ().setFocu sCycleRoot (true); | |
157 | getC ontentPane ().setFocu sTraversal Policy(new DialogLog onFocusTra versalPoli cy()); | |
158 | ||
159 | /* p ack auto-s ets frame size based on size o f componen ts contain ed */ | |
160 | pack (); | |
161 | // e nsure that the curre nt window size does not exceed the scree n size | |
162 | Dime nsion scre enSize = g etToolkit( ).getScree nSize(); | |
163 | if ( (this.getS ize().widt h > screen Size.width ) || (this .getSize() .height > screenSize .height)) { | |
164 | this.s etSize(scr eenSize); | |
165 | } | |
166 | ||
167 | Vist aLoginSwin gUtilities .goldenMea nCenterDia log(parent , this); | |
168 | ||
169 | getA ccessibleC ontext().s etAccessib leDescript ion( | |
170 | "This di alog asks you to ent er your ac cess and v erify code s to log i nto the co mputer sys tem."); | |
171 | ||
172 | // s et up even t for time out | |
173 | int timeout = 1000 * thi s.callback AV.getTime outInSecon ds(); | |
174 | Acti onListener taskPerfo rmer = new ActionLis tener() { | |
175 | public void acti onPerforme d(ActionEv ent evt) { | |
176 | doTimeou t(); | |
177 | } | |
178 | }; | |
179 | new Timer(time out, taskP erformer). start(); | |
180 | acce ssPassword Field.requ estFocusIn Window(); | |
181 | } | |
182 | ||
183 | pr ivate JPan el createI ntroLabelP ane() { | |
184 | ||
185 | intr oLabel = n ew JLabel( JTEXTAREA_ LABEL); | |
186 | intr oLabel.set DisplayedM nemonic(JT EXTAREA_MN EMONIC); | |
187 | intr oLabel.set ToolTipTex t(JTEXTARE A_TOOLTIP) ; | |
188 | intr oLabel.set LabelFor(i ntroTextAr ea); | |
189 | intr oLabel.set Focusable( true); | |
190 | intr oLabel.add FocusListe ner(new Fo cusListene r() { | |
191 | public void focu sGained(Fo cusEvent e ) { | |
192 | introTex tArea.requ estFocusIn Window(); | |
193 | } | |
194 | ||
195 | public void focu sLost(Focu sEvent e) { | |
196 | } | |
197 | }); | |
198 | ||
199 | JPan el annPane l = new JP anel(); | |
200 | Flow Layout myL ayout = ne w FlowLayo ut(); | |
201 | myLa yout.setAl ignment(Fl owLayout.L EFT); | |
202 | annP anel.setLa yout(myLay out); | |
203 | annP anel.add(i ntroLabel) ; | |
204 | retu rn annPane l; | |
205 | } | |
206 | ||
207 | pr ivate void createInt roPane() { | |
208 | ||
209 | // g et border from curre nt LaF | |
210 | Bord er default Border = U IManager.g etBorder(" TextField. border"); | |
211 | intr oFocusBord er = | |
212 | Border Factory.cr eateCompou ndBorder(U IManager.g etBorder(" List.focus CellHighli ghtBorder" ), default Border); | |
213 | intr oNoFocusBo rder = | |
214 | Border Factory.cr eateCompou ndBorder( | |
215 | BorderFa ctory.crea teLineBord er(UIManag er.getColo r("control "), 1), | |
216 | defaultB order); | |
217 | ||
218 | intr oTextArea = new JTex tArea(call backAV.get SetupAndIn troTextInf o().getInt roductoryT ext()); | |
219 | intr oTextArea. setCaretPo sition(0); | |
220 | intr oTextArea. setToolTip Text(JTEXT AREA_TOOLT IP); | |
221 | intr oTextArea. setEditabl e(false); | |
222 | intr oTextArea. setMargin( new Insets (3, 3, 3, 3)); | |
223 | intr oTextArea. setColumns (80); | |
224 | if ( introTextA rea.getLin eCount() > 20) { | |
225 | introT extArea.se tRows(20); | |
226 | } | |
227 | intr oTextArea. setFocusab le(true); | |
228 | intr oTextArea. getAccessi bleContext ().setAcce ssibleName (JTEXTAREA _LABEL + c allbackAV. getSetupAn dIntroText Info().get Introducto ryText()); | |
229 | intr oTextArea. addFocusLi stener(new FocusList ener() { | |
230 | public void focu sGained(Fo cusEvent e ) { | |
231 | introScr ollPane.se tBorder(in troFocusBo rder); | |
232 | } | |
233 | ||
234 | public void focu sLost(Focu sEvent e) { | |
235 | introScr ollPane.se tBorder(in troNoFocus Border); | |
236 | } | |
237 | }); | |
238 | ||
239 | Font currentFo nt = intro TextArea.g etFont(); | |
240 | intr oTextArea. setFont(ne w Font("mo nospaced", currentFo nt.getStyl e(), curre ntFont.get Size())); | |
241 | intr oScrollPan e = new JS crollPane( introTextA rea); | |
242 | intr oScrollPan e.setBorde r(introNoF ocusBorder ); | |
243 | ||
244 | } | |
245 | ||
246 | pr ivate JPan el createC ontentPane () { | |
247 | Grid BagLayout gridbag = new GridBa gLayout(); | |
248 | ||
249 | // a ccessPassw ordField p assword fi eld | |
250 | this .accessPas swordField = new JPa sswordFiel d("", CODE _FIELD_COL UMNS); | |
251 | this .accessPas swordField .setToolTi pText(ACCE SS_TOOLTIP ); | |
252 | ||
253 | // a ccessPassw ordField l abel | |
254 | acce ssLabel = new JLabel (ACCESS_LA BEL); | |
255 | acce ssLabel.se tHorizonta lAlignment (SwingCons tants.RIGH T); | |
256 | acce ssLabel.se tFont(acce ssLabel.ge tFont().de riveFont(F ont.BOLD)) ; | |
257 | // n eed to lea ve focus e nabled for mnemonic to work; a ppears to waste an e xtra tab i n the trav ersal cycl e though | |
258 | acce ssLabel.se tToolTipTe xt(ACCESS_ TOOLTIP); | |
259 | acce ssLabel.se tDisplayed Mnemonic(A CCESS_MNEM ONIC); | |
260 | acce ssLabel.se tLabelFor( this.acces sPasswordF ield); | |
261 | acce ssLabel.ad dFocusList ener(new F ocusListen er() { | |
262 | public void focu sLost(Focu sEvent e) { | |
263 | } | |
264 | ||
265 | public void focu sGained(Fo cusEvent e ) { | |
266 | accessPa sswordFiel d.requestF ocusInWind ow(); | |
267 | } | |
268 | }); | |
269 | ||
270 | // v erifyPassw ordField p assword fi eld | |
271 | veri fyPassword Field = ne w JPasswor dField("", CODE_FIEL D_COLUMNS) ; | |
272 | veri fyPassword Field.setT oolTipText (VERIFY_TO OLTIP); | |
273 | ||
274 | // v erifyPassw ordField l abel | |
275 | veri fyLabel = new JLabel (VERIFY_LA BEL); | |
276 | veri fyLabel.se tHorizonta lAlignment (SwingCons tants.RIGH T); | |
277 | veri fyLabel.se tFont(veri fyLabel.ge tFont().de riveFont(F ont.BOLD)) ; | |
278 | veri fyLabel.se tToolTipTe xt(VERIFY_ TOOLTIP); | |
279 | veri fyLabel.se tDisplayed Mnemonic(V ERIFY_MNEM ONIC); | |
280 | veri fyLabel.se tLabelFor( this.verif yPasswordF ield); | |
281 | veri fyLabel.ad dFocusList ener(new F ocusListen er() { | |
282 | public void focu sLost(Focu sEvent e) { | |
283 | } | |
284 | ||
285 | public void focu sGained(Fo cusEvent e ) { | |
286 | verifyPa sswordFiel d.requestF ocusInWind ow(); | |
287 | } | |
288 | }); | |
289 | ||
290 | // S et a minim um width f or the acc ess/verify code pass word field s based on font widt h | |
291 | Dime nsion mini mumDimensi on = | |
292 | new Di mension( | |
293 | (accessP asswordFie ld.getFont Metrics(ac cessPasswo rdField.ge tFont()).c harWidth(' a') * 8), | |
294 | accessPa sswordFiel d.getFontM etrics(acc essPasswor dField.get Font()).ge tHeight()) ; | |
295 | acce ssPassword Field.setM inimumSize (minimumDi mension); | |
296 | veri fyPassword Field.setM inimumSize (minimumDi mension); | |
297 | ||
298 | // p anel | |
299 | JPan el p = new JPanel(); | |
300 | p.se tLayout(gr idbag); | |
301 | ||
302 | Grid BagConstra ints c = n ew GridBag Constraint s(); | |
303 | c.fi ll = GridB agConstrai nts.NONE; | |
304 | c.in sets = new Insets(5, 5, 5, 5); | |
305 | c.ip adx = c.ip ady = 0; | |
306 | c.we ightx = 0; | |
307 | ||
308 | c.gr idx = c.gr idy = 0; | |
309 | c.gr idheight = 3; | |
310 | c.we ightx = 10 ; | |
311 | p.ad d(createLo goLabel(), c); | |
312 | ||
313 | c.gr idy = 3; | |
314 | c.gr idheight = 1; | |
315 | c.gr idwidth = 1; | |
316 | c.we ightx = 2; | |
317 | p.ad d(create50 8Button(), c); | |
318 | ||
319 | c.gr idheight = 1; | |
320 | c.gr idwidth = 1; | |
321 | c.gr idx = 1; | |
322 | c.gr idy = 0; | |
323 | c.we ightx = 4; | |
324 | p.ad d(accessLa bel, c); | |
325 | ||
326 | c.we ightx = 4; | |
327 | c.gr idy = 1; | |
328 | p.ad d(verifyLa bel, c); | |
329 | ||
330 | c.gr idx = 2; | |
331 | c.gr idy = 0; | |
332 | c.we ightx = 4; | |
333 | c.ip adx = c.ip ady = 3; | |
334 | p.ad d(accessPa sswordFiel d, c); | |
335 | ||
336 | c.gr idy = 1; | |
337 | c.we ightx = 4; | |
338 | c.ip adx = c.ip ady = 3; | |
339 | p.ad d(verifyPa sswordFiel d, c); | |
340 | ||
341 | crea teOKButton (); | |
342 | c.gr idx = 3; | |
343 | c.gr idy = 0; | |
344 | c.fi ll = GridB agConstrai nts.HORIZO NTAL; | |
345 | c.ip adx = c.ip ady = 3; | |
346 | c.we ightx = 2; | |
347 | p.ad d(okButton , c); | |
348 | ||
349 | crea teCancelBu tton(); | |
350 | c.gr idy = 1; | |
351 | c.fi ll = GridB agConstrai nts.HORIZO NTAL; | |
352 | c.ip adx = c.ip ady = 3; | |
353 | c.we ightx = 2; | |
354 | p.ad d(cancelBu tton, c); | |
355 | ||
356 | c.gr idx = 2; | |
357 | c.gr idy = 2; | |
358 | c.ip adx = c.ip ady = 0; | |
359 | c.gr idheight = 1; | |
360 | c.gr idwidth = 2; | |
361 | c.we ightx = 2; | |
362 | c.fi ll = GridB agConstrai nts.NONE; | |
363 | c.an chor = Gri dBagConstr aints.NORT HWEST; | |
364 | p.ad d(createCv cPanel(), c); | |
365 | ||
366 | c.gr idx = 0; | |
367 | c.gr idy = 4; | |
368 | c.gr idwidth = 4; | |
369 | c.we ightx = 2; | |
370 | c.an chor = Gri dBagConstr aints.CENT ER; | |
371 | JPan el serverI nfoPanel = createSer verInfoPan el(this.ca llbackAV.g etSetupAnd IntroTextI nfo()); | |
372 | p.ad d(serverIn foPanel, c ); | |
373 | ||
374 | retu rn p; | |
375 | } | |
376 | ||
377 | pr ivate JCom ponent cre ateCvcPane l() { | |
378 | JPan el myPanel = new JPa nel(); | |
379 | Flow Layout myL ayout = ne w FlowLayo ut(); | |
380 | myLa yout.setAl ignment(Fl owLayout.L EFT); | |
381 | myPa nel.setLay out(myLayo ut); | |
382 | ||
383 | this .cvcCheckB ox = new J CheckBox(C VC_CHECKBO X_LABEL, f alse); | |
384 | this .cvcCheckB ox.setMnem onic(CVC_C HECKBOX_MN EMONIC); | |
385 | this .cvcCheckB ox.setTool TipText(CV C_CHECKBOX _TOOLTIP); | |
386 | this .cvcCheckB ox.setBord er(BorderF actory.cre ateEmptyBo rder()); | |
387 | this .cvcCheckB ox.setOpaq ue(false); | |
388 | myPa nel.add(th is.cvcChec kBox); | |
389 | ||
390 | retu rn myPanel ; | |
391 | } | |
392 | ||
393 | pr ivate void createCan celButton( ) { | |
394 | canc elButton = new JButt on(CANCEL_ BUTTON_LAB EL); | |
395 | canc elButton.s etMnemonic (CANCEL_BU TTON_MNEMO NIC); | |
396 | canc elButton.s etToolTipT ext(CANCEL _BUTTON_TO OLTIP); | |
397 | canc elButton.s etFont(can celButton. getFont(). deriveFont (Font.BOLD )); | |
398 | canc elButton.a ddActionLi stener(new ActionLis tener() { | |
399 | public void acti onPerforme d(ActionEv ent e) { | |
400 | cancelAc tionPerfor med(); | |
401 | } | |
402 | }); | |
403 | } | |
404 | ||
405 | pr ivate void createOKB utton() { | |
406 | okBu tton = new JButton(O K_BUTTON_L ABEL); | |
407 | okBu tton.setMn emonic(OK_ BUTTON_MNE MONIC); | |
408 | okBu tton.setTo olTipText( OK_BUTTON_ TOOLTIP); | |
409 | okBu tton.setFo nt(okButto n.getFont( ).deriveFo nt(Font.BO LD)); | |
410 | this .getRootPa ne().setDe faultButto n(okButton ); | |
411 | ||
412 | // h andle even ts for but ton presse s | |
413 | okBu tton.addAc tionListen er(new Act ionListene r() { | |
414 | public void acti onPerforme d(ActionEv ent e) { | |
415 | okAction Performed( ); | |
416 | } | |
417 | }); | |
418 | } | |
419 | ||
420 | pr ivate JPan el createS erverInfoP anel(Secur ityVOSetup AndIntroTe xt setupIn fo) { | |
421 | ||
422 | // t ext | |
423 | Stri ngBuffer s b = new St ringBuffer (" "); | |
424 | sb.a ppend(SERV ER_LABEL); | |
425 | sb.a ppend(setu pInfo.getS erverName( )); | |
426 | sb.a ppend("; " ); | |
427 | sb.a ppend(VOLU ME_LABEL); | |
428 | sb.a ppend(setu pInfo.getV olume()); | |
429 | sb.a ppend("; " ); | |
430 | sb.a ppend(UCI_ LABEL); | |
431 | sb.a ppend(setu pInfo.getU ci()); | |
432 | sb.a ppend("; " ); | |
433 | sb.a ppend(DEVI CE_LABEL); | |
434 | sb.a ppend(setu pInfo.getD evice()); | |
435 | ||
436 | // g et border from curre nt LaF | |
437 | Bord er default Border = U IManager.g etBorder(" TextField. border"); | |
438 | serv erInfoFocu sBorder = | |
439 | Border Factory.cr eateCompou ndBorder(U IManager.g etBorder(" List.focus CellHighli ghtBorder" ), default Border); | |
440 | serv erInfoNoFo cusBorder = | |
441 | Border Factory.cr eateCompou ndBorder( | |
442 | BorderFa ctory.crea teLineBord er(UIManag er.getColo r("control "), 1), | |
443 | defaultB order); | |
444 | ||
445 | serv erInfoText Field = ne w JTextFie ld(sb.toSt ring()); | |
446 | serv erInfoText Field.setT oolTipText (SERVER_IN FO_TOOLTIP ); | |
447 | serv erInfoText Field.setE ditable(fa lse); | |
448 | serv erInfoText Field.setF ocusable(t rue); | |
449 | serv erInfoText Field.setM argin(new Insets(1, 4, 1, 4)); | |
450 | // e nsure a mi nimum widt h for this field. | |
451 | Dime nsion mini mumDimensi on = | |
452 | new Di mension( | |
453 | (serverI nfoTextFie ld.getFont Metrics(se rverInfoTe xtField.ge tFont()).c harWidth(' a') * sb.l ength()), | |
454 | serverIn foTextFiel d.getFontM etrics(ser verInfoTex tField.get Font()).ge tHeight() + 4); | |
455 | serv erInfoText Field.setM inimumSize (minimumDi mension); | |
456 | ||
457 | serv erInfoText Field.getA ccessibleC ontext().s etAccessib leName(SER VER_INFO_L ABEL + sb. toString() ); | |
458 | serv erInfoText Field.setB order(serv erInfoNoFo cusBorder) ; | |
459 | serv erInfoText Field.addF ocusListen er(new Foc usListener () { | |
460 | public void focu sGained(Fo cusEvent e ) { | |
461 | serverIn foTextFiel d.setBorde r(serverIn foFocusBor der); | |
462 | } | |
463 | ||
464 | public void focu sLost(Focu sEvent e) { | |
465 | serverIn foTextFiel d.setBorde r(serverIn foNoFocusB order); | |
466 | } | |
467 | }); | |
468 | ||
469 | serv erInfoLabe l = new JL abel(SERVE R_INFO_LAB EL); | |
470 | serv erInfoLabe l.setToolT ipText(SER VER_INFO_T OOLTIP); | |
471 | serv erInfoLabe l.setFocus able(true) ; | |
472 | serv erInfoLabe l.setDispl ayedMnemon ic(SERVER_ INFO_MNEMO NIC); | |
473 | serv erInfoLabe l.setLabel For(server InfoTextFi eld); | |
474 | ||
475 | JPan el p = new JPanel(); | |
476 | BoxL ayout myBo xLayout = new BoxLay out(p, Box Layout.X_A XIS); | |
477 | // F lowLayout myFlowLayo ut = new F lowLayout( ); | |
478 | // m yFlowLayou t.setAlign ment(FlowL ayout.LEFT ); | |
479 | // p .setLayout (myFlowLay out); | |
480 | p.se tLayout(my BoxLayout) ; | |
481 | p.ad d(serverIn foLabel); | |
482 | p.ad d(serverIn foTextFiel d); | |
483 | retu rn p; | |
484 | } | |
485 | ||
486 | pr ivate JLab el createL ogoLabel() { | |
487 | Imag eIcon vaIc on = new I mageIcon(g etClass(). getResourc e(VA_LOGO) ); | |
488 | vaIc on.setDesc ription(VA _LOGO_TOOL TIP); | |
489 | vaIc on.getAcce ssibleCont ext().setA ccessibleN ame("VA Lo go"); | |
490 | vaIc on.getAcce ssibleCont ext().setA ccessibleD escription ("VA Logo" ); | |
491 | JLab el l = new JLabel(va Icon); | |
492 | l.se tFocusable (false); | |
493 | l.se tToolTipTe xt(VA_LOGO _TOOLTIP); | |
494 | retu rn l; | |
495 | } | |
496 | ||
497 | pr ivate JBut ton create 508Button( ) { | |
498 | sect ion508Butt on = new J Button(BUT TON_508_TE XT); | |
499 | sect ion508Butt on.setTool TipText(BU TTON_508_T OOLTIP); | |
500 | sect ion508Butt on.setMnem onic(BUTTO N_508_MNEM ONIC); | |
501 | // h andle even ts for but ton presse s | |
502 | sect ion508Butt on.addActi onListener (new Actio nListener( ) { | |
503 | public void acti onPerforme d(ActionEv ent e) { | |
504 | StringBu ffer sb = new String Buffer(); | |
505 | for (int i = 0; i < TEXT_508 _DISCLAIME R.length; i++) { | |
506 | sb.append( TEXT_508_D ISCLAIMER[ i]); | |
507 | sb.append( '\n'); | |
508 | } | |
509 | int retu rnVal = Di alogConfir m.showDial ogConfirm( parentFram e, sb.toSt ring(), SI GNON_STRIN G + " " + BUTTON_508 _TEXT, Dia logConfirm .MODE_INFO RMATION_ME SSAGE, cal lbackAV.ge tTimeoutIn Seconds()) ; | |
510 | if (retu rnVal == D ialogConfi rm.TIMEOUT _OPTION) { | |
511 | doTimeout( ); | |
512 | } | |
513 | } | |
514 | }); | |
515 | retu rn section 508Button; | |
516 | } | |
517 | ||
518 | pr ivate void okActionP erformed() { | |
519 | this .callbackA V.setAcces sCode(this .accessPas swordField .getPasswo rd()); | |
520 | this .callbackA V.setVerif yCode(this .verifyPas swordField .getPasswo rd()); | |
521 | this .callbackA V.setReque stCvc(this .cvcCheckB ox.isSelec ted()); | |
522 | this .callbackA V.setSelec tedOption( CallbackLo gon.KEYPRE SS_OK); | |
523 | this .setVisibl e(false); | |
524 | this .dispose() ; | |
525 | } | |
526 | ||
527 | pr ivate void cancelAct ionPerform ed() { | |
528 | this .callbackA V.setAcces sCode(null ); | |
529 | this .callbackA V.setVerif yCode(null ); | |
530 | this .callbackA V.setSelec tedOption( CallbackLo gon.KEYPRE SS_CANCEL) ; | |
531 | this .setVisibl e(false); | |
532 | this .dispose() ; | |
533 | } | |
534 | ||
535 | pr ivate void doTimeout () { | |
536 | this .callbackA V.setAcces sCode(null ); | |
537 | this .callbackA V.setVerif yCode(null ); | |
538 | this .callbackA V.setSelec tedOption( CallbackLo gon.KEYPRE SS_TIMEOUT ); | |
539 | this .setVisibl e(false); | |
540 | this .dispose() ; | |
541 | } | |
542 | ||
543 | /* * | |
544 | * Provides a focus tr aversal po licy for t his dialog | |
545 | * / | |
546 | cl ass Dialog LogonFocus TraversalP olicy exte nds FocusT raversalPo licy { | |
547 | ||
548 | /** | |
549 | * g et the nex t componen t in the f ocus trave rsal | |
550 | * @ param focu sCycleRoot the root of the foc us cycle | |
551 | * @ param aCom ponent cur rently foc used compo nent | |
552 | * @ return ret urns the n ext compon ent in the (forward) cycle | |
553 | */ | |
554 | publ ic Compone nt getComp onentAfter (Container focusCycl eRoot, Com ponent aCo mponent) { | |
555 | ||
556 | if (aC omponent.e quals(acce ssPassword Field)) { | |
557 | return v erifyPassw ordField; | |
558 | } else if (aComp onent.equa ls(verifyP asswordFie ld)) { | |
559 | return o kButton; | |
560 | } else if (aComp onent.equa ls(okButto n)) { | |
561 | return c ancelButto n; | |
562 | } else if (aComp onent.equa ls(cancelB utton)) { | |
563 | return c vcCheckBox ; | |
564 | } else if (aComp onent.equa ls(cvcChec kBox)) { | |
565 | return s ection508B utton; | |
566 | } else if (aComp onent.equa ls(section 508Button) ) { | |
567 | return s erverInfoT extField; | |
568 | } else if (aComp onent.equa ls(serverI nfoTextFie ld)) { | |
569 | return i ntroTextAr ea; | |
570 | } else if (aComp onent.equa ls(introTe xtArea)) { | |
571 | return a ccessPassw ordField; | |
572 | ||
573 | /* now f or compone nts outsid e the norm al focus c ycle */ | |
574 | ||
575 | } else if (aComp onent.equa ls(accessL abel)) { | |
576 | return a ccessPassw ordField; | |
577 | } else if (aComp onent.equa ls(verifyL abel)) { | |
578 | return v erifyPassw ordField; | |
579 | } else if (aComp onent.equa ls(introLa bel)) { | |
580 | return i ntroTextAr ea; | |
581 | } | |
582 | return accessPas swordField ; | |
583 | } | |
584 | ||
585 | /** | |
586 | * g et the pre vious (rev erse direc tion) comp onent in t he focus t raversal c ycle | |
587 | * @ param focu sCycleRoot the root of the foc us cycle | |
588 | * @ param aCom ponent cur rently foc used compo nent | |
589 | * @ return ret urns the n ext compon ent in the (reverse) cycle | |
590 | */ | |
591 | publ ic Compone nt getComp onentBefor e(Containe r focusCyc leRoot, Co mponent aC omponent) { | |
592 | ||
593 | if (aC omponent.e quals(intr oTextArea) ) { | |
594 | return s erverInfoT extField; | |
595 | } else if (aComp onent.equa ls(serverI nfoTextFie ld)) { | |
596 | return s ection508B utton; | |
597 | } else if (aComp onent.equa ls(section 508Button) ) { | |
598 | return c vcCheckBox ; | |
599 | } else if (aComp onent.equa ls(cvcChec kBox)) { | |
600 | return c ancelButto n; | |
601 | } else if (aComp onent.equa ls(cancelB utton)) { | |
602 | return o kButton; | |
603 | } else if (aComp onent.equa ls(okButto n)) { | |
604 | return v erifyPassw ordField; | |
605 | } else if (aComp onent.equa ls(verifyP asswordFie ld)) { | |
606 | return a ccessPassw ordField; | |
607 | } else if (aComp onent.equa ls(accessP asswordFie ld)) { | |
608 | return i ntroTextAr ea; | |
609 | ||
610 | /* now f or compone nts outsid e the norm al focus c ycle */ | |
611 | ||
612 | } else if (aComp onent.equa ls(accessL abel)) { | |
613 | return c vcCheckBox ; | |
614 | } else if (aComp onent.equa ls(verifyL abel)) { | |
615 | return a ccessPassw ordField; | |
616 | } else if (aComp onent.equa ls(introLa bel)) { | |
617 | return s erverInfoT extField; | |
618 | } | |
619 | return accessPas swordField ; | |
620 | } | |
621 | ||
622 | /** | |
623 | * g ets the de fault comp onent to f ocus on | |
624 | * @ param focu sCycleRoot the root of the foc us cycle | |
625 | * @ return the default c omponent i n the focu s cycle | |
626 | */ | |
627 | publ ic Compone nt getDefa ultCompone nt(Contain er focusCy cleRoot) { | |
628 | return accessPas swordField ; | |
629 | } | |
630 | ||
631 | /** | |
632 | * g ets the la st compone nt in the focus cycl e | |
633 | * @ param focu sCycleRoot the root of the foc us cycle | |
634 | * @ return the last comp onent in t he focus c ycle | |
635 | */ | |
636 | publ ic Compone nt getLast Component( Container focusCycle Root) { | |
637 | return introText Area; | |
638 | } | |
639 | ||
640 | /** | |
641 | * g ets the fi rst compon ent in the focus cyc le | |
642 | * @ param focu sCycleRoot the root of the foc us cycle | |
643 | * @ return the first com ponent in the focus cycle | |
644 | */ | |
645 | publ ic Compone nt getFirs tComponent (Container focusCycl eRoot) { | |
646 | return accessPas swordField ; | |
647 | } | |
648 | } | |
649 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.