My requirement is displaying a varying number of Rows in a tabelView, where each row contains a label column and a second colum,n with either a textBox, comboBox, richtext or datePicker.
The user may enter some of the values and start a search via a button, displaying the result sint he bottom half of the splitPane.
This table is displayed in a vertical splitPane like this:
Name | txtName
date | datepickerDate
gender | cmbGender
----------------------------
Results will be shown here
The number of rows of the top-table may vary from 1 to 20+.
I have fixed the maximum splitPane size to be 50%-50% distributed, if the table requires more space than 50% of the window, the user needs to scroll.
What i need is a possibility to, at runtime, know how much space the table actually needs. this is dependent on font-size and contents of the cells (eg.: a richtext-control is slightly larger than a textbox) is there a way to know the actuall space the tableview is going to need?
All question i found here relate to fitting the tableview to the window-size, i need it the other way round, i need to place the SplitPane separator where the table ends
Thanks in advance,
BillDoor
Related
I have a simple grid. Two columns with a variable amount of rows. I want to make it so i have a header row with an arrow that can collapse and show the whole grid. So when I bring up the app, only the header row is visible with an arrow, and I can click to expand/collapse to show the rest of the grid.
A TreeGrid seems like overkill since I don’t need any hierarchical structure, just the ability to collapse/expand one row. I exclusively use IE and I’ve read that Drawyer doesnt work with IE 8 and above. I return a list of the objects and the object just has two string variables.
Any help with this? I am new to Vaadin 8.
Set grid height (workaround)
As a workaround, you could set the height to be approximately the number of pixels you expect to be the height of the header.
See the Sampler demo. Click the gear icon at top to expose properties of the example Grid object. The last property shown is "Size (W x H)". Change 100% to 100px to see the effect.
Grid height set to 100%
Grid height set to 100px
You can also hide the footer (see checkbox in that property list).
I don't think this can be done with plain Vaadin. But I recommend the following simpler approach:
Initially call grid.setHeightByRows(1.5) (javadoc). This will show exactly one row and a half to indicate more data is available. A scrollbar will appear, too.
Make a new column within the grid that has a button or add a button below the grid that - when clicked - calls setHeightByRows with the number of elements in the grid and hides the button. This will show all rows.
I want to create a jtable where each cell should be the size of a single character, without any separation between adjacent characters (i.e adjacent columns). There are no borders between columns so the visualization of a sequence of columns is indistinguible of a jLabel. I have tried many things like making the width of a column as small as possible until each cell is displayed as ... meaning there is no space to print the character. So say I want to have 5 consecutive cells to print the name Alice. What I have achieved so far is a table with this aspect
A l i c e
If I make the column width smaller it shows
... ... ... ... ...
And what I want is:
Alice
Thanks!!
Alvaro
What is the point of doing something like this? This will only work for a single row.
What if you have two rows:
Alice
SWITCH
The minimum width of the column will be controlled by the "W" in the second row, which means you will always have extra space around the "l" in Alice.
Why don't you just use a JPanel with a BoxLayout and then add multiple JLabels to the panel?
Anyway, if you feel you still need a JTable then you can check out the Table Column Adjuster which attempts to fit the text. The basic code would be:
TableColumnAdjuster tca = new TableColumnAdjuster(table, 0);
tca.setColumnHeaderIncluded( false );
tca.adjustColumns();
Also, make sure you use JTable.setIntercellSpacing(...) to set the Dimension to 0.
When using "Grab Excess Horizontal Space" on multiple SWT controls within the same space, the default behavior does not divide the space between them exactly equally. Some sort of behind-the-scenes calculation seems to be done to divide it "sort of" equally, but giving a higher ratio to larger controls.
In my example here, I have created a custom table-like control using grid layouts in which the user can add any number of rows, as well as any number of boxes (custom canvases) for each row individually. My intent is to have all boxes within a given row be of equal size - and by that virtue, all rows with an equal number of boxes will have equally-sized boxes, despite being separate. In my example, however, you can see that the one box that has label text within it grabs more space than those on the same row, due to the calculation believing that it "needs more" than the others.
What would be the best way to tackle this issue?
You can try to use makeColumnsEqualWidth from GridLayout.
I'm working on a hotel booking timeline feature for hotel management system. I have a JTable where rows represent rooms and columns represent days. If room is booked for that day, the corresponding cell is highlighted. Since these cells don't have any content and only serve to visually represent days when the rooms are booked, it seems rather pointless for them to have width larger then height. But if I adjust them to be equal column headers containing days are shortened and instead of "02.01.2012." all I see is "...". Since this is not an option I was wondering is it possible to "rotate" the header cells so the text in them is aligned vertically.
You may use the method described in Vertical Table Header Cell Renderer to show the header text in a vertical manner.
I'm making an application that has many lines of data coming back from a Database stub(which will become an Oracle database), and for some reason the scroll bar stops at about the 500th element. I'm wondering if there's anyway to have all the elements show within the scroll bar.
I'm assuming here that you're using Windows, because there is a fairly general problem with scrollbars on Windows: the maximum value is a short int, 32,768. Therefore, if the height of the inner composite of a ScrolledComposite is greater than 32,768 pixels, the composite will be clipped.
I haven't found a robust way of fixing this, but there is a workaround: separate the scrollbar from the composite that you wish to scroll. You can't create a ScrollBar, but you can make a ScrolledComposite that is precisely as wide as a ScrollBar, then attach a ScrollListener to it and have it adjust the layout position of the scrolling composite.
Somewhere I have a snippet, but I'm not even exactly sure if this diagnosis applies to your scenario.
You might need to set the minimum and maximum values of the ScrollBar. You would use the setMinimum() and setMaximum() methods, respectively.
It's also a good idea to set the page increment. This is the number of scroll lines that the selected value changes by when the user clicks the area between the thumb and the arrow buttons, or presses the Page Up or Page Down buttons. You would use the setPageIncrement() method.
Finally, Oracle may impose a maximum number of rows you can retrieve from a table. I believe the default is 500 rows.