|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.widgets.Widget org.eclipse.swt.widgets.Control org.eclipse.swt.widgets.Scrollable org.eclipse.swt.widgets.Composite org.eclipse.swt.widgets.Canvas org.eclipse.rwt.widgets.FileUpload
public class FileUpload
A button-like widget allowing to select a file from the client's file system and to upload this file to a given URL using HTTP POST.
Note that although this class is a subclass of Composite
,
it does not make sense to set a layout on it.
Constructor Summary | |
---|---|
FileUpload(Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
Method Summary | ||
---|---|---|
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener
interface. |
|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
|
|
getAdapter(java.lang.Class<T> adapter)
Implementation of the Adaptable interface. |
|
Control[] |
getChildren()
Returns a (possibly empty) array containing the receiver's children. |
|
java.lang.String |
getFileName()
Returns the selected file name, without the path. |
|
Image |
getImage()
Returns the receiver's image if it has one, or null if it does not. |
|
java.lang.String |
getText()
Returns the receiver's text, which will be an empty string if it has never been set. |
|
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection. |
|
void |
setImage(Image image)
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed. |
|
void |
setLayout(Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null. |
|
void |
setText(java.lang.String text)
Sets the receiver's text. |
|
void |
submit(java.lang.String url)
Starts to upload the selected file to the given URL using HTTP POST. |
Methods inherited from class org.eclipse.swt.widgets.Canvas |
---|
addPaintListener, removePaintListener |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, getBackgroundMode, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileUpload(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to construct
java.lang.IllegalArgumentException
- SWTException
- Method Detail |
---|
public void setText(java.lang.String text)
text
- the new text
java.lang.IllegalArgumentException
- SWTException
- public java.lang.String getText()
SWTException
- public void setImage(Image image)
null
indicating that no image should be displayed.
image
- the image to display on the receiver (may be null
)
java.lang.IllegalArgumentException
- SWTException
- public Image getImage()
SWTException
- public java.lang.String getFileName()
null
is returned.
SWTException
- public void submit(java.lang.String url)
Note: Calling this method while a file is still uploading might interrupt the ongoing upload. Due to restrictions of the client, there is no feedback for success or failure of the upload. This information can only be obtained from the server that accepts the upload.
url
- the URL to upload to, must not be null
java.lang.IllegalArgumentException
- SWTException
- public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected
is called when the selected file changes.
widgetDefaultSelected
is not called.
listener
- the listener which should be notified when the user changes the receiver's selection
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notified
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public Point computeSize(int wHint, int hHint, boolean changed)
Control
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT
is passed for the hint.
If the changed flag is true
, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false
, so layout
manager caches can be retained.
computeSize
in class Composite
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"public void setLayout(Layout layout)
Composite
setLayout
in class Composite
layout
- the receiver's new layout or nullpublic Control[] getChildren()
Composite
Note: This is not the actual structure used by the receiver to maintain its list of children, so modifying the array will not affect the receiver.
getChildren
in class Composite
Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.moveBelow(org.eclipse.swt.widgets.Control)
public <T> T getAdapter(java.lang.Class<T> adapter)
Canvas
Adaptable
interface.
IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
getAdapter
in interface Adaptable
getAdapter
in class Canvas
adapter
- the lookup class
null
if
there is no adapter associated with the given class.
|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.