aboutsummaryrefslogtreecommitdiffstats
path: root/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java
diff options
context:
space:
mode:
Diffstat (limited to 'compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java')
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java98
1 files changed, 87 insertions, 11 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java
index 9e214667fa..e2566aa099 100644
--- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java
+++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java
@@ -58,6 +58,7 @@ import com.vaadin.server.VaadinSession;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.Registration;
import com.vaadin.shared.data.sort.SortDirection;
+import com.vaadin.shared.ui.ContentMode;
import com.vaadin.shared.ui.ErrorLevel;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.AbstractComponent;
@@ -6719,21 +6720,47 @@ public class Grid extends AbstractComponent
* optional descriptions (tooltips) for individual Grid cells. If a
* {@link RowDescriptionGenerator} is also set, the row description it
* generates is displayed for cells for which {@code generator} returns
- * null.
+ * <code>null</code>.
+ * <p>
*
* @param generator
- * the description generator to use or {@code null} to remove a
- * previously set generator if any
+ * the description generator to use or <code>null</code> to
+ * remove a previously set generator if any
*
+ * @see #setCellDescriptionGenerator(CellDescriptionGenerator, ContentMode)
* @see #setRowDescriptionGenerator(RowDescriptionGenerator)
*
* @since 7.6
*/
- public void setCellDescriptionGenerator(
- CellDescriptionGenerator generator) {
+
+ public void setCellDescriptionGenerator(CellDescriptionGenerator generator) {
+ setCellDescriptionGenerator(generator, ContentMode.PREFORMATTED);
+ }
+
+ /**
+ * Sets the {@code CellDescriptionGenerator} instance and content mode for
+ * generating optional descriptions (tooltips) for individual Grid cells. If
+ * a {@link RowDescriptionGenerator} is also set, the row description it
+ * generates is displayed for cells for which {@code generator} returns
+ * <code>null</code>.
+ *
+ * @param generator
+ * the description generator to use or <code>null</code> to
+ * remove a previously set generator if any
+ * @param contentMode
+ * the content mode for cell tooltips, not <code>null</code>
+ * @see #setRowDescriptionGenerator(RowDescriptionGenerator)
+ *
+ * @since
+ */
+ public void setCellDescriptionGenerator(CellDescriptionGenerator generator,
+ ContentMode contentMode) {
+ if (contentMode == null) {
+ throw new IllegalArgumentException("Content mode cannot be null");
+ }
cellDescriptionGenerator = generator;
- getState().hasDescriptions = (generator != null
- || rowDescriptionGenerator != null);
+ getState().hasDescriptions = (generator != null || rowDescriptionGenerator != null);
+ getState().cellTooltipContentMode = contentMode;
datasourceExtension.refreshCache();
}
@@ -6750,29 +6777,78 @@ public class Grid extends AbstractComponent
}
/**
+ * Gets the content mode used for cell descriptions.
+ *
+ * @return the content mode used for cell descriptions, not
+ * <code>null</code>
+ * @see #setCellDescriptionGenerator(CellDescriptionGenerator, ContentMode)
+ * @since
+ */
+ public ContentMode getCellDescriptionContentMode() {
+ return getState(false).cellTooltipContentMode;
+ }
+
+ /**
* Sets the {@code RowDescriptionGenerator} instance for generating optional
* descriptions (tooltips) for Grid rows. If a
* {@link CellDescriptionGenerator} is also set, the row description
* generated by {@code generator} is used for cells for which the cell
- * description generator returns null.
- *
+ * description generator returns <code>null</code>.
*
* @param generator
- * the description generator to use or {@code null} to remove a
- * previously set generator if any
+ * the description generator to use or <code>null</code> to
+ * remove a previously set generator if any
*
+ * @see #setRowDescriptionGenerator(RowDescriptionGenerator, ContentMode)
* @see #setCellDescriptionGenerator(CellDescriptionGenerator)
*
* @since 7.6
*/
public void setRowDescriptionGenerator(RowDescriptionGenerator generator) {
+ setRowDescriptionGenerator(generator, ContentMode.PREFORMATTED );
+ }
+
+ /**
+ * Sets the {@code RowDescriptionGenerator} instance for generating optional
+ * descriptions (tooltips) for Grid rows. If a
+ * {@link CellDescriptionGenerator} is also set, the row description
+ * generated by {@code generator} is used for cells for which the cell
+ * description generator returns <code>null</code>.
+ *
+ * @param generator
+ * the description generator to use or <code>null</code> to
+ * remove a previously set generator if any
+ * @param contentMode
+ * the content mode for row tooltips, not <code>null</code>
+ *
+ * @see #setCellDescriptionGenerator(CellDescriptionGenerator)
+ *
+ * @since
+ */
+ public void setRowDescriptionGenerator(RowDescriptionGenerator generator,
+ ContentMode contentMode) {
+ if (contentMode == null) {
+ throw new IllegalArgumentException("Content mode cannot be null");
+ }
rowDescriptionGenerator = generator;
getState().hasDescriptions = (generator != null
|| cellDescriptionGenerator != null);
+ getState().rowTooltipContentMode = contentMode;
datasourceExtension.refreshCache();
}
/**
+ * Gets the content mode used for row descriptions.
+ *
+ * @return the content mode used for row descriptions, not <code>null</code>
+ * @see #setRowDescriptionGenerator(RowDescriptionGenerator, ContentMode)
+ * @since
+ */
+ public ContentMode getRowDescriptionContentMode() {
+ return getState(false).rowTooltipContentMode;
+ }
+
+ /**
* Returns the {@code RowDescriptionGenerator} instance used to generate
* descriptions (tooltips) for Grid rows.
*