Vojtech Szocs has uploaded a new change for review.

Change subject: webadmin,userportal: Resizable table columns (#767924)
......................................................................

webadmin,userportal: Resizable table columns (#767924)

https://bugzilla.redhat.com/767924

This patch introduces resizable table columns feature into gwt-common
module, which makes it available for both WebAdmin and UserPortal.

Table columns can now be resized (have their widths changed) by dragging
their right-hand border using mouse. Each resizable column has a 'resize
bar area' on the right-hand side of its header. Whenever mouse hovers
over this area, mouse cursor changes shape to indicate that column resize
operation can take place.

The implementation is suitable for HTML tables with 'table-layout:fixed'
and 'width:100%' CSS attributes. The 'width:100%' causes the table to
have its columns stretched (or shrinked) by the browser according to
actual table display width. Resizable column implementation therefore
needs to recalculate proportional column width from mouse move delta
on each mouse move event. In addition, 'width:100%' makes all column
widths act as 'weights' (proportional widths) for the overall table
display width. Because of this, the sum of all column widths needs to be
preserved during resize operation. This is solved by distributing column
width delta equally among other columns during resize operation.

Furthermore, this implementation adds following features:

1. double-clicking column resize bar area causes the column to have its
   width reverted back to original value (reset column width)

2. support minimum column width (avoid hiding columns by resizing them
   to zero width)

3. visually highlight column header during resize operation

However, there is one limitation:

Each column MUST have an explicit width defined in pixel (PX) units.

This feature is turned off by default. Following code shows how to turn
it on.

void initTable() {
  getTable().enableColumnResizing(); // must be called before adding columns
  getTable().addColumn(columnOne, "Foo", "50px"); // explicit PX width
  getTable().addColumn(columnTwo, "Bar", "200px"); // explicit PX width
  ...
}

Currently, only AbstractActionTable supports resizable table columns.
This means that column resizing can be currently enabled for main and sub
tab tables. However, it should be easy for other table widgets to
implement the HasResizableColumns interface.

Tested on FireFox 10 and Internet Explorer 8.

Change-Id: Idbb8c32e1858a6e7810d1af9a82166e3790803f8
Signed-off-by: Vojtech Szocs <[email protected]>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java
A 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeHandler.java
A 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/HasResizableColumns.java
A 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ResizableHeader.java
A 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ResizableHeaderCell.java
M 
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/PopupCellTable.css
M 
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/TabCellTable.css
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java
8 files changed, 456 insertions(+), 129 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/5243/1
--
To view, visit http://gerrit.ovirt.org/5243
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbb8c32e1858a6e7810d1af9a82166e3790803f8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to