|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.AbstractLayout
com.vaadin.ui.CssLayout
org.vostok.vaadin.addon.button.spin.SpinButton
public class SpinButton
SpinButton is a multi purpose component, designed to display and browse over data with next/previous buttons.
SpinButton uses a data model, therefore values aren't necessarily fixed neither linear and can be done at request. There's a set of default models but you can easily create your. Output can be
rendered into an TextField (default) or in provided component (component type container)
SpinButton also provides 5 layouts and already pack with 3 (simple) data models : number, date, list.
Extend com.vaadin.data.Validatable
since 1.1
Since version 1.1, value inside a spin button can be manually edited
setWidth, setHeigh issues :
Because of the structure of the widget, setWidth, setHeight are known to cause problem. Recommanded solution is to use style instead, directly on the texteField, as described on the 4th sample.
See sample at http://vaadin.vostoksystem.eu
Nested Class Summary | |
---|---|
static interface |
SpinButton.Editable<T>
This interface must be set to a madel in order to allow user to enter new values. |
static interface |
SpinButton.EditionListener
Listen for edition change. |
static class |
SpinButton.Layout
SpinButton rendering |
static interface |
SpinButton.Model<T>
Model defines how values must be displayed and managed. |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeEvent, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeEvent, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.ui.Layout |
---|
com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.SpacingHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents |
---|
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
---|
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener |
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
---|
com.vaadin.server.Sizeable.Unit |
Field Summary | |
---|---|
static java.lang.String |
BASECSS
|
static java.lang.String |
EDITORCSS
|
static java.lang.String |
ICONONLYCSS
|
protected static int |
STATE_CANCEL_EDIT
|
protected static int |
STATE_COMMIT_EDIT
|
protected static int |
STATE_EDIT
|
protected static int |
STATE_NOEDIT
|
protected static int |
STATE_STANDBY
|
protected static int |
STATE_START_EDIT
|
Fields inherited from class com.vaadin.ui.CssLayout |
---|
components |
Fields inherited from class com.vaadin.ui.AbstractComponent |
---|
DESIGN_ATTR_PLAIN_TEXT |
Fields inherited from interface com.vaadin.ui.Button.ClickListener |
---|
BUTTON_CLICK_METHOD |
Fields inherited from interface com.vaadin.server.Sizeable |
---|
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
SpinButton()
backward compatibility, never use |
|
SpinButton(com.vaadin.ui.Component... children)
backward compatibility, never use |
|
SpinButton(SpinButton.Model model)
Creates a new spinbutton with model model . default layout to Layout.BOX default button will be i18nButton increase/decrease |
|
SpinButton(SpinButton.Model model,
SpinButton.Layout layout)
Creates a new spinbutton with model model . and pack with layout layout |
|
SpinButton(SpinButton.Model model,
SpinButton.Layout layout,
com.vaadin.ui.Button minus,
com.vaadin.ui.Button plus)
Create a new spin button. |
Method Summary | |
---|---|
void |
addEditionListener(SpinButton.EditionListener listener)
add an ew listener for user input (if model allows) |
void |
addListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
addListener(SpinButton.EditionListener listener)
add an ew listener for user input (if model allows) |
void |
addValidator(com.vaadin.data.Validator validator)
|
void |
addValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
buttonClick(com.vaadin.ui.Button.ClickEvent event)
|
SpinButton.Editable |
getEditable()
return editable instance (model). convenience method to acces getconverter/serConverter |
com.vaadin.data.Property |
getPropertyDataSource()
|
java.lang.Object |
getRawValue()
return raw value from model |
java.lang.Class |
getType()
|
java.util.Collection<com.vaadin.data.Validator> |
getValidators()
|
java.lang.Object |
getValue()
|
boolean |
isEditable()
return true if this spinButton accept edition. |
boolean |
isInEdit()
return true if this spinButton is actually waiting for user input. |
boolean |
isInvalidAllowed()
|
boolean |
isValid()
|
void |
removeAllValidators()
|
void |
removeListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
removeListener(SpinButton.EditionListener listener)
|
void |
removeValidator(com.vaadin.data.Validator validator)
|
void |
removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
removeValueChangeListener(SpinButton.EditionListener listener)
|
void |
setButtonIconOnly(boolean value)
Convenience method to hide caption from button. default to true. |
void |
setEditable(boolean value)
Enable user edition of value. |
void |
setInvalidAllowed(boolean invalidValueAllowed)
|
void |
setPropertyDataSource(com.vaadin.data.Property newDataSource)
set datasource for component. |
void |
setValue(java.lang.Object newValue)
note newValue == getValue() is not garanties. |
void |
switchEdition(boolean value)
force this Spinbutton in edition mode and give focus to the TextField . |
void |
validate()
|
void |
validate(java.lang.Object value)
|
Methods inherited from class com.vaadin.ui.CssLayout |
---|
addComponent, addComponent, addComponentAsFirst, addLayoutClickListener, addListener, beforeClientResponse, getComponent, getComponentCount, getComponentIndex, getCss, getState, iterator, readDesign, removeComponent, removeLayoutClickListener, removeListener, replaceComponent, writeDesign |
Methods inherited from class com.vaadin.ui.AbstractLayout |
---|
readMargin, writeMargin |
Methods inherited from class com.vaadin.ui.AbstractComponentContainer |
---|
addComponentAttachListener, addComponentDetachListener, addComponents, addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, removeListener, removeListener, setHeight, setWidth |
Methods inherited from class com.vaadin.ui.AbstractComponent |
---|
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getState, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefined |
Methods inherited from class com.vaadin.server.AbstractClientConnector |
---|
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Property |
---|
isReadOnly, setReadOnly |
Methods inherited from interface com.vaadin.ui.ComponentContainer |
---|
addComponents, addListener, addListener, getComponentIterator, moveComponentsFrom, removeAllComponents, removeListener, removeListener |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.server.ClientConnector |
---|
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
Methods inherited from interface com.vaadin.shared.Connector |
---|
getConnectorId |
Methods inherited from interface com.vaadin.server.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined |
Methods inherited from interface com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier |
---|
addComponentAttachListener, addComponentDetachListener, removeComponentAttachListener, removeComponentDetachListener |
Field Detail |
---|
protected static final int STATE_NOEDIT
protected static final int STATE_STANDBY
protected static final int STATE_EDIT
protected static final int STATE_START_EDIT
protected static final int STATE_COMMIT_EDIT
protected static final int STATE_CANCEL_EDIT
public static final java.lang.String BASECSS
public static final java.lang.String ICONONLYCSS
public static final java.lang.String EDITORCSS
Constructor Detail |
---|
public SpinButton()
java.lang.NullPointerException
- alwayspublic SpinButton(com.vaadin.ui.Component... children)
children
- not used
java.lang.NullPointerException
- alwayspublic SpinButton(SpinButton.Model model)
model
. default layout to Layout.BOX
default button will be i18nButton increase/decrease
model
- data model
to usepublic SpinButton(SpinButton.Model model, SpinButton.Layout layout)
model
. and pack with layout layout
model
- data model
to uselayout
- layout
to use. can be nullpublic SpinButton(SpinButton.Model model, SpinButton.Layout layout, com.vaadin.ui.Button minus, com.vaadin.ui.Button plus)
model
- Model
for values. mandatorylayout
- layout
to use. A css rule will also be added in the form of v-spinbutton-[the layout]. Can be nullplus
- custon button bot the plus/increase button. can Be null.minus
- custom button for the minus/decrease button. Can br null.Method Detail |
---|
public void buttonClick(com.vaadin.ui.Button.ClickEvent event)
buttonClick
in interface com.vaadin.ui.Button.ClickListener
public void setPropertyDataSource(com.vaadin.data.Property newDataSource)
setPropertyDataSource
in interface com.vaadin.data.Property.Viewer
newDataSource
- new Property
for component, or null to reset itpublic com.vaadin.data.Property getPropertyDataSource()
getPropertyDataSource
in interface com.vaadin.data.Property.Viewer
public void addValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
addValueChangeListener
in interface com.vaadin.data.Property.ValueChangeNotifier
public void addListener(com.vaadin.data.Property.ValueChangeListener listener)
addListener
in interface com.vaadin.data.Property.ValueChangeNotifier
public void removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
removeValueChangeListener
in interface com.vaadin.data.Property.ValueChangeNotifier
public void removeListener(com.vaadin.data.Property.ValueChangeListener listener)
removeListener
in interface com.vaadin.data.Property.ValueChangeNotifier
public java.lang.Object getValue()
getValue
in interface com.vaadin.data.Property
public java.lang.Object getRawValue()
public void setValue(java.lang.Object newValue) throws com.vaadin.data.Property.ReadOnlyException
setValue
in interface com.vaadin.data.Property
newValue
-
com.vaadin.data.Property.ReadOnlyException
public java.lang.Class getType()
getType
in interface com.vaadin.data.Property
public void setButtonIconOnly(boolean value)
value
- true
to hide caption (default)public boolean isEditable()
true
if this spinButton accept edition.Editable
, has valid validate
method and allow edition (default false)
public SpinButton.Editable getEditable() throws java.lang.UnsupportedOperationException
Editable
java.lang.UnsupportedOperationException
- if model does not support editionpublic void setEditable(boolean value)
value
value
- true
to enable valuepublic boolean isInEdit()
true
if this spinButton is actually waiting for user input.
true
if waiting for user inputpublic void switchEdition(boolean value)
TextField
.TextField
a convenience one will be provided.
value
- true
to switch component in edition mode. If not posible, does nothing.public void addEditionListener(SpinButton.EditionListener listener)
listener
- public void addListener(SpinButton.EditionListener listener)
listener
- public void removeValueChangeListener(SpinButton.EditionListener listener)
listener
- public void removeListener(SpinButton.EditionListener listener)
listener
- public void addValidator(com.vaadin.data.Validator validator)
addValidator
in interface com.vaadin.data.Validatable
validator
- public void removeValidator(com.vaadin.data.Validator validator)
removeValidator
in interface com.vaadin.data.Validatable
validator
- public void removeAllValidators()
removeAllValidators
in interface com.vaadin.data.Validatable
public java.util.Collection<com.vaadin.data.Validator> getValidators()
getValidators
in interface com.vaadin.data.Validatable
public boolean isValid()
isValid
in interface com.vaadin.data.Validatable
public void validate() throws com.vaadin.data.Validator.InvalidValueException
validate
in interface com.vaadin.data.Validatable
com.vaadin.data.Validator.InvalidValueException
public void validate(java.lang.Object value) throws com.vaadin.data.Validator.InvalidValueException
value
-
com.vaadin.data.Validator.InvalidValueException
public boolean isInvalidAllowed()
isInvalidAllowed
in interface com.vaadin.data.Validatable
public void setInvalidAllowed(boolean invalidValueAllowed) throws java.lang.UnsupportedOperationException
setInvalidAllowed
in interface com.vaadin.data.Validatable
java.lang.UnsupportedOperationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |