I have an application with a set of single row DynamicForms (they contain fields that allow the user to set 'options' ... like SelectItem and other type fields). Depending on client resolution, I'd these forms to wrap to the next line (if not enough room) or stay right justified (if enough room). I'm able to accomplish the first requirement by putting each control in its own dynamicForm and then putting all the forms in a FlowLayout. However, when I do this, all the forms are aligned left.
How do I I make it so the FlowLayout will align its tiles starting from the RIGHT and move LEFT (rather than the default LEFT to RIGHT)? I've tried setLayoutAlign(Alignment.RIGHT) on each of the forms before adding them to the FlowLayout. I've tried a LayoutSpacer. I've tried various align options on the FlowLayout itself.
If I'm not able to accomplish this with the FlowLayout, is there another method I can use to allow
1. Fields aligned right on the page (akin to 'float:right')
2. Fields wrap to the next line if not enough room
I'm able to accomplish #1 using a single DynamicForm that contains all the fields wrapped in a HLayout with setAlign(Alignment.RIGHT). However, this doesn't accomplish #2.
Here's the current code I'm using.
How do I I make it so the FlowLayout will align its tiles starting from the RIGHT and move LEFT (rather than the default LEFT to RIGHT)? I've tried setLayoutAlign(Alignment.RIGHT) on each of the forms before adding them to the FlowLayout. I've tried a LayoutSpacer. I've tried various align options on the FlowLayout itself.
If I'm not able to accomplish this with the FlowLayout, is there another method I can use to allow
1. Fields aligned right on the page (akin to 'float:right')
2. Fields wrap to the next line if not enough room
I'm able to accomplish #1 using a single DynamicForm that contains all the fields wrapped in a HLayout with setAlign(Alignment.RIGHT). However, this doesn't accomplish #2.
Here's the current code I'm using.
Code:
private void populateDock(FlowLayout dock) { //This doesn't work LayoutSpacer spacer = new LayoutSpacer(); spacer.setWidth100(); dock.addTile(spacer); String id = paneldto.getId(); for (SelectorPaneDTO dto : paneldto.getSelectors()) { DynamicForm form = new DynamicForm(); form.setHeight(22); form.setMargin(0); form.setPadding(0); form.setCellPadding(0); //This doesn't have any effect form.setLayoutAlign(Alignment.RIGHT); CanvasItem selectoritem = new SelectorRenderer(dto.getContent(), id); form.setFields(selectoritem); dock.addTile(form); } }
Comment