Subversion Repository Public Repository

litesoft

Diff Revisions 520 vs 521 for /trunk/GWT_Sandbox/Upload/src/org/litesoft/sandbox/csapp/client/widgets/UploadWidget.java

Diff revisions: vs.
  @@ -1,7 +1,6 @@
1 1 package org.litesoft.sandbox.csapp.client.widgets;
2 2
3 3 import com.google.gwt.dom.client.*;
4 - import com.google.gwt.event.dom.client.*;
5 4 import com.google.gwt.user.client.*;
6 5 import com.google.gwt.user.client.ui.*;
7 6
  @@ -12,30 +11,22 @@
12 11 private FileUpload upload = new FileUpload();
13 12 private String servletPath;
14 13 private Timer timer;
15 - private String nameID = "UploadWidget" + instance++;
16 14
17 15 public UploadWidget()
18 16 {
19 17 initWidget( new FormPanel() );
20 18
21 - upload.setName( nameID );
22 - upload.getElement().setAttribute( "ID", nameID );
19 + upload.setName( "UploadWidget" + instance++ );
20 + upload.getElement().setAttribute( "size", "1" );
21 + upload.setSize( "400px", "400px" );
22 + upload.getElement().getStyle().setFontSize( 200, Style.Unit.PX );
23 + upload.getElement().getStyle().setOpacity( 0 );
24 + upload.getElement().getStyle().setCursor( Style.Cursor.POINTER );
23 25
24 26 FormPanel form = getFormPanel();
25 27 FlowPanel flowPanel = new FlowPanel();
26 28 flowPanel.add( upload );
27 - flowPanel.add( new Button( "Pick", new ClickHandler()
28 - {
29 - @Override
30 - public void onClick( ClickEvent event )
31 - {
32 - String error = clickElementByID( nameID );
33 - if ( error != null )
34 - {
35 - Window.alert( error );
36 - }
37 - }
38 - } ) );
29 + flowPanel.add( new Button( "Pick" ) );
39 30 form.setWidget( flowPanel );
40 31
41 32 // Because we're going to add a FileUpload widget, we'll need to set the
  @@ -62,14 +53,6 @@
62 53 servletPath = noEmpty( url );
63 54 }
64 55
65 - public void setSize( String width )
66 - {
67 - if ( null != (width = noEmpty( width )) )
68 - {
69 - upload.getElement().setAttribute( "size", width );
70 - }
71 - }
72 -
73 56 @Override
74 57 protected void onAttach()
75 58 {