From cedeabc17225ee4b32cf718486a3d391c7b20298 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Fri, 13 Jul 2007 06:38:57 +0000 Subject: [PATCH] disabled reordering on row header column, fixed "slot indicator" for FF svn changeset:1850/svn branch:trunk --- .../terminal/gwt/client/ui/IScrollTable.java | 39 +++++++++++++++---- .../component-themes/common/css/common.css | 7 +++- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java index 5688fa1f0b..8711cc83f8 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java @@ -176,9 +176,7 @@ public class IScrollTable extends Composite implements Paintable, ITable, Scroll private void updateVisibleColumns(UIDL c) { if(!initializedAndAttached) { // add empty cell for col headers - tHead.addAvailableCell(new HeaderCell( - "0", - "")); + tHead.addAvailableCell(new RowHeadersHeaderCell()); Iterator it = c.getChildIterator(); while(it.hasNext()) { UIDL col = (UIDL) it.next(); @@ -708,7 +706,7 @@ public class IScrollTable extends Composite implements Paintable, ITable, Scroll floatingCopyOfHeaderCell = null; } - private void handleCaptionEvent(Event event) { + protected void handleCaptionEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: client.console.log("HeaderCaption: mouse down"); @@ -834,6 +832,23 @@ public class IScrollTable extends Composite implements Paintable, ITable, Scroll } + /** + * HeaderCell that is header cell for row headers. + * + * Reordering disabled and clicking on it resets sorting. + */ + public class RowHeadersHeaderCell extends HeaderCell { + + RowHeadersHeaderCell() { + super("0", ""); + } + + protected void handleCaptionEvent(Event event) { + // NOP: RowHeaders cannot be reordered + // TODO It'd be nice to reset sorting here + } + } + public class TableHead extends Panel implements IActionOwner { private static final int COLUMN_SELECTOR_WIDTH = 10; @@ -986,9 +1001,13 @@ public class IScrollTable extends Composite implements Paintable, ITable, Scroll private void focusSlot(int index) { removeSlotFocus(); if(index > 0) - DOM.setStyleAttribute(DOM.getChild(tr, index - 1), "borderRight", "2px solid black"); + DOM.setStyleAttribute( + DOM.getFirstChild(DOM.getChild(tr, index - 1)), + "borderRight", "2px solid black"); else - DOM.setStyleAttribute(DOM.getChild(tr, index), "borderLeft", "2px solid black"); + DOM.setStyleAttribute( + DOM.getFirstChild(DOM.getChild(tr, index)), + "borderLeft", "2px solid black"); focusedSlot = index; } @@ -996,9 +1015,13 @@ public class IScrollTable extends Composite implements Paintable, ITable, Scroll if(focusedSlot < 0) return; if(focusedSlot == 0) - DOM.setStyleAttribute(DOM.getChild(tr, focusedSlot), "borderLeft", "none"); + DOM.setStyleAttribute( + DOM.getFirstChild(DOM.getChild(tr, focusedSlot)), + "borderLeft", "none"); else if( focusedSlot > 0) - DOM.setStyleAttribute(DOM.getChild(tr, focusedSlot - 1), "borderRight", "none"); + DOM.setStyleAttribute( + DOM.getFirstChild(DOM.getChild(tr, focusedSlot - 1)), + "borderRight", "none"); focusedSlot = -1; } diff --git a/src/com/itmill/toolkit/terminal/gwt/public/component-themes/common/css/common.css b/src/com/itmill/toolkit/terminal/gwt/public/component-themes/common/css/common.css index b35da03269..0da1ecb283 100644 --- a/src/com/itmill/toolkit/terminal/gwt/public/component-themes/common/css/common.css +++ b/src/com/itmill/toolkit/terminal/gwt/public/component-themes/common/css/common.css @@ -21,7 +21,7 @@ select { filter: alpha(opacity:30); } -i-contextmenu { +.i-contextmenu { background: #fff; border: #000; } @@ -31,6 +31,11 @@ i-contextmenu { } +/* disabled row in column selector */ +.off { + font-style: italic; +} + .iscrolltable-header table { border-collapse:collapse; margin:0; -- 2.39.5