How do I prevent extra space between two fields:
VerticalFieldManager _fieldManagerMiddle =
new VerticalFieldManager(Manager.VERTICAL_SCROLL);
LabelField field = new LabelField("Title");
CustomFieldList list = new CustomFieldList ();
_fieldManagerMiddle.add(field);
_fieldManagerMiddle.add(list);
To manage the space between two managers you can try negative VerticalFieldManager and HorizontalFieldManager.
Have you tried setting the margin to zero? Margin is just a property on the field, but managers use it to decide the minimum space between two fields during layout.
field.setMargin(0,0,0,0);
list.setMargin(0,0,0,0);
You can create custom manager .
inside the sublayout method you can position the contents as per your requirement and choice
Related
I am trying to add multiple Vaadin grids of different sizes inside a VerticalLayout container.
public class Overview extends VerticalLayout {
Grid<DataTable1> grid1 = new Grid<>();
Grid<DataTable12> grid2 = new Grid<>();
Grid<DataTable13> grid3 = new Grid<>();
}
So far, each grid is taking up an equal amount of vertical space, as shown in the image below.
grids taking equal vertical space
However, I would like to show the grid as shown in the image below where the height gets dynamically adjusted as per the number of rows and cloumns:
desired grids
Is there any way I can adjust the individual grid height?
So far I have found a way to adjust the row height not the height of the whole grid itself.
Thank you!
Sounds like you might be looking to achieve dynamic height based on the number of rows, which can be done using setAllRowsVisible(true): https://vaadin.com/docs/latest/components/grid/#dynamic-height
The Grid, like all components that implement HasSize, has a method setHeight()
I'm trying to create a HorizontalFieldManager in blackberry app, I want fields to be left aligned which is HFM's default layout but then I want to display one BitmapField right aligned, setMargin(0, 0, 0, Display.getWidth() - bitmap.getWidth()) works fine until I add other Fields in the manager, any ideas please
That's a bit hacky, normally the children are the ones who define the alignment inside the parent manager..
You create the hfm using all width available:
HorizontalFieldManager hfm = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
Then you add the fields (or managers) aligned to left:
hfm.add(new LabelField("Left", Field.FIELD_LEFT));
And then you add the fields that must be aligned right. I'm using labels here, but every class extending Field (including managers) has a constructor accepting flags as argument:
hfm.add(new LabelField("Right", DrawStyle.RIGHT | Field.USE_ALL_WIDTH));
I have added RichTextField to HorizontalFieldManager, and I also set Background bitmap to HorizontalFieldmanager. If the richtextfield text increases the horizontalfield manager height, how can I increase height dynamically?
A HorizontalFieldManager by default will increase its size to show whatever fields you have placed inside of it.
If this is not the case then it sounds like you have overridden this behavior. Without seeing code I can only guess, E.g. by using a static height or width in the sublayout.
I have EditField and use background image..i want to create dynamic EditField
so i want to dynamic height EditFieldbut fix width
Take a look at http://us.blackberry.com/devjournals/resources/journals/jul_2005/creating_textbox_field.jsp, it provides details on creating one.
I have multiple ButtonFields in a VerticalFieldManager. By default the width of each button depends on the text it contains.
I would like all the buttons to be of the same width - equal to the width of the widest button.
Take a look at the BlackBerry Developers Knowledge Base:
How to - Implement advanced buttons, fields, and managers
Last Updated: 12 February 2010
Article Number: DB-00796
You are probably looking for the VerticalButtonFieldSet!
Step 1 - Extend the VerticalFieldManager class, and make the constructor take in a bunch of Strings that you want to put end each button.
Step 2 - Find the longest of String out of the Strings passed into the manager.
Step 3 - create the button for the longest string
Step 4 - create all other buttons, and set their width to the same as the 1st (see setExtent)
Step 5 - add the buttons to the manager in the order you want them to appear
FIN
Have you tried using the Field.USE_ALL_WIDTH style flag?
Try ButtonField buttonField = new ButtonField("ButtonText", Field.USE_ALL_WIDTH);
and that should use the full width.
If that doesn't work, try extending ButtonField, overriding layout and calling setExtent(width, height) with the width and height that you want.