Class CmsUploadButton
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.gwt.client.ui.input.upload.CmsUploadButton
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.shared.HasHandlers,com.google.gwt.user.client.EventListener,com.google.gwt.user.client.ui.HasHorizontalAlignment,com.google.gwt.user.client.ui.HasVisibility,com.google.gwt.user.client.ui.IsRenderable,com.google.gwt.user.client.ui.IsWidget,I_CmsUploadButton
public class CmsUploadButton
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.user.client.ui.HasHorizontalAlignment, I_CmsUploadButton
Provides a upload button.
- Since:
- 8.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceThe ui-binder interface.Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant, com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.google.gwt.user.client.ui.HTMLThe button face.protected CmsFlowPanelThe main panel.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIXFields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT -
Constructor Summary
ConstructorsConstructorDescriptionCmsUploadButton(I_CmsUploadButtonHandler buttonHandler) The default constructor. -
Method Summary
Modifier and TypeMethodDescriptionCreates and adds a file input.voidDisables the button and changes the button title attribute to the disabled reason.voidenable()Enables the button, switching the button title attribute from the disabled reason to the original title.static StringformatBytes(long filesize) Formats a given bytes value (file size).Gets the upload button handler instance for this button.protected StringgetFaceHtml(String text, String imageClass) Convenience method to assemble the HTML to use for a button face.com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstantThis is the alignment of the text in reference to the image, possible values are left or right.Returns the master image class.getSize()Returns the size.getText()Returns the text.getTitle()Returns the title.protected voidhandleMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event) Handles the mouse over event on the main panel.protected voidhandleMouseOver(com.google.gwt.event.dom.client.MouseOverEvent event) Handles the mouse over event on the main panel.booleanReturns if the upload button is enabled.booleanChecks if the button is constraint to a minimal width.voidreinitButton(I_CmsUploadButtonHandler buttonHandler) Reinitializes the button with a new button handler.voidsetButtonStyle(I_CmsButton.ButtonStyle style, I_CmsButton.ButtonColor color) Sets the button style.voidsetEnabled(boolean enabled, String disabledMessage) Enables / disables the button.voidsetHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align) This is the alignment of the text in reference to the image, possible values are left or right.voidsetImageClass(String imageClass) Sets the master image class.voidsetSize(I_CmsButton.Size size) Sets the size.voidSets the text.voidvoidSets the up face text and image.voidsetUseMinWidth(boolean useMinWidth) Tells the button to use a minimal width.voidMethods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetMethods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
Field Details
-
m_buttonFace
The button face. -
m_main
The main panel.
-
-
Constructor Details
-
CmsUploadButton
The default constructor.Creates a new upload button. This upload button opens a new OS file selector on click.
On change the button handler passed into the constructor is notified.
- Parameters:
buttonHandler- the buttonHandler
-
-
Method Details
-
formatBytes
Formats a given bytes value (file size).- Parameters:
filesize- the file size to format- Returns:
- the formated file size in KB
-
createFileInput
Creates and adds a file input.- Specified by:
createFileInputin interfaceI_CmsUploadButton- Returns:
- returns the previous file input widget
-
disable
Disables the button and changes the button title attribute to the disabled reason.- Parameters:
disabledReason- the disabled reason
-
enable
Enables the button, switching the button title attribute from the disabled reason to the original title. -
getButtonHandler
Gets the upload button handler instance for this button.- Specified by:
getButtonHandlerin interfaceI_CmsUploadButton- Returns:
- the upload button handler
-
getHorizontalAlignment
public com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()This is the alignment of the text in reference to the image, possible values are left or right.- Specified by:
getHorizontalAlignmentin interfacecom.google.gwt.user.client.ui.HasHorizontalAlignment- See Also:
-
getImageClass
Returns the master image class.- Returns:
- the master image class
-
getSize
Returns the size.- Returns:
- the size
-
getText
Returns the text.- Returns:
- the text
-
getTitle
Returns the title.- Overrides:
getTitlein classcom.google.gwt.user.client.ui.UIObject- Returns:
- the title
-
isEnabled
Returns if the upload button is enabled.- Returns:
trueif the upload button is enabled
-
isUseMinWidth
Checks if the button is constraint to a minimal width.- Returns:
trueif the button is constraint to a minimal width
-
reinitButton
Reinitializes the button with a new button handler.- Specified by:
reinitButtonin interfaceI_CmsUploadButton- Parameters:
buttonHandler- the button handler
-
setButtonStyle
Sets the button style.- Parameters:
style- the style to setcolor- the color to set
-
setEnabled
Description copied from interface:I_CmsUploadButtonEnables / disables the button.- Specified by:
setEnabledin interfaceI_CmsUploadButton- Parameters:
enabled- true if the button should be enableddisabledMessage- the message to display for disabled buttons
-
setHorizontalAlignment
public void setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant align) This is the alignment of the text in reference to the image, possible values are left or right.- Specified by:
setHorizontalAlignmentin interfacecom.google.gwt.user.client.ui.HasHorizontalAlignment- See Also:
-
setImageClass
Sets the master image class.- Parameters:
imageClass- the master image class to set
-
setSize
Sets the size.- Parameters:
size- the size to set
-
setText
Sets the text.- Parameters:
text- the text to set
-
setTitle
- Overrides:
setTitlein classcom.google.gwt.user.client.ui.UIObject- See Also:
-
setUpFace
Sets the up face text and image.- Parameters:
text- the up face text to set, set tonullto not show anyimageClass- the up face image class to use, set tonullto not show any
-
setUseMinWidth
Tells the button to use a minimal width.- Parameters:
useMinWidth-trueto use a minimal width
-
updateFileInput
-
getFaceHtml
Convenience method to assemble the HTML to use for a button face.- Parameters:
text- text the up face text to set, set tonullto not show anyimageClass- the up face image class to use, set tonullto not show any- Returns:
- the HTML
-
handleMouseOut
@UiHandler("m_main") protected void handleMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event) Handles the mouse over event on the main panel.- Parameters:
event- the event- See Also:
-
handleMouseOver
@UiHandler("m_main") protected void handleMouseOver(com.google.gwt.event.dom.client.MouseOverEvent event) Handles the mouse over event on the main panel.- Parameters:
event- the event- See Also:
-