View Full Version : Grids and Charts in a table
Michi_de
15 Jan 2009, 11:31 PM
This is what my custom widget should look like:
+--ContentPanel(fix)-----------------------+
| +-AnyPanel(but Vertical or Horizontal)---+
| | GRID | CHART |
| +----------------------------------------+
| | GRID | CHART |
| +----------------------------------------+
+------------------------------------------+
I can't change, that the main panel is a ContentPanel.
But the next panel i need to use inside, to form some kind of table, is undefined.
The problem here is: i cant just use horizontal or vertical panels, because the CHART is a OFCGWT widget (see custom plugins forum).
This OFCGWT widget cant be added into horizontal panels.
I tried to add this chart widget into content panels again (with the orientation.HORIZONTAL) but it seems i cant add ContentPanels into ContentPanel.
So do you have any solution for this problem?
Noggy
16 Jan 2009, 9:37 AM
Why not use a LayoutContainer instead?
Michi_de
18 Jan 2009, 11:47 PM
Because this widget is a part of a way bigger application.
So i first add a
LayoutContainer
to my
RootPanel.
Inside this LayoutContainer i want to place this ContentPanel with my charts and grids.
But this seems not possible. Well, too bad :(
EagleEye666666
19 Jan 2009, 2:06 AM
Because this widget is a part of a way bigger application.
So i first add a
LayoutContainer
to my
RootPanel.
Inside this LayoutContainer i want to place this ContentPanel with my charts and grids.
But this seems not possible. Well, too bad :(
Why are you not going to use basic GWT widget? (iam thinking here of a flextable)
I think with a flextable you can accieve what u want. problem will be to size each columns and cells properly.
I used a flextable to implement the possibility of multiple FileuploadFields... you can add/remove such fields... they are added to a flextable, maybe it could also work with grids and charts? biggest problem will be sizing them.
protected void initGrid() {
grid = new FlexTable();
grid.setWidth("100%");
grid.getRowFormatter().addStyleName(0, "x-grid3-row");
grid.getRowFormatter().addStyleName(0, "x-grid3-header");
grid.getRowFormatter().addStyleName(0, "x-grid3-hd-row");
grid.getColumnFormatter().setWidth(FIELD, "95%");
grid.setText(0, FIELD, "File");
grid.setText(0, REMOVE_NR, "");
add(grid);
}
protected ToolBar getToolbar() {
final ToolBar toolbar = new ToolBar();
final TextToolItem addField = new TextToolItem("Add Field");
addField.setIconStyle("add");
addField.addSelectionListener(new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce) {
addField();
}
});
final TextToolItem removeAll = new TextToolItem("Remove All");
removeAll.setIconStyle("remove");
removeAll.addSelectionListener(new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce) {
removeAllRows();
}
});
toolbar.add(addField);
toolbar.add(new SeparatorToolItem());
toolbar.add(removeAll);
return toolbar;
}
protected Widget getUploadField() {
final FileUploadField temp = new FileUploadField();
temp.setName("fileNr_"+(++fileNr));
temp.setAllowBlank(false);
return temp;
}
protected Widget getRemove() {
IconButton remove = new IconButton("icon-cross", new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce) {
for (int i = grid.getRowCount() - 1; i > 0; i--) {
if (((IconButton) grid.getWidget(i, REMOVE_NR)).getId()
.equals(((IconButton) ce.component).getId())) {
grid.removeRow(i);
break;
}
}
}
});
return remove;
}
protected void addField() {
int rows = grid.getRowCount();
grid.insertRow(rows);
grid.getRowFormatter().addStyleName(rows, "x-grid3-row");
grid.setWidget(rows, FIELD, getUploadField());
grid.setWidget(rows, REMOVE_NR, getRemove());
}
Michi_de
19 Jan 2009, 3:53 AM
This works out great.
Thank you for the hint, for the basic GWT widgets :)
So this one is solved.
:D
EagleEye666666
19 Jan 2009, 3:58 AM
This works out great.
Thank you for the hint, for the basic GWT widgets :)
So this one is solved.
:D
No Problem. Iam happy i could help u. Iam still fighting with this solution (dealing with formfields inside this flextable isnt so easy :(, i have got validation problems... cuz nesting to a lot components :D)
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.