Aligning buttons on a screen - blackberry

I would like to layout two buttons side by side and have multiple rows of these buttons like so -
B1 B2
B1 B2
B1 B2
For this do I need to combine VerticalFieldManager and HorizontalFieldManager somehow ?
Thanks

If you're using JDK 5.0 or greater, there's GridFieldManager. If you're using anything below 5.0, you'll have to use nested Vertical/Horizontal field managers.

Here is a TableLayoutManager class to support such type of layouts.
TableLayoutManager.java
You can download and copy it in your porject and use it.
Use TableLayoutManager like this.
TableLayoutManager btnManager= new TableLayoutManager(new int[ {TableLayoutManager.USE_PREFERRED_SIZE, TableLayoutManager.USE_PREFERRED_SIZE},Manager.FIELD_HCENTER);
btnManager.add(B1);
btnManager.add(B2);
btnManager.add(B1);
btnManager.add(B2);
you can even define your number of columns and there layout styles.

Related

Vaadin 23 align components in Grid header for filtering

This is the code I have for Grid filtering components:
headerRow.getCell(idColumn).setComponent(FilterUtils.createIdFilterHeader(dataViewFilter::setId, "user.id"));
headerRow.getCell(nameColumn).setComponent(FilterUtils.createNameFilterHeader(dataViewFilter::setName, "user.first.name"));
VerticalLayout referrerFilterVerticalLayout = new VerticalLayout();
referrerFilterVerticalLayout.setMargin(false);
referrerFilterVerticalLayout.setPadding(false);
referrerFilterVerticalLayout.setSpacing(false);
referrerFilterVerticalLayout.add(FilterUtils.createIdFilterHeader(dataViewFilter::setReferrerId, "referrer.id"));
referrerFilterVerticalLayout.add(FilterUtils.createNameFilterHeader(dataViewFilter::setReferrerName, "referrer.first.name"));
headerRow.getCell(referredByColumn).setComponent(referrerFilterVerticalLayout);
Right now the header looks like:
I need to adjust the first two components and move them up to get something like this:
Please show how to achieve this.
Probably the easiest thing would be to stick your filter boxes in two Horizontal Layouts, within the Vertical Layout.

In Vaadin 13, is it possible/easy to have "cell highlighting" in grids when certain conitions are met?

In Vaadin 13, I'm using grids. In other programs (eg even Excel) one can create "highlights" of the cells (either the whole cell's baground is highlighted in a color, eg yellow or red or the cell font is higlighted is in a different color) depending on a condition. (This is often used to provide quick visual alerts to the user.)
Is there a safe/easy way to achieve this in Vaadin 13? (I couldn't find any "approved/standard" ways of how to do this using Java & Vaadin 13; I'm not very strong with javascript, but can dabble with it if it's the only "right" way to do this....)
From Vaadin 13 onwards there is setClassNameGenerator method in Grid and Column, which takes lambda as paremeter, returning String. This can be used to produce CSS class name(s) based on e.g. item values. You can then have style module gor the Grid in your shared-styles.html and use these class names there to add e.g. the highlighting of cells etc.

Vaadin 8.2.0 Grid - How to remove the labels from MultiSelection-Checkboxes

Update #2: It turned out that our project setup was not optimal, which is why I had to manually copy the updated VAADIN folder with the theme to another location. The problem was not caused by vaadin but our project setup.
Thank you #SteffenHarbich and the Vaadin-Devs who helped me find the source of my problem here and in the issue ticket.
I am using Vaadin Framework 8.2.0 and I have a Grid with SelectionMode.MULTI
Because of the multiselection mode an additional column appears with checkboxes to select rows, which is fine!
But: these Checkboxes also have a label with the Text Selects row number XX. This label bothers me very much and I can't find a way to remove them.
In the Demo from Vaadin there are no such labels, so I'm sure that it can be achieved somehow.
Hiding the labels with CSS does not help me here, because the column width stays as if there was a label.
Here is my simplified code:
Grid<MyItem> myGrid = new Grid<MyItem>(MyItem.class);
myGrid.setSelectionMode(Grid.SelectionMode.MULTI);
myGrid.getEditor().setEnabled(true);
myGrid.setColumnReorderingAllowed(true);
//all columns match membervariables of MyItem. I use setColumns in order to control which fields are shown (not all of them are)
myGrid.setColumns(GRID_COLUMNS);
myGrid.getColumn("foo").setHidable(false).setCaption("bar");
// configure each column similarly
myGrid.getColumn("foo").setEditorComponent(new TextField());
// some more setters of editorComponents and editorBindings
// finally, set items.
// binder contains a bean that has many MyItems. binder is of type com.vaadin.data.Binder;
myGrid.setItems(binder.getBean().getMyItems());
See the corresponding ticket on github. Problem was old theme CSS.
Add your theme with
.v-assistive-device-only-label label {
font-size:0;
width: 0px;
}

Blackberry complex list

I've got an interesting problem that I'd like some advice and opinions on if you would be so kind. I'm not after code as I prefer to write that for myself. My background is J2ME and Android but I've recently taken up Blackberry.
What I need to write is something akin to the Android ListView albeit a little simpler.
Each row consists of 3 items. There's an image/icon, a multi-line (2 or 3 row) text element and an imagebutton of some form.
However, each row has only 2 columns. The icon/image & multi-line text are combined for the first column and are clickable (with both the column (0) plus the row ID identifiable). The next element in the row (1) is a clickable image (common to all rows - this also needs to have an identifiable row ID). There must be different actions for each column/row cell.
There is a need for multiple rows to be scrollable vertically and there may well be a lot of items.Each row needs to fit the screen width with the icon/multi-line text justified to the left and the clickable image justified to the right. Each row needs all of its components vertically justified (possibly centred) for neatness.
So what we have (for a row) is:
[clickable image/multi-line text combo][clickable image]
Ideally there will be a common background (gradient shaded) for each row once focussed. This should span both columns seamlessly.
Any thoughts would be most appreciated.
The simplest approach is probably to have a VerticalFieldManager for the list, populated by HorizontalFieldManagers for the row.
As for the inner part of the row (the columns) you can pass FIELD_LEFT to the first field and FIELD_RIGHT for the second for alignment. The image-multitext field you can create yourself by extending ButtonField and overriding the paint method. You can use the Graphics object to draw your image and text. A different approach (and perhaps a simpler one) is to extend the HorizontalFieldManager, add your components and make it clickable by capturing the click events.
One thing to realize about Blackberry is that there are many ways to do something, if one thing doesn't work quite the way you want it to, try something different. Hope this help you get started!

Resizable columns / panels for content in jquery?

does any one know if there is an example available for sliding panels in jquery? If so, can someone send me a link? This is what I want to accomplish.
On my main screen I want to have three divisions. One right column that covers half the screen and then the left column divided in two rows. I want to expand and/or shrink the right column and/or left column and/or the top row in the left column and/or the bottom row in the left column.
Think og it as an IDE with the left side of the coding area and right side as project explorer and the properties. The coder would like to see any three of the sections at once or would like to expand each working area.
I am looking for a jquery solution for such!
Thanks
Sounds like the way jsfiddle.net works
This is available as a plugin. http://docs.jquery.com/UI/Resizable
You could also use the jQuery splitter plugin: http://www.methvin.com/splitter/
Also see (2011): http://jcubic.wordpress.com/2011/03/06/jquery-splitter-split-container/
Flexigrid is a new (2012) option: http://flexigrid.info/
The most robust solution for this is to use the jQuery layout plugin. You can find it here: http://layout.jquery-dev.net/

Resources