*/
public class VScrollTable extends FlowPanel implements HasWidgets,
ScrollHandler, VHasDropHandler, FocusHandler, BlurHandler, Focusable,
- ActionOwner {
+ ActionOwner, Container {
public enum SelectMode {
NONE(0), SINGLE(1), MULTI(2);
}
}
- public class VScrollTableRow extends Panel implements ActionOwner,
- Container {
+ public class VScrollTableRow extends Panel implements ActionOwner {
private static final int TOUCHSCROLL_TIMEOUT = 70;
private static final int DRAGMODE_MULTIROW = 2;
return paintableId;
}
- public RenderSpace getAllocatedSpace(Widget child) {
- int w = 0;
- int i = getColIndexOf(child);
- HeaderCell headerCell = tHead.getHeaderCell(i);
- if (headerCell != null) {
- if (initializedAndAttached) {
- w = headerCell.getWidth();
- } else {
- // header offset width is not absolutely correct value,
- // but a best guess (expecting similar content in all
- // columns ->
- // if one component is relative width so are others)
- w = headerCell.getOffsetWidth() - getCellExtraWidth();
- }
- }
- return new RenderSpace(w, 0) {
- @Override
- public int getHeight() {
- return (int) getRowHeight();
- }
- };
- }
-
private int getColIndexOf(Widget child) {
com.google.gwt.dom.client.Element widgetCell = child
.getElement().getParentElement().getParentElement();
}
- public boolean requestLayout(Set<Widget> children) {
- // row size should never change and system wouldn't event
- // survive as this is a kind of fake paitable
- return true;
- }
-
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
- // NOP, not rendered
- }
-
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// Should never be called,
// Component container interface faked here to get layouts
return this;
}
+ public void replaceChildComponent(Widget oldComponent, Widget newComponent) {
+ VScrollTableRow row = (VScrollTableRow) oldComponent.getParent();
+ row.replaceChildComponent(oldComponent, newComponent);
+
+ }
+
+ public boolean hasChildComponent(Widget child) {
+ VScrollTableRow row = (VScrollTableRow) child.getParent();
+ return row.hasChildComponent(child);
+ }
+
+ public boolean requestLayout(Set<Widget> children) {
+ // row size should never change
+ return true;
+ }
+
+ public RenderSpace getAllocatedSpace(Widget child) {
+ // Called by widgets attached to a row
+ VScrollTableRow row = (VScrollTableRow) child.getParent();
+ int w = 0;
+ int i = row.getColIndexOf(child);
+ HeaderCell headerCell = tHead.getHeaderCell(i);
+ if (headerCell != null) {
+ if (initializedAndAttached) {
+ w = headerCell.getWidth();
+ } else {
+ // header offset width is not absolutely correct value,
+ // but a best guess (expecting similar content in all
+ // columns ->
+ // if one component is relative width so are others)
+ w = headerCell.getOffsetWidth()
+ - scrollBody.getCellExtraWidth();
+ }
+ }
+ return new RenderSpace(w, 0) {
+ @Override
+ public int getHeight() {
+ return (int) scrollBody.getRowHeight();
+ }
+ };
+ }
}
}
}
- @Override
- public RenderSpace getAllocatedSpace(Widget child) {
- if (widgetInHierarchyColumn == child) {
- final int hierarchyAndIconWidth = getHierarchyAndIconWidth();
- final RenderSpace allocatedSpace = super
- .getAllocatedSpace(child);
- return new RenderSpace() {
- @Override
- public int getWidth() {
- return allocatedSpace.getWidth()
- - hierarchyAndIconWidth;
- }
-
- @Override
- public int getHeight() {
- return allocatedSpace.getHeight();
- }
-
- };
- }
- return super.getAllocatedSpace(child);
- }
-
private int getHierarchyAndIconWidth() {
int consumedSpace = treeSpacer.getOffsetWidth();
if (treeSpacer.getParentElement().getChildCount() > 2) {
int newTotalRows = uidl.getIntAttribute("totalrows");
setTotalRows(newTotalRows);
}
+
+ @Override
+ public RenderSpace getAllocatedSpace(Widget child) {
+ VTreeTableRow row = (VTreeTableRow) child.getParent();
+ if (row.widgetInHierarchyColumn == child) {
+ final int hierarchyAndIconWidth = row.getHierarchyAndIconWidth();
+ final RenderSpace allocatedSpace = super.getAllocatedSpace(child);
+ return new RenderSpace() {
+ @Override
+ public int getWidth() {
+ return allocatedSpace.getWidth() - hierarchyAndIconWidth;
+ }
+
+ @Override
+ public int getHeight() {
+ return allocatedSpace.getHeight();
+ }
+
+ };
+ }
+ return super.getAllocatedSpace(child);
+ }
+
}