From e8a652c91e9e02079180a854789afd5accffce7b Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 23 May 2012 08:06:06 +0000 Subject: Table: Make some columns uncollapsable (#7495) svn changeset:23811/svn branch:6.8 --- .../terminal/gwt/client/ui/VScrollTable.java | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/com/vaadin/terminal/gwt') 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 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(""); + buf.append("v-off"); } else { - buf.append(""); + buf.append("v-on"); + } + if (noncollapsible) { + buf.append(" v-disabled"); } + buf.append("\">"); + buf.append(super.getHTML()); buf.append(""); @@ -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; -- cgit v1.2.3