I'm quite new to GXT. Is there a widget that is similar to a GWT native FlexTable with GXT?
Something that can display a widget in a grid fashion, set by something like setWidget(int row, int col) ?
I tried inserting a FlexTable in a LayoutContainer however it does not render properly. My requirement is not like a table grid with data, but much like a "grid panel" that will display widgets in a grid way.
I might compare your 'chessboard' with a spreadsheet - the rows/columns dont have particular meaning/data/widths/headers, symmetry and flexibility is what is important. In contrast, GXT's Grid (and GWT's CellTable, DataTable) is designed more like a database, where each column has particular meaning, and almost always a fixed (but somewhat flexible) number of columns, but the row count can grow.
I'd look into GWT's own FlexTable or Grid. If it doesn't work correctly with GXT 2's LayoutContainer, make sure you either add it before the LayoutContainer is added to a parent, or call layout() after adding it to be sure it is drawn.
Drawing a chessboard style grid with widgets means you are drawing a lot of widgets, which isn't going to be terribly fast/efficient. If you don't actually need widgets, but cells will suffice, I'd look into making a cell widget that draws the same cell over and over for a number of rows/columns, but with the specific data you need for each position.
If you have code that almost works, SO allows that to be posted, to perhaps discuss what you are doing, and how it might be done differently.
Related
I'm using PyGTK on Windows to develop a small application.
How can I enforce vertical alignment of widgets across containers to achieve something like this?
In the mockup, widgets are in separate frames, but I want to maintain vertical alignment as if they were in the same gtk.Table. If I put them in the same table then I can't put a gtk.Frame around the groups of widgets.
Maybe it's already too late for you, but for other people that find this question. You can create an array of SizeGroup with 8 elements, and add to each element every widget that should go on the same column, this will make the width of each cell on the respective grid to be the same size, if all widgets are added, this will have the side effect of also align them vertically. Just be sure the amount of columns in the grid below is the same as above.
Also, if your labels need some special alignment there is currently a bug that does not let you use halign and valign when using SizeGroup, see https://bugzilla.gnome.org/show_bug.cgi?id=733981 .
I was using a JFace TreeViewer perfectly well for a while.
It has a bunch of branches of varying lengths, but at the end of the day, the entire tree stretched to the size of its longest string. This was great.
Recently, I decided that the TreeItems labels should have some style to them fonts and highlights.
The trouble, is that the new fonts are a bit larger and stretch the size of the overall string. It seems that the Tree or TreeViewer doesn't recognize this expansion and still judges the size of the label by the amount of small characters in it. The result is that I get a TreeViewer with a horizontal scrollbar, which is highly inconvenient because now my users will have to scroll across each tree, rather than just being to quickly glance at the data.
Does anyone know how to get the Tree to properly fit the length of the longest string, and take into account the added length of the styling, etc?
Thanks!
While this is not a complete answer, I hope it will help jogs someone's memory who has more advanced knowledge on this:
When I set the font to the ViewerCell object to a font that is wide, the entire row properly resizes. It seems that the Tree measures its width by checking the length of the text and the font, but disregards the Style Ranges.
This is a GWT question.
I need to create a hierarchical view of a data set. Let me describe what this hierarchical view is supposed to be:
Lay down a rectangle that is 640 by 480 pixels on your screen.
Now embed 4 rectangles inside the rectangle from the previous step.
The 4 rectangles shall evenly take up the space from the enclosing rectangle.
Continue recursively embedding 4 rectangles inside each 4 rectangle...
So on and so forth until a stop condition (like stop recursing at level N).
I plan on doing this with GWT's CellTable. I know how to make a CellTable out of the various out-of-the-box Cell's (what I mean to say is: all the classes that implement the Cell interface ).
But I can't figure out how to make a CellTable of Widgets... or a CellTable of CellTables. I guess my question boils down to... How would you make a new Cell type that is: WidgetCell or CellTableCell?
UPDATE:
I found an answer that describes how to make a Cell out of a Widget: how-can-i-put-a-widget-in-a-celltable-cell
Given the above answer, is my original idea of making a CellTable out of CellTables practically feasible? Is there a more elegant solution? Am I on the right-track?
CellTables do not support widgets. Grid or FlexTable might work better for you, since they do accept widgets - you could make a Grid of CellTables, for instance. Unfortunately, there is no built-in solution that accepts widgets and provides paging.
I put a ListBox into a tabele cell an want it to ocupy the whole cell (width="100% height="100%") and show as many rows as possible but:
not specifyng setVisibleItemCount causes to show a big dropdownbox (i want a list)
specifying setVisibleCout makes listbox to ignore height (it takes as much place as it needet to exacly display n rows)
i there a workaround ? (in Swing a number of wisible rows ia a funcion of height and I'd like it this way in gwt).
Thanks in advance
ListBox is a native GWT component, and that's the way it works. If you're using GWT 2.1 you can create your own CellRenderer
You could approximate a solution by calculating how many items should be shown based on the height you want.
Under what circumstance I should use FlexTable instead of HTMLTable?
HTMLTable is an abstract class. FlexTable extends this class as well as Grid. HTMLTable is thus never used directly, but you would use FlexTable or Grid. The question is than probably when to use FlexTable? and when to use Grid?
The difference between those classes is that a Grid always has the same number of rows and/or columns while a FlexTable can have different rows per column and different columns per row (This is made possible due to the html properties rowspan and colspan).
Thus when you need flexibale rows or columns you can use FlexTable and otherwise Grid.
However, FlexTable is extremely slow in Internet Explorer, due to slow DOM methods that are used to create a the table. Therefore, avoid FlexTable if you can or only use it create a simple layout (although in that case the DockPanel might be somewhat easier to use).
You can not compare like that.
As per Docs
HTMLTable contains the common table algorithms for Grid and FlexTable.
So Grid or Flextable extends HTMLTable.
And
A Flexible table that creates cells on demand. It can be jagged (that is, each row can contain a different number of cells) and individual cells can be set to span multiple rows or columns.
Now we can have a question Grid or Flextable ???
Here is the Performance difference between grid and Flextable.