aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/ui/DragAndDropWrapper.java41
-rw-r--r--server/src/com/vaadin/ui/themes/ValoTheme.java74
2 files changed, 112 insertions, 3 deletions
diff --git a/server/src/com/vaadin/ui/DragAndDropWrapper.java b/server/src/com/vaadin/ui/DragAndDropWrapper.java
index 3d3356b338..0e2e8f6d2f 100644
--- a/server/src/com/vaadin/ui/DragAndDropWrapper.java
+++ b/server/src/com/vaadin/ui/DragAndDropWrapper.java
@@ -180,10 +180,17 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
* the wrapper will no longer work.
*/
HTML5,
+
+ /**
+ * Uses the component defined in
+ * {@link #setDragImageComponent(Component)} as the drag image.
+ */
+ COMPONENT_OTHER,
}
private final Map<String, Object> html5DataFlavors = new LinkedHashMap<String, Object>();
private DragStartMode dragStartMode = DragStartMode.NONE;
+ private Component dragImageComponent = null;
private Set<String> sentIds = new HashSet<String>();
@@ -227,6 +234,19 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute(DragAndDropWrapperConstants.DRAG_START_MODE,
dragStartMode.ordinal());
+
+ if (dragStartMode.equals(DragStartMode.COMPONENT_OTHER)) {
+ if (dragImageComponent != null) {
+ target.addAttribute(
+ DragAndDropWrapperConstants.DRAG_START_COMPONENT_ATTRIBUTE,
+ dragImageComponent.getConnectorId());
+ } else {
+ throw new IllegalArgumentException(
+ "DragStartMode.COMPONENT_OTHER set but no component "
+ + "was defined. Please set a component using DragAnd"
+ + "DropWrapper.setDragStartComponent(Component).");
+ }
+ }
if (getDropHandler() != null) {
getDropHandler().getAcceptCriterion().paint(target);
}
@@ -300,6 +320,27 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
return dragStartMode;
}
+ /**
+ * Sets the component that will be used as the drag image. Only used when
+ * wrapper is set to {@link DragStartMode#COMPONENT_OTHER}
+ *
+ * @param dragImageComponent
+ */
+ public void setDragImageComponent(Component dragImageComponent) {
+ this.dragImageComponent = dragImageComponent;
+ markAsDirty();
+ }
+
+ /**
+ * Gets the component that will be used as the drag image. Only used when
+ * wrapper is set to {@link DragStartMode#COMPONENT_OTHER}
+ *
+ * @return <code>null</code> if no component is set.
+ */
+ public Component getDragImageComponent() {
+ return dragImageComponent;
+ }
+
final class ProxyReceiver implements StreamVariable {
private String id;
diff --git a/server/src/com/vaadin/ui/themes/ValoTheme.java b/server/src/com/vaadin/ui/themes/ValoTheme.java
index ad949c6a32..d6bd97ed72 100644
--- a/server/src/com/vaadin/ui/themes/ValoTheme.java
+++ b/server/src/com/vaadin/ui/themes/ValoTheme.java
@@ -25,9 +25,10 @@ import com.vaadin.ui.Table.ColumnHeaderMode;
* </p>
*
* <p>
- * These styles are only available if the Valo theme (or any of it's variants)
- * is built with the <code>$valo-include-common-stylenames</code> Sass variable
- * set to <code>true</code>.
+ * These styles are only available if the
+ * <code>$v-included-additional-styles</code> Sass list variable contains the
+ * name of the component for that additional style name (e.g.
+ * <code>button, textfield, table</code>).
* </p>
*
* <p>
@@ -149,6 +150,12 @@ public class ValoTheme {
public static final String LABEL_NO_MARGIN = "no-margin";
/**
+ * Tiny font size. Suitable for additional/supplementary UI text. Can be
+ * combined with any other Label style.
+ */
+ public static final String LABEL_TINY = "tiny";
+
+ /**
* Small font size. Suitable for additional/supplementary UI text. Can be
* combined with any other Label style.
*/
@@ -161,6 +168,12 @@ public class ValoTheme {
public static final String LABEL_LARGE = "large";
/**
+ * Huge font size. Suitable for important/prominent UI text. Can be combined
+ * with any other Label style.
+ */
+ public static final String LABEL_HUGE = "huge";
+
+ /**
* Lighter font weight. Suitable for additional/supplementary UI text. Can
* be combined with any other Label style.
*/
@@ -173,6 +186,11 @@ public class ValoTheme {
public static final String LABEL_BOLD = "bold";
/**
+ * Colored text. Can be combined with any other Label style.
+ */
+ public static final String LABEL_COLORED = "colored";
+
+ /**
* Success badge style. Adds a border around the label and an icon next to
* the text. Suitable for UI notifications that need to in the direct
* context of some component. Can be combined with any other Label style.
@@ -252,6 +270,11 @@ public class ValoTheme {
public static final String BUTTON_LINK = "link";
/**
+ * Tiny size button. Can be combined with any other Button style.
+ */
+ public static final String BUTTON_TINY = "tiny";
+
+ /**
* Small size button. Can be combined with any other Button style.
*/
public static final String BUTTON_SMALL = "small";
@@ -262,6 +285,11 @@ public class ValoTheme {
public static final String BUTTON_LARGE = "large";
/**
+ * Huge size button. Can be combined with any other Button style.
+ */
+ public static final String BUTTON_HUGE = "huge";
+
+ /**
* Align the icon to the right side of the button caption. Can be combined
* with any other Button style.
*/
@@ -301,6 +329,11 @@ public class ValoTheme {
**************************************************************************/
/**
+ * Tiny size text field. Can be combined with any other TextField style.
+ */
+ public static final String TEXTFIELD_TINY = "tiny";
+
+ /**
* Small size text field. Can be combined with any other TextField style.
*/
public static final String TEXTFIELD_SMALL = "small";
@@ -311,6 +344,11 @@ public class ValoTheme {
public static final String TEXTFIELD_LARGE = "large";
/**
+ * Huge size text field. Can be combined with any other TextField style.
+ */
+ public static final String TEXTFIELD_HUGE = "huge";
+
+ /**
* Removes the border and background from the text field. Can be combined
* with any other TextField style.
*/
@@ -341,6 +379,11 @@ public class ValoTheme {
**************************************************************************/
/**
+ * Tiny size text area. Can be combined with any other TextArea style.
+ */
+ public static final String TEXTAREA_TINY = "tiny";
+
+ /**
* Small size text area. Can be combined with any other TextArea style.
*/
public static final String TEXTAREA_SMALL = "small";
@@ -351,6 +394,11 @@ public class ValoTheme {
public static final String TEXTAREA_LARGE = "large";
/**
+ * Huge size text area. Can be combined with any other TextArea style.
+ */
+ public static final String TEXTAREA_HUGE = "huge";
+
+ /**
* Removes the border and background from the text area. Can be combined
* with any other TextArea style.
*/
@@ -375,6 +423,11 @@ public class ValoTheme {
**************************************************************************/
/**
+ * Tiny size date field. Can be combined with any other DateField style.
+ */
+ public static final String DATEFIELD_TINY = "tiny";
+
+ /**
* Small size date field. Can be combined with any other DateField style.
*/
public static final String DATEFIELD_SMALL = "small";
@@ -385,6 +438,11 @@ public class ValoTheme {
public static final String DATEFIELD_LARGE = "large";
/**
+ * Huge size date field. Can be combined with any other DateField style.
+ */
+ public static final String DATEFIELD_HUGE = "huge";
+
+ /**
* Removes the border and background from the date field. Can be combined
* with any other DateField style.
*/
@@ -409,6 +467,11 @@ public class ValoTheme {
**************************************************************************/
/**
+ * Tiny size combo box. Can be combined with any other ComboBox style.
+ */
+ public static final String COMBOBOX_TINY = "tiny";
+
+ /**
* Small size combo box. Can be combined with any other ComboBox style.
*/
public static final String COMBOBOX_SMALL = "small";
@@ -419,6 +482,11 @@ public class ValoTheme {
public static final String COMBOBOX_LARGE = "large";
/**
+ * Huge size combo box. Can be combined with any other ComboBox style.
+ */
+ public static final String COMBOBOX_HUGE = "huge";
+
+ /**
* Removes the border and background from the combo box. Can be combined
* with any other ComboBox style.
*/