Subversion Repository Public Repository

litesoft

Diff Revisions 536 vs 537 for /trunk/GWT_Sandbox/Upload/src/org/litesoft/sandbox/csapp/client/widgets/CertUploadWidget.java

Diff revisions: vs.
  @@ -1,5 +1,6 @@
1 1 package org.litesoft.sandbox.csapp.client.widgets;
2 2
3 + import com.google.gwt.event.dom.client.*;
3 4 import com.google.gwt.safehtml.shared.*;
4 5 import com.google.gwt.user.client.*;
5 6 import com.google.gwt.user.client.ui.*;
  @@ -9,26 +10,50 @@
9 10 {
10 11 private static final String UP_IMAGE_URL = "common/uploadCert.png";
11 12 private static final String UP_DISABLED_IMAGE_URL = "common/uploadCertDisabled.png";
13 +
14 + private static final String REMOVE_REGULAR_IMAGE_URL = "common/Remove.gif";
15 + private static final String REMOVE_DISABLED_IMAGE_URL = "common/RemoveDisabled.gif";
16 + private static final String REMOVE_HOVER_IMAGE_URL = "common/RemoveHover.gif";
17 + private static final String REMOVE_PRESSED_IMAGE_URL = "common/RemovePressed.gif";
18 +
12 19 private static final String BUSY_IMAGE_URL = "common/BigBusy.gif";
13 20
14 21 private static final int SECONDS_TO_WAIT = 30;
15 22
16 23 private static final String WAIT_MESSAGE = "Checking Certificate Validity,\nthis can take a while...\n${seconds}\nseconds until timeout.";
17 24
18 - private UploadWidget uploader;
19 - private HTML resultsDisplay = new HTML( " " );
20 - private ScrollPanel resultsContainer = new ScrollPanel();
25 + private final UploadWidget uploader;
26 + private final HTML resultsDisplay = new HTML( " " );
27 + private final ScrollPanel resultsContainer = new ScrollPanel();
21 28
22 29 public CertUploadWidget()
23 30 {
24 - PushButton button = new PushButton( new Image( UP_IMAGE_URL ) );
25 - button.getUpDisabledFace().setImage( new Image( UP_DISABLED_IMAGE_URL ) );
26 - uploader = new UploadWidget( button, SECONDS_TO_WAIT, this );
31 + PushButton illusionaryButton = new PushButton( new Image( UP_IMAGE_URL ) );
32 + illusionaryButton.getUpDisabledFace().setImage( new Image( UP_DISABLED_IMAGE_URL ) );
33 +
34 + PushButton removeButton = new PushButton( new Image( REMOVE_REGULAR_IMAGE_URL ) );
35 + removeButton.getUpDisabledFace().setImage( new Image( REMOVE_DISABLED_IMAGE_URL ) );
36 + removeButton.getUpHoveringFace().setImage( new Image( REMOVE_HOVER_IMAGE_URL ) );
37 + removeButton.getDownFace().setImage( new Image( REMOVE_PRESSED_IMAGE_URL ) );
38 + removeButton.getDownHoveringFace().setImage( new Image( REMOVE_PRESSED_IMAGE_URL ) );
39 + removeButton.addClickHandler( new ClickHandler()
40 + {
41 + @Override
42 + public void onClick( ClickEvent event )
43 + {
44 + resultsDisplay.setHTML( " " );
45 + // todo: Clear the actual Base64 file contents
46 + }
47 + } );
48 +
49 + uploader = new UploadWidget( illusionaryButton, removeButton, SECONDS_TO_WAIT, this );
27 50 resultsContainer.setWidget( resultsDisplay );
28 51 resultsContainer.addStyleName( "CertUploadResults" );
29 52 VerticalPanel panel = new VerticalPanel();
53 + panel.addStyleName( "CertUpload" );
30 54 panel.add( uploader );
31 - panel.add( resultsContainer );
55 + panel.add( createSpacer( "CertUploadResultsRemoveSpacer" ) );
56 + panel.add( createResultsRemoveWidget( resultsContainer , removeButton ) );
32 57 initWidget( panel );
33 58 }
34 59
  @@ -57,6 +82,23 @@
57 82 uploader.showBusy();
58 83 }
59 84
85 + private Widget createResultsRemoveWidget( ScrollPanel resultsContainer, ButtonBase removeButton )
86 + {
87 + HorizontalPanel panel = new HorizontalPanel();
88 + panel.addStyleName( "CertUploadResultsRemove" );
89 + panel.add( resultsContainer );
90 + panel.add( createSpacer( "CertUploadResultsRemoveSpacer" ) );
91 + panel.add( removeButton );
92 + return panel;
93 + }
94 +
95 + private Widget createSpacer( String className )
96 + {
97 + HTML div = new HTML( " " );
98 + div.addStyleName( className );
99 + return div;
100 + }
101 +
60 102 @Override
61 103 public Image createBusyImage()
62 104 {