setRows(Math.max(rows.size(), 1)); Map<Component, Alignment> alignments = new HashMap<>(); List<Float> columnExpandRatios = new ArrayList<>(); float expand = DesignAttributeHandler.readAttribute("expand", rowElement.attributes(), float.class); setRowExpandRatio(row, expand); setColumns(Math.max(colMax, 1)); setColumnExpandRatio(i, columnExpandRatios.get(i)); addComponent(child, j, i, j + colspan, i + rowspan); setComponentAlignment(child, alignments.get(child));
/** * {@inheritDoc} * <p> * After reading the design, cursorY is set to point to a row outside of the * GridLayout area. CursorX is reset to 0. */ @Override public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); setMargin(readMargin(design, getMargin(), designContext)); if (design.childNodeSize() > 0) { // Touch content only if there is some content specified. This is // needed to be able to use extended GridLayouts which add // components in the constructor (e.g. Designs based on GridLayout). readChildComponents(design.children(), designContext); } // Set cursor position explicitly setCursorY(getRows()); setCursorX(0); }
/** * Constructor for a grid of given size (number of columns and rows). * * The grid may grow or shrink later. Grid grows automatically if you add * components outside its area. * * @param columns * Number of columns in the grid. * @param rows * Number of rows in the grid. */ public GridLayout(int columns, int rows) { setColumns(columns); setRows(rows); registerRpc(rpc); }
@Override public void replaceComponent(Component oldComponent, Component newComponent) { // Gets the locations ChildComponentData oldLocation = getState().childData.get(oldComponent); ChildComponentData newLocation = getState().childData.get(newComponent); if (oldLocation == null) { addComponent(newComponent); } else if (newLocation == null) { removeComponent(oldComponent); addComponent(newComponent, oldLocation.column1, oldLocation.row1, oldLocation.column2, oldLocation.row2); } else { int oldAlignment = oldLocation.alignment; oldLocation.alignment = newLocation.alignment; newLocation.alignment = oldAlignment; getState().childData.put(newComponent, oldLocation); getState().childData.put(oldComponent, newLocation); } }
/** * Inserts an empty row at the specified position in the grid. * * @param row * Index of the row before which the new row will be inserted. * The leftmost row has index 0. */ public void insertRow(int row) { if (row > getRows()) { throw new IllegalArgumentException("Cannot insert row at " + row + " in a gridlayout with height " + getRows()); } for (ChildComponentData existingArea : getState().childData.values()) { // Areas ending below the row needs to be moved down or stretched if (existingArea.row2 >= row) { existingArea.row2++; // Stretch areas that span over the selected row if (existingArea.row1 >= row) { existingArea.row1++; } } } if (cursorY >= row) { cursorY++; } setRows(getRows() + 1); markAsDirty(); }
protected void initPeopleGrid() { peopleGrid = new GridLayout(); peopleGrid.setColumns(2); peopleGrid.setSpacing(true); peopleGrid.setMargin(true, false, false, false); peopleGrid.setWidth(100, UNITS_PERCENTAGE); peopleLayout.addComponent(peopleGrid); }
private void createMainLayout() { mainLayout = new GridLayout(4, 1); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setStyleName("fullSize"); mainLayout.addComponent(filterByDSTypeLayout, 0, 0); mainLayout.addComponent(distributionTableLayout, 1, 0); mainLayout.addComponent(softwareModuleTableLayout, 2, 0); mainLayout.addComponent(filterBySMTypeLayout, 3, 0); mainLayout.setRowExpandRatio(0, 1.0F); mainLayout.setColumnExpandRatio(1, 0.5F); mainLayout.setColumnExpandRatio(2, 0.5F); }
protected void initComponentLayout() { selectedComponentLayout = new GridLayout(1,2); selectedComponentLayout.setSizeFull(); selectedComponentLayout.setMargin(true); selectedComponentLayout.setSpacing(true); selectedComponentLayout.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_DETAIL); windowLayout.addComponent(selectedComponentLayout); windowLayout.setExpandRatio(selectedComponentLayout, 1.0f); selectedComponentLayout.setRowExpandRatio(0, 1.0f); selectedComponentLayout.setColumnExpandRatio(0, 1.0f); }
protected void initEventGrid() { eventGrid = new GridLayout(); eventGrid.setColumns(2); eventGrid.setSpacing(true); eventGrid.setMargin(true, false, false, false); eventGrid.setWidth("100%"); eventGrid.setColumnExpandRatio(1, 1.0f); eventGrid.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_GRID); addComponent(eventGrid); }
private void displayDistributionWidgetsOnly() { mainLayout.setColumns(2); mainLayout.setRows(1); mainLayout.addComponent(distributionTableLayout, 0, 0); mainLayout.addComponent(distributionTagLayout, 1, 0); mainLayout.setColumnExpandRatio(0, 1F); }
protected void buildLayout() { mainLayout = new GridLayout(3, 2); mainLayout.setSpacing(true); colorPickerLayout = new ColorPickerLayout(); ColorPickerHelper.setRgbSliderValues(colorPickerLayout); contentLayout = new VerticalLayout(); colorLabelLayout = new HorizontalLayout(); colorLabelLayout.setMargin(false); colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn); formLayout.addComponent(tagName); formLayout.addComponent(tagDesc); formLayout.setSizeFull(); contentLayout.addComponent(formLayout); contentLayout.addComponent(colorLabelLayout); contentLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(colorLabelLayout, Alignment.MIDDLE_LEFT); contentLayout.setSizeUndefined(); mainLayout.setSizeFull(); mainLayout.addComponent(contentLayout, 0, 0); colorPickerLayout.setVisible(false); mainLayout.addComponent(colorPickerLayout, 1, 0); mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(mainLayout); tagName.focus(); }
public void init() { this.setModal(true); this.setResizable(false); this.setHeight("90%"); this.setWidth("90%"); GridLayout layout = new GridLayout(1, 1); layout.setWidth("100%"); layout.addComponent(createErrorOccurrenceDetailsPanel(), 0, 0); this.setContent(layout); }
@Override public void doBuild(ViewChangeBusMessage busMessage) { label = new Label("This is the " + this.getClass() .getSimpleName()); label.setHeight("100px"); grid = new GridLayout(3, 3); grid.addComponent(label, 1, 1); grid.setSizeFull(); grid.setColumnExpandRatio(0, 0.33f); grid.setColumnExpandRatio(1, 0.33f); grid.setColumnExpandRatio(2, 0.33f); grid.setRowExpandRatio(0, 0.4f); grid.setRowExpandRatio(1, 0.2f); grid.setRowExpandRatio(2, 0.4f); label.setSizeFull(); setRootComponent(grid); }
public UiLayout100() { this.layout = new GridLayout(3,1); layout.setMargin(true); layout.setSpacing(true); layout.setHideEmptyRowsAndColumns(true); layout.setColumnExpandRatio(0, 0.3f); layout.setColumnExpandRatio(1, 0.7f); layout.setColumnExpandRatio(2, 0); // layout.setSizeFull(); layout.setWidth("100%"); rows = 0; }
@Override protected void initUi() { super.initUi(); setSizeFull(); grid.setColumnExpandRatio(0, 0f); // Hide the column on the left side mainLayout = new DetailPanel(); setDetailComponent(mainLayout); // Editor editorGrid = new GridLayout(2, 7); editorGrid.setSizeFull(); editorGrid.setMargin(true); editorGrid.setColumnExpandRatio(0, 1.0f); editorGrid.setColumnExpandRatio(1, 9.0f); editorGrid.setSpacing(true); mainLayout.addComponent(editorGrid); initNameField(editorGrid); initDescriptionField(editorGrid); initTaskTable(editorGrid); initButtons(editorGrid); toolBar.setActiveEntry(KEY_EDITOR); }
public Component create(Map<String, Object> context) { GridLayout result = new GridLayout(1, 4); result.setCaption(CAPTION); result.setMargin(true); result.setSpacing(true); result.setSizeFull(); registerCB.setValue(Boolean.valueOf(target.isRegistered())); result.addComponent(registerCB); autoApproveCB.setValue(Boolean.valueOf(target.getAutoApprove())); result.addComponent(autoApproveCB); approveButton.setEnabled(getApproveButtonEnabledState(target)); result.addComponent(approveButton); result.addComponent(new Label(" ")); result.setRowExpandRatio(3, 1.0f);
private void maximizeActionHistory() { removeComponent(countMessageLabel); mainLayout.removeAllComponents(); mainLayout.setColumns(3); mainLayout.setRows(1); mainLayout.addComponent(actionHistoryLayout, 0, 0); mainLayout.addComponent(actionStatusLayout, 1, 0); mainLayout.addComponent(actionStatusMsgLayout, 2, 0); mainLayout.setColumnExpandRatio(0, 0.55F); mainLayout.setColumnExpandRatio(1, 0.18F); mainLayout.setColumnExpandRatio(2, 0.27F); mainLayout.setComponentAlignment(actionHistoryLayout, Alignment.TOP_LEFT); }
private void createMainLayout() { mainLayout = new GridLayout(); layoutWidgets(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setRowExpandRatio(0, 1F); mainLayout.setStyleName("fullSize"); }
component.addStyleName(ValoTheme.PANEL_BORDERLESS); GridLayout layout = new GridLayout(2, 4); layout.setSizeFull(); layout.setMargin(true); serverUrlLabel.setWidth("100%"); layout.addComponent(serverNameLabel, 0, 0); layout.addComponent(serverDescriptionLabel, 0, 1); layout.addComponent(serverUrlLabel, 0, 2); layout.addComponent(statusLabel, 0, 3, 1, 3); layout.setComponentAlignment(statusLabel, Alignment.MIDDLE_CENTER);
try { area = new Area(component, cursorX, cursorY, cursorX, cursorY); checkExistingOverlaps(area); done = true; } catch (final OverlapsException e) { space(); if (cursorX >= getColumns()) { setColumns(cursorX + 1); if (cursorY >= getRows()) { setRows(cursorY + 1); addComponent(component, cursorX, cursorY);