Class FileMiniature
- All Implemented Interfaces:
BrowserEventHandler
,ErrorEventHandler
,Animatable<FileMiniature>
,CanDrop<FileMiniature>
,Clickable<FileMiniature>
,Draggable<FileMiniature>
,HandleHotKey<FileMiniature>
,HandleMouseEvents<FileMiniature>
,Touchable<FileMiniature>
File miniature component
The component draws an icon (and the filename) in a box, that is representative of the file's format. The user can then download the file either by clicking on it's name, or it's icon
Supported events:
AnimationStart
AnimationEnd
,
Click
,
DoubleClick
,
MouseDown
,
MouseDown
,
MouseLeave
,
MouseMove
,
MouseOver
,
MouseOut
,
MouseUp
,
Wheel
,
TouchCancel
,
TouchEnd
,
TouchMove
,
TouchStart
,
Drop
,
DragStart
,
DragEnd
HotKey
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
ConstructorDescriptionFileMiniature
(JBFile jbFile) Creates a file miniature component, based on the specified fileFileMiniature
(JBFile jbFile, String language) Creates a file miniature component, based on the specified fileFileMiniature
(String id, JBFile jbFile) Creates a file miniature component, based on the specified fileFileMiniature
(String id, JBFile jbFile, String language) Creates a file miniature component, based on the specified file -
Method Summary
Modifier and TypeMethodDescriptionaddClickHandler
(ClickEventHandler handler) Adds a single click event handler to the component.addComponent
(Component<?> component) Adds the specified component as a subcomponent, and redraws the component immediatelyfinal FileMiniature
addDownloadErrorHandler
(ErrorEventHandler handler) Adds a download event handler to the component.addHotKey
(int hotKey) Adds the specified hot key to the component.addHotKey
(int hotKey, HotKeyEventHandler handler) Adds the specified hot key to the component.Downloads the file to the client where the component is currently visible.Gets the extension of the file that is used in the componentGets the ID of the file that is used in the componentGets the name of the file that is used in this componentfinal String
Gets the name of the filestore, that is used to store the file that is used in this componentfinal Icon
getIcon()
Gets the Icon that corresponds to the file's extensionvoid
onError
(ErrorEvent event) Generic error event handlerremoveComponent
(Component component) Removes the specified subcomponent.boolean
writeHTML
(StringWriter writer) Creates the component's HTML equivalentMethods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, addComponent, addComponents, addDeniedRole, addHandler, addStyle, addStyleClass, addStyleClasses, afterDraw, clearfix, closeTag, combinateAccess, containsStyle, containsStyleClass, draw, drawSubComponents, error, flattendComponentTree, getAccess, getAccessMode, getAllowedRoles, getAttribute, getAttributes, getBackgroundColor, getBorderColor, getClient, getComponentById, getComponents, getComponents, getComponentsByClass, getData, getDeniedRoles, getHandlers, getId, getLanguageCode, getName, getParent, getParent, getRegisteredEvents, getStyle, getStyleClasses, getTextAlign, getTextColor, getToolTip, getToolTipPosition, getTypeName, getUI, init, insertComponentAfter, insertComponentBefore, isAccess, isDrawn, isEnabled, isEventBubbling, isVisible, onHide, onHotKeyEventHandler, onShow, openTag, redraw, removeAllComponents, removeAllowedRole, removeAllStyleClasses, removeAttribute, removeComponent, removeComponents, removeDeniedRole, removeHandler, removeStyle, removeStyle, removeStyleClass, removeStyleClasses, replaceComponent, replaceStyleClass, runAfterDraw, runJavaScript, runJavaScript, runJavaScript, runOnHide, runOnShow, say, setAttribute, setBackgroundColor, setBorder, setBorderColor, setData, setDisplayType, setEnabled, setEventBubbling, setFlex, setFloating, setHeight100, setHeight25, setHeight50, setHeight75, setHeightAuto, setLanguage, setMargin, setName, setOverflow, setPadding, setParent, setScrollable, setSelectionType, setShadow, setStyle, setTextAlign, setTextColor, setToolTip, setToolTipPosition, setVisible, setWidth100, setWidth25, setWidth50, setWidth75, setWidthAuto, showNotification, showNotification, showProcessIndicator, toggleStyleClass
Methods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimation
Methods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandler
Methods inherited from interface com.jbstrap.ui.Clickable
addDoubleClickHandler
Methods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.HandleHotKey
removeHotKey, removeHotKeys
Methods inherited from interface com.jbstrap.ui.HandleMouseEvents
addMouseDownHandler, addMouseEnterHandler, addMouseLeaveHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler
Methods inherited from interface com.jbstrap.ui.Touchable
addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler
-
Constructor Details
-
FileMiniature
Creates a file miniature component, based on the specified file- Parameters:
jbFile
- TheJBFile
file, that will be the basis for the component.- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.NullPointerException
- If the specified file isnull
-
FileMiniature
Creates a file miniature component, based on the specified file- Parameters:
id
- The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)jbFile
- TheJBFile
file, that will be the basis for the component.- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.NullPointerException
- If the specified file isnull
-
FileMiniature
Creates a file miniature component, based on the specified file- Parameters:
jbFile
- TheJBFile
file, that will be the basis for the component.language
- The code of the language, that will be used in the component- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.NullPointerException
- If the specified file isnull
-
FileMiniature
Creates a file miniature component, based on the specified file- Parameters:
id
- The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)jbFile
- TheJBFile
file, that will be the basis for the component.language
- The code of the language, that will be used in the component- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.NullPointerException
- If the specified file isnull
-
-
Method Details
-
getFileStoreName
Gets the name of the filestore, that is used to store the file that is used in this component- Returns:
- The name of the filestore, that is used to store the file or
null
, if the file in the component has no file store name.
-
getFilename
Gets the name of the file that is used in this component- Returns:
- The filename
-
getFileId
Gets the ID of the file that is used in the component- Returns:
- The file ID or
null
, if the file is yet to be saved to a filestore
-
getExtension
Gets the extension of the file that is used in the component- Returns:
- The file extension or
null
, if the file has no extension specified. The returned extension will be in all caps.
-
getIcon
Gets the Icon that corresponds to the file's extension- Returns:
- The Icon that corresponds to the file's extension
-
addComponent
Adds the specified component as a subcomponent, and redraws the component immediately- Overrides:
addComponent
in classComponent<FileMiniature>
- Parameters:
component
- The component to be added- Returns:
- The component
-
removeComponent
Removes the specified subcomponent.- Overrides:
removeComponent
in classComponent<FileMiniature>
- Parameters:
component
- The component instance- Returns:
- The component
-
addClickHandler
Adds a single click event handler to the component. This handler runs when the user clicks once on the component.- Specified by:
addClickHandler
in interfaceClickable<FileMiniature>
- Parameters:
handler
- TheClickEventHandler
implementation- Returns:
- The component
- See Also:
-
writeHTML
Description copied from class:Component
Creates the component's HTML equivalentThis method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (
StringWriter
class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return withfalse
. Otherwise, it must return withtrue
.- Specified by:
writeHTML
in classComponent<FileMiniature>
- Returns:
- If the componentwas drawn,
true
, otherwisefalse
-
downloadFile
Downloads the file to the client where the component is currently visible.- Returns:
- The file miniature component
- Throws:
IllegalStateException
- If the method is called when the component isn't displayed on any interfaces.
-
addDownloadErrorHandler
Adds a download event handler to the component. The specified event handler is called, when an error is encountered during the download process- Parameters:
handler
- TheErrorEventHandler
implementation- Returns:
- The file miniature component
- See Also:
-
onError
Description copied from interface:ErrorEventHandler
Generic error event handler
The event handler will be called, when an error is encountered in a process.
- Specified by:
onError
in interfaceErrorEventHandler
- Parameters:
event
- The event object- See Also:
-
addHotKey
Adds the specified hot key to the component. If the user presses the hot key, the component's Click event handler will be fired. If the hot key was assigned to an input field, the field will gain focus.- Specified by:
addHotKey
in interfaceHandleHotKey<FileMiniature>
- Parameters:
hotKey
- The button combination, that will be assigned to the component. This button combination can be specified, by using theKey
class' constants. If the hot key is a combination of two buttons, then the values must be added. For example, the CTRL+S combination is specified asKEY.CTRL + KEY.KEY_S
- Returns:
- The component
-
addHotKey
Adds the specified hot key to the component. If the user presses the hot key, the specified event handler will be fired- Specified by:
addHotKey
in interfaceHandleHotKey<FileMiniature>
- Parameters:
hotKey
- The button combination, that will be assigned to the component. This button combination can be specified, by using theKey
class' constants. If the hot key is a combination of two buttons, then the values must be added. For example, the CTRL+S combination is specified asKEY.CTRL + KEY.KEY_S
handler
- TheHotKeyEventHandler
implementation- Returns:
- The component
- See Also:
-