diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-05-23 08:06:06 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-05-23 08:06:06 +0000 |
commit | e8a652c91e9e02079180a854789afd5accffce7b (patch) | |
tree | 79524e7841167ac662ff6e5bc4c4480a6d46d48d /src/com/vaadin/terminal/gwt | |
parent | e8844544fcf3f62e9b8a9226e235b90a7106d881 (diff) | |
download | vaadin-framework-e8a652c91e9e02079180a854789afd5accffce7b.tar.gz vaadin-framework-e8a652c91e9e02079180a854789afd5accffce7b.zip |
Table: Make some columns uncollapsable (#7495)
svn changeset:23811/svn branch:6.8
Diffstat (limited to 'src/com/vaadin/terminal/gwt')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 39492d8731..c5ca16925b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -214,6 +214,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, .isTouchDevice() && !BrowserInfo.get().requiresTouchScrollDelegate(); + private Set<String> noncollapsibleColumns; + /** * Represents a select range of rows */ @@ -1086,6 +1088,10 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, updateHeader(uidl.getStringArrayAttribute("vcolorder")); updateFooter(uidl.getStringArrayAttribute("vcolorder")); + if (uidl.hasVariable("noncollapsiblecolumns")) { + noncollapsibleColumns = uidl + .getStringArrayVariableAsSet("noncollapsiblecolumns"); + } } private void updateCollapsedColumns(UIDL uidl) { @@ -3244,6 +3250,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, String colKey; private boolean collapsed; + private boolean noncollapsible = false; private VScrollTableRow currentlyFocusedRow; public VisibleColumnAction(String colKey) { @@ -3255,6 +3262,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, @Override public void execute() { + if (noncollapsible) { + return; + } client.getContextMenu().hide(); // toggle selected column if (collapsedColumns.contains(colKey)) { @@ -3278,17 +3288,27 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, collapsed = b; } + public void setNoncollapsible(boolean b) { + noncollapsible = b; + } + /** * Override default method to distinguish on/off columns */ @Override public String getHTML() { final StringBuffer buf = new StringBuffer(); + buf.append("<span class=\""); if (collapsed) { - buf.append("<span class=\"v-off\">"); + buf.append("v-off"); } else { - buf.append("<span class=\"v-on\">"); + buf.append("v-on"); + } + if (noncollapsible) { + buf.append(" v-disabled"); } + buf.append("\">"); + buf.append(super.getHTML()); buf.append("</span>"); @@ -3330,6 +3350,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, if (!c.isEnabled()) { a.setCollapsed(true); } + if (noncollapsibleColumns.contains(cid)) { + a.setNoncollapsible(true); + } actions[i] = a; } return actions; |