List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:org.jbpm.form.builder.ng.model.client.form.items.MIGLayoutFormItem.java
License:Apache License
private void populate(FlexTable grid) { if (this.borderWidth != null && this.borderWidth > 0) { grid.setBorderWidth(this.borderWidth); }//from w ww . j a v a 2s . c om if (this.cellpadding != null && this.cellpadding >= 0) { grid.setCellPadding(this.cellpadding); } if (this.cellspacing != null && this.cellspacing >= 0) { grid.setCellSpacing(this.cellspacing); } if (getHeight() != null) { grid.setHeight(getHeight()); } if (getWidth() != null) { grid.setWidth(getWidth()); } if (this.title != null) { grid.setTitle(this.title); } if (this.rows != null && this.rows > 0) { while (this.rows > grid.getRowCount()) { grid.insertRow(grid.getRowCount()); int columnCount = 0; FlexCellFormatter formatter = grid.getFlexCellFormatter(); for (int cell = 0; cell < grid.getCellCount(grid.getRowCount() - 1); cell++) { columnCount += formatter.getColSpan(grid.getRowCount() - 1, cell); } while (this.columns > columnCount) { grid.addCell(grid.getRowCount() - 1); //at least one cell per column. Modified later by colspans columnCount++; } } while (this.rows < grid.getRowCount()) { grid.removeRow(grid.getRowCount() - 1); } } if (this.columns != null && this.columns > 0) { for (int row = 0; row < grid.getRowCount(); row++) { int columnCount = 0; FlexCellFormatter formatter = grid.getFlexCellFormatter(); for (int cell = 0; cell < grid.getCellCount(row); cell++) { columnCount += formatter.getColSpan(row, cell); } while (this.columns > columnCount) { grid.addCell(row); columnCount++; } while (this.columns < columnCount) { int cellCount = grid.getCellCount(row); if (cellCount > 0) { int cellColumns = formatter.getColSpan(row, cellCount - 1); if (cellColumns > 1 && columnCount - cellColumns >= this.columns) { grid.removeCell(row, cellCount - 1); } else { grid.removeCell(row, cellCount - 1); } } columnCount--; } } } }
From source file:org.jbpm.form.builder.ng.model.client.form.items.MIGLayoutFormItem.java
License:Apache License
@Override public Widget cloneDisplay(Map<String, Object> data) { FlexTable ft = new FlexTable(); populate(ft);//from w w w . j a v a 2 s . com for (int row = 0; row < table.getRowCount(); row++) { for (int column = 0; column < table.getCellCount(row); column++) { FBFormItem item = (FBFormItem) this.table.getWidget(row, column); if (item != null) { ft.addCell(row); int colspan = table.getFlexCellFormatter().getColSpan(row, column); ft.getFlexCellFormatter().setColSpan(row, column, colspan); ft.setWidget(row, column, item.cloneDisplay(data)); } } } super.populateActions(ft.getElement()); return ft; }
From source file:org.kaaproject.avro.ui.gwt.client.widget.AbstractFieldWidget.java
License:Apache License
protected int placeWidget(FlexTable table, FieldType type, Widget widget, int row, int column, List<HandlerRegistration> handlerRegistrations) { if (type.isComplex() && !shouldPlaceNestedWidgetButton(type)) { table.setText(row, 0, ""); table.setText(row, 1, ""); row++;//from w ww . j ava2 s. com table.setWidget(row, column, widget); table.getFlexCellFormatter().setColSpan(row, column, 3); } else { table.setWidget(row, column, widget); if (type == FieldType.ALERT) { table.getFlexCellFormatter().setColSpan(row, column, 2); } } return row; }
From source file:org.kaaproject.avro.ui.sandbox.client.mvp.view.form.FormConstructorViewImpl.java
License:Apache License
public FormConstructorViewImpl() { setWidth(FULL_WIDTH);//from w w w. j a v a2 s. c o m int row = 0; HorizontalPanel toolbarPanel = new HorizontalPanel(); CheckBox readOnlyCheckBox = new CheckBox(Utils.constants.read_only()); readOnlyCheckBox.setWidth(FULL_WIDTH); readOnlyCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { form.setReadOnly(event.getValue()); } }); toolbarPanel.add(readOnlyCheckBox); Button showDisplayStringButton = new Button(Utils.constants.view_display_string()); showDisplayStringButton.getElement().getStyle().setMarginLeft(10, Unit.PX); showDisplayStringButton.addStyleName(Utils.avroUiStyle.buttonSmall()); showDisplayStringButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { RecordField field = form.getValue(); String displayString = field != null ? field.getDisplayString() : "null"; Window.alert(Utils.constants.display_string() + ":\n" + displayString); } }); toolbarPanel.add(showDisplayStringButton); setWidget(row++, 0, toolbarPanel); form = new RecordFieldWidget(new AvroWidgetsConfig.Builder().createConfig()); form.addValueChangeHandler(new ValueChangeHandler<RecordField>() { @Override public void onValueChange(ValueChangeEvent<RecordField> event) { fireFormChanged(); } }); CaptionPanel formPanel = new CaptionPanel(Utils.constants.avroUiView()); form.getElement().getStyle().setPropertyPx("minHeight", MIN_PANEL_HEIGHT); formPanel.add(form); setWidget(row++, 0, formPanel); showJsonButton = new Button(Utils.constants.showJson()); showJsonButton.setEnabled(true); loadJsonButton = new Button(Utils.constants.loadJson()); loadJsonButton.setEnabled(false); generateRecordButton = new Button(Utils.constants.generateRecordForm()); generateRecordButton.getElement().getStyle().setProperty("float", "right"); generateRecordButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { generateRecordButton.setEnabled(false); } }); FlexTable buttonTable = new FlexTable(); buttonTable.setWidth(FULL_WIDTH); HorizontalPanel buttonsPanel1 = new HorizontalPanel(); buttonsPanel1.setSpacing(15); buttonsPanel1.add(showJsonButton); buttonsPanel1.add(loadJsonButton); HorizontalPanel buttonsPanel2 = new HorizontalPanel(); buttonsPanel2.setSpacing(15); buttonsPanel2.add(generateRecordButton); buttonTable.setWidget(0, 0, buttonsPanel1); buttonTable.setWidget(0, 1, buttonsPanel2); setWidget(row++, 0, buttonTable); buttonTable.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); buttonTable.getElement().getParentElement().getStyle().setPaddingTop(0, Unit.PX); jsonArea = new SizedTextArea(-1); jsonArea.getTextArea().setWidth(JSON_PANEL_WIDTH); jsonArea.getTextArea().getElement().getStyle().setPropertyPx("minHeight", 300); jsonArea.setVisible(false); jsonArea.addInputHandler(new InputEventHandler() { @Override public void onInputChanged(InputEvent event) { fireChanged(); } }); formJsonPanel = new CaptionPanel(Utils.constants.jsonView()); formJsonPanel.getElement().getStyle().setMargin(5, Unit.PX); VerticalPanel jsonAreaPanel = new VerticalPanel(); jsonAreaPanel.add(jsonArea); jsonAreaPanel.add(uploadForm); formJsonPanel.add(jsonAreaPanel); formJsonPanel.setVisible(false); setWidget(row, 0, formJsonPanel); downloadButton.setEnabled(false); uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); uploadForm.setAction(GWT.getModuleBaseURL() + UPLOAD_SERVLET_PATH); FlexTable fileOpsTable = new FlexTable(); fileOpsTable.setWidth(JSON_PANEL_WIDTH); fileOpsTable.setCellSpacing(8); int column = 0; uploadForm.setWidget(fileOpsTable); fileUpload.setName(Utils.constants.uploadFromFile()); fileOpsTable.setWidget(0, column++, uploadButton); fileOpsTable.setWidget(0, column, fileUpload); fileOpsTable.getFlexCellFormatter().setVerticalAlignment(0, column++, HasVerticalAlignment.ALIGN_MIDDLE); uploadButton.setEnabled(false); uploadButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { if (!"".equals(fileUpload.getFilename())) { uploadForm.submit(); } } }); fileUpload.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent changeEvent) { if (!"".equals(fileUpload.getFilename())) { uploadButton.setEnabled(true); } else { uploadButton.setEnabled(false); } } }); fileOpsTable.setWidget(0, column, downloadButton); fileOpsTable.getFlexCellFormatter().setHorizontalAlignment(0, column, HasHorizontalAlignment.ALIGN_RIGHT); }
From source file:org.kaaproject.kaa.sandbox.web.client.mvp.view.project.ProjectBundleViewImpl.java
License:Apache License
@Override protected void initCenterPanel() { FlexTable flexTable = new FlexTable(); flexTable.addStyleName(sandboxStyle.contentPanel()); flexTable.getColumnFormatter().setWidth(0, "60px"); flexTable.getColumnFormatter().setWidth(1, "160px"); flexTable.getColumnFormatter().setWidth(2, "700px"); backButton.addStyleName(Utils.sandboxStyle.appBackButton()); backButton.getElement().getStyle().setHeight(180, Unit.PX); setBackButton(backButton);// ww w . j ava2 s .c o m flexTable.setWidget(0, 0, backButton); flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); bundleTitleLabel = new Label(); bundleTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel()); bundleTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX); flexTable.setWidget(0, 1, bundleTitleLabel); flexTable.getFlexCellFormatter().setColSpan(0, 1, 2); flexTable.getFlexCellFormatter().setHeight(0, 1, "51px"); VerticalPanel iconAndButtons = new VerticalPanel(); iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); bundleImage = new Image(); iconAndButtons.add(bundleImage); flexTable.setWidget(1, 0, iconAndButtons); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); FlexTable appDetailsPanel = new FlexTable(); appDetailsPanel.getColumnFormatter().setWidth(0, "130px"); appDetailsPanel.getColumnFormatter().setWidth(1, "610px"); int row = -1; descriptionLabel = new Label(); descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel()); appDetailsPanel.setWidget(++row, 0, descriptionLabel); appDetailsPanel.getFlexCellFormatter().setColSpan(row, 0, 2); Label sdkLanguagesLabel = new Label(Utils.constants.sdkLanguages()); sdkLanguagesLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, sdkLanguagesLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); sdkLanguagesPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, sdkLanguagesPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label platformsLabel = new Label(Utils.constants.platforms()); platformsLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, platformsLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); platformsPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, platformsPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label featuresLabel = new Label(Utils.constants.features()); featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, featuresLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); featuresPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, featuresPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label complexityLabel = new Label(Utils.constants.complexity()); complexityLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, complexityLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE); complexityPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, complexityPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Style.Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); flexTable.setWidget(1, 1, appDetailsPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); projectDetailsPanel = new HTML(); projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails()); projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Style.Unit.PX); projectDetailsPanel.getElement().getStyle().setPaddingBottom(15, Style.Unit.PX); flexTable.setWidget(2, 1, projectDetailsPanel); flexTable.getFlexCellFormatter().setColSpan(2, 1, 2); carousel = new CarouselWidget(); HorizontalPanel carouselPanel = new HorizontalPanel(); carouselPanel.addStyleName(sandboxStyle.bundleProjectsPanel()); carouselPanel.getElement().getStyle().setPadding(15, Unit.PX); carouselPanel.setHeight("330px"); carouselPanel.setWidth("100%"); carouselPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); carouselPanel.add(carousel); VerticalPanel content = new VerticalPanel(); content.add(flexTable); content.add(carouselPanel); content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); content.getElement().getStyle().setOverflowX(Overflow.AUTO); DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX); dockPanel.add(new ScrollPanel(content)); centerPanel.add(dockPanel); centerPanel.getWidgetContainerElement(dockPanel).getStyle().setOverflowY(Overflow.AUTO); }
From source file:org.kaaproject.kaa.sandbox.web.client.mvp.view.project.ProjectViewImpl.java
License:Apache License
@Override protected void initCenterPanel() { FlexTable flexTable = new FlexTable(); flexTable.getColumnFormatter().setWidth(0, "60px"); flexTable.getColumnFormatter().setWidth(1, "160px"); flexTable.getColumnFormatter().setWidth(2, "700px"); backButton = new Button(); backButton.addStyleName(Utils.sandboxStyle.appBackButton()); backButton.getElement().getStyle().setHeight(180, Unit.PX); setBackButton(backButton);//from w w w . jav a 2 s .c om flexTable.setWidget(0, 0, backButton); flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); projectTitleLabel = new Label(); projectTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel()); projectTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX); flexTable.setWidget(0, 1, projectTitleLabel); flexTable.getFlexCellFormatter().setColSpan(0, 1, 2); flexTable.getFlexCellFormatter().setHeight(0, 1, "51px"); VerticalPanel iconAndButtons = new VerticalPanel(); iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); applicationImage = new Image(); iconAndButtons.add(applicationImage); VerticalPanel buttonsPanel = new VerticalPanel(); buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX); buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); buttonsPanel.setWidth("100%"); getSourceButton = new Button(Utils.constants.getSourceCode()); getSourceButton.setSize("128px", "32px"); getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); getBinaryButton = new Button(Utils.constants.getBinary()); getBinaryButton.setSize("128px", "32px"); getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX); getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX); getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD); buttonsPanel.add(getSourceButton); SimplePanel spacingPanel = new SimplePanel(); spacingPanel.setHeight("10px"); buttonsPanel.add(spacingPanel); buttonsPanel.add(getBinaryButton); iconAndButtons.add(buttonsPanel); flexTable.setWidget(1, 0, iconAndButtons); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); FlexTable appDetailsPanel = new FlexTable(); appDetailsPanel.getColumnFormatter().setWidth(0, "120px"); appDetailsPanel.getColumnFormatter().setWidth(1, "610px"); int row = -1; descriptionLabel = new Label(); descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel()); appDetailsPanel.setWidget(++row, 0, descriptionLabel); appDetailsPanel.getFlexCellFormatter().setColSpan(row, 0, 2); Label sdkLanguageLabel = new Label(Utils.constants.sdkLanguage()); sdkLanguageLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, sdkLanguageLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE); sdkLanguagePanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, sdkLanguagePanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label platformsLabel = new Label(Utils.constants.platforms()); platformsLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, platformsLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE); platformsPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, platformsPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label featuresLabel = new Label(Utils.constants.features()); featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, featuresLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE); featuresPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, featuresPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); Label complexityLabel = new Label(Utils.constants.complexity()); complexityLabel.addStyleName(Utils.sandboxStyle.contentLabel()); appDetailsPanel.setWidget(++row, 0, complexityLabel); appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE); complexityPanel = new HorizontalPanel(); appDetailsPanel.setWidget(row, 1, complexityPanel); appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Unit.PX); appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE); projectDetailsPanel = new HTML(); projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails()); projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX); appDetailsPanel.setWidget(++row, 0, projectDetailsPanel); appDetailsPanel.getFlexCellFormatter().setColSpan(row, 0, 2); flexTable.setWidget(1, 1, appDetailsPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); detailsPanel.add(flexTable); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.ctl.CtlSchemaViewImpl.java
License:Apache License
@Override protected void constructTopPanel() { FlexTable flexTable = new FlexTable(); flexTable.setCellSpacing(0);/* w w w . j a va 2s. c o m*/ flexTable.setCellPadding(0); flexTable.setHeight("100%"); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); topPanel.add(flexTable); topPanel.setCellHeight(flexTable, "100%"); HorizontalPanel backButtonPanel = new HorizontalPanel(); backButtonPanel.setHeight("100%"); backButtonPanel.addStyleName(Utils.kaaAdminStyle.bAppPaddedPanel()); backButtonPanel.setVisible(false); flexTable.setWidget(0, 0, backButtonPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); backButtonPanelWidget = backButtonPanel; Button backButton = new Button(); backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton()); backButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); backButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); backButtonPanel.add(backButton); backButtonPanel.setCellHeight(backButton, "100%"); backButtonWidget = backButton; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHeight("100%"); flexTable.setWidget(0, 1, verticalPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel firstRowPanel = new HorizontalPanel(); firstRowPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); firstRowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(firstRowPanel); HorizontalPanel secondRowPanel = new HorizontalPanel(); secondRowPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); secondRowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); if (!create) { backButton.getElement().getStyle().setPaddingTop(25, Unit.PX); backButton.getElement().getStyle().setPaddingBottom(25, Unit.PX); firstRowPanel.setHeight("45px"); firstRowPanel.getElement().getStyle().setPaddingBottom(5, Unit.PX); secondRowPanel.setHeight("45px"); topPanel.setHeight("105px"); topPanel.getElement().getStyle().setPaddingTop(10, Unit.PX); updateNorthSize(185); } else { firstRowPanel.setHeight("70px"); secondRowPanel.setHeight("100%"); topPanel.setHeight("80px"); updateNorthSize(175); } verticalPanel.add(secondRowPanel); Label titleLabel = new Label(); titleLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle()); firstRowPanel.add(titleLabel); firstRowPanel.setCellHeight(titleLabel, "100%"); titleLabelWidget = titleLabel; int horizontalMargin = 15; scope = new Label(); scope.getElement().getStyle().setFontSize(16, Unit.PX); scope.getElement().getStyle().setFontWeight(FontWeight.NORMAL); scope.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); firstRowPanel.add(scope); firstRowPanel.setCellHeight(scope, "100%"); updateSchemaScopeButton = new Button(Utils.constants.promote()); updateSchemaScopeButton.setVisible(!create && editable); updateSchemaScopeButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (hasUpdateScopeOption()) { firstRowPanel.add(updateSchemaScopeButton); firstRowPanel.setCellHeight(updateSchemaScopeButton, "100%"); } Label versionLabel = new Label(Utils.constants.version()); versionLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle()); versionLabel.getElement().getStyle().setFontSize(16, Unit.PX); versionLabel.getElement().getStyle().setFontWeight(FontWeight.NORMAL); version = new IntegerListBox(); version.getElement().getStyle().setPadding(5, Unit.PX); version.getElement().getStyle().setMarginLeft(10, Unit.PX); HorizontalPanel versionPanel = new HorizontalPanel(); versionPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); versionPanel.add(versionLabel); versionPanel.add(version); versionPanel.setVisible(!create); secondRowPanel.add(versionPanel); secondRowPanel.setCellHeight(versionPanel, "100%"); createNewSchemaVersionButton = new Button(Utils.constants.createNewVersion()); createNewSchemaVersionButton.setVisible(!create && editable); createNewSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create && editable) { secondRowPanel.add(createNewSchemaVersionButton); secondRowPanel.setCellHeight(createNewSchemaVersionButton, "100%"); } exportActionsButton = new ActionsButton(Utils.resources.export(), Utils.constants.export()); exportActionsButton.setVisible(!create); exportActionsButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create) { secondRowPanel.add(exportActionsButton); secondRowPanel.setCellHeight(exportActionsButton, "100%"); } Button saveButton = new Button(); saveButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (create) { firstRowPanel.add(saveButton); firstRowPanel.setCellHeight(saveButton, "100%"); } saveButtonWidget = saveButton; Button cancelButton = new Button(); cancelButton.setVisible(false); cancelButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (create) { firstRowPanel.add(cancelButton); firstRowPanel.setCellHeight(cancelButton, "100%"); } cancelButtonWidget = cancelButton; deleteSchemaVersionButton = new Button(Utils.constants.delete()); deleteSchemaVersionButton.addStyleName(Utils.kaaAdminStyle.deleteButton()); deleteSchemaVersionButton.setVisible(!create && editable); deleteSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create && editable) { secondRowPanel.add(deleteSchemaVersionButton); secondRowPanel.setCellHeight(deleteSchemaVersionButton, "100%"); } }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.EditSchemaRecordDialog.java
License:Apache License
public EditSchemaRecordDialog(Listener listener, String title, List<SchemaInfoDto> schemas, int schemaVersion) { setWidth("100%"); setTitle(title);/*from www .j a v a2 s . c o m*/ this.listener = listener; SchemaInfoDto currentValue = null; for (SchemaInfoDto schema : schemas) { if (schema.getVersion() == schemaVersion) { currentValue = schema; break; } } VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); setWidget(dialogContents); errorPanel = new AlertPanel(AlertPanel.Type.ERROR); errorPanel.setVisible(false); dialogContents.add(errorPanel); FlexTable table = new FlexTable(); table.setCellSpacing(6); table.addStyleName(Utils.avroUiStyle.fieldWidget()); int row = 0; Widget schemaVersionLabel = new Label(Utils.constants.schemaVersion()); schemaVersionLabel.addStyleName(Utils.avroUiStyle.requiredField()); schemaBox = new SchemaInfoListBox(); schemaBox.setWidth("50px"); schemaBox.getElement().getStyle().setMarginLeft(10, Unit.PX); schemaBox.setValue(currentValue); schemaBox.setAcceptableValues(schemas); schemaBox.addValueChangeHandler(this); HorizontalPanel versionPanel = new HorizontalPanel(); versionPanel.add(schemaVersionLabel); versionPanel.add(schemaBox); table.setWidget(row, 0, versionPanel); schemaRecordPanel = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(), Utils.constants.schema(), this, false, false); //schemaRecordPanel.setWidth("750px"); schemaRecordPanel.getElement().getStyle().setPropertyPx("minWidth", 750); schemaRecordPanel.getRecordWidget().setForceNavigation(true); schemaRecordPanel.setPreferredHeightPx(250); schemaRecordPanel.addValueChangeHandler(new ValueChangeHandler<RecordField>() { @Override public void onValueChange(ValueChangeEvent<RecordField> event) { validate(); } }); table.setWidget(++row, 0, schemaRecordPanel); table.getFlexCellFormatter().setColSpan(row, 0, 2); dialogContents.add(table); saveButton = new Button(Utils.constants.save(), new ClickHandler() { @Override public void onClick(ClickEvent event) { performSave(); } }); Button cancelButton = new Button(Utils.constants.cancel(), new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); EditSchemaRecordDialog.this.listener.onCancel(); } }); addButton(saveButton); addButton(cancelButton); updateValue(currentValue); saveButton.setEnabled(false); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfilesViewImpl.java
License:Apache License
public EndpointProfilesViewImpl() { super(false); int column = 0; FlexTable flexTable = new FlexTable(); flexTable.setStyleName(Utils.avroUiStyle.fieldWidget()); resetButton = new Button(Utils.constants.reset()); flexTable.setWidget(0, column, resetButton); flexTable.getFlexCellFormatter().setVerticalAlignment(0, column++, HasVerticalAlignment.ALIGN_MIDDLE); endpointGroupButton = new RadioButton("filter", Utils.constants.endpointGroup()); listBox = new EndpointGroupsInfoListBox(); listBox.getElement().getStyle().setPropertyPx("minWidth", 100); HorizontalPanel groupPanel = new HorizontalPanel(); groupPanel.setSpacing(15);//from www. j a v a 2s .c om groupPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); groupPanel.add(endpointGroupButton); groupPanel.add(listBox); flexTable.setWidget(0, column++, groupPanel); HorizontalPanel keyHashPanel = new HorizontalPanel(); keyHashPanel.setSpacing(15); keyHashPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); endpointKeyHashButton = new RadioButton("filter", Utils.constants.endpointKeyHash()); endpointKeyHash = new TextBox(); endpointKeyHash.setWidth("100%"); findButton = new Button(Utils.constants.find()); findButton.addStyleName(Utils.avroUiStyle.buttonSmall()); keyHashPanel.add(endpointKeyHashButton); keyHashPanel.add(endpointKeyHash); keyHashPanel.add(findButton); flexTable.setWidget(0, column, keyHashPanel); filterPanel.add(flexTable); endpointGroupButton.setValue(true); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfileViewImpl.java
License:Apache License
@Override protected void initDetailsTable() { detailsTable.getColumnFormatter().setWidth(0, "200px"); detailsTable.getColumnFormatter().setWidth(1, "550px"); detailsTable.getColumnFormatter().setWidth(2, "0px"); getSaveButtonWidget().removeFromParent(); getCancelButtonWidget().removeFromParent(); requiredFieldsNoteLabel.setVisible(false); int row = 0;/* w w w . j av a 2 s.c o m*/ Label keyHashLabel = new Label(Utils.constants.endpointKeyHash()); endpointKeyHash = new KaaAdminSizedTextBox(-1, false); endpointKeyHash.setWidth("100%"); detailsTable.setWidget(row, 0, keyHashLabel); detailsTable.setWidget(row, 1, endpointKeyHash); userInfoList = new ArrayList<>(); Label userIDLabel = new Label(Utils.constants.userId()); userID = new KaaAdminSizedTextBox(-1, false); userID.setWidth("100%"); detailsTable.setWidget(++row, 0, userIDLabel); detailsTable.setWidget(row, 1, userID); userInfoList.add(userIDLabel); userInfoList.add(userID); Label userExternalIDLabel = new Label(Utils.constants.userExternalId()); userExternalID = new KaaAdminSizedTextBox(-1, false); userExternalID.setWidth("100%"); detailsTable.setWidget(++row, 0, userExternalIDLabel); detailsTable.setWidget(row, 1, userExternalID); userInfoList.add(userExternalIDLabel); userInfoList.add(userExternalID); Label sdkLabel = new Label(Utils.constants.sdkProfile()); sdkAnchor = new Anchor(); sdkAnchor.getElement().getStyle().setCursor(Style.Cursor.POINTER); sdkAnchor.setWidth("100%"); detailsTable.getFlexCellFormatter().setHeight(row, 0, "40px"); detailsTable.setWidget(row, 0, sdkLabel); detailsTable.setWidget(row++, 1, sdkAnchor); SpanElement span = Document.get().createSpanElement(); span.appendChild(Document.get().createTextNode(Utils.constants.endpointProfile())); span.addClassName("gwt-Label"); CaptionPanel formPanel = new CaptionPanel(span.getString(), true); FlexTable recordTable = new FlexTable(); recordTable.setWidth("100%"); Label endpointProfSchemaLabel = new Label(Utils.constants.schemaName()); endpointProfSchemaName = new Anchor(); endpointProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER); HorizontalPanel schemaNamePanel = new HorizontalPanel(); schemaNamePanel.setHeight("40px"); schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); schemaNamePanel.add(endpointProfSchemaLabel); schemaNamePanel.add(endpointProfSchemaName); schemaNamePanel.setCellWidth(endpointProfSchemaName, "200px"); endpointProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); HorizontalPanel schemaButtonsPanel = new HorizontalPanel(); schemaButtonsPanel.setSpacing(6); downloadEndpointProfileJsonButton = new ImageTextButton(Utils.resources.download(), Utils.constants.downloadJson()); schemaButtonsPanel.add(downloadEndpointProfileJsonButton); schemaNamePanel.add(schemaButtonsPanel); schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); recordTable.setWidget(0, 0, schemaNamePanel); endpointProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(), Utils.constants.profile(), this, true, true); endpointProfForm.getRecordWidget().setForceNavigation(true); endpointProfForm.setPreferredHeightPx(200); recordTable.setWidget(1, 0, endpointProfForm); recordTable.getFlexCellFormatter().setColSpan(1, 0, 2); formPanel.add(recordTable); detailsTable.setWidget(++row, 0, formPanel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); formPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); span = Document.get().createSpanElement(); span.appendChild(Document.get().createTextNode(Utils.constants.serverProfile())); span.addClassName("gwt-Label"); CaptionPanel serverFormPanel = new CaptionPanel(span.getString(), true); FlexTable serverRecordTable = new FlexTable(); serverRecordTable.setWidth("100%"); Label serverProfSchemaLabel = new Label(Utils.constants.schemaName()); serverProfSchemaName = new Anchor(); serverProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER); schemaNamePanel = new HorizontalPanel(); schemaNamePanel.setHeight("40px"); schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); schemaNamePanel.add(serverProfSchemaLabel); schemaNamePanel.add(serverProfSchemaName); schemaNamePanel.setCellWidth(serverProfSchemaName, "200px"); serverProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); schemaButtonsPanel = new HorizontalPanel(); schemaButtonsPanel.setSpacing(6); downloadServerProfileJsonButton = new ImageTextButton(Utils.resources.download(), Utils.constants.downloadJson()); schemaButtonsPanel.add(downloadServerProfileJsonButton); editServerProfileButton = new Button(Utils.constants.edit()); schemaButtonsPanel.add(editServerProfileButton); schemaNamePanel.add(schemaButtonsPanel); schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX); serverRecordTable.setWidget(0, 0, schemaNamePanel); serverProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(), Utils.constants.profile(), this, true, true); serverProfForm.getRecordWidget().setForceNavigation(true); serverProfForm.setPreferredHeightPx(200); serverRecordTable.setWidget(1, 0, serverProfForm); serverRecordTable.getFlexCellFormatter().setColSpan(1, 0, 2); serverFormPanel.add(serverRecordTable); detailsTable.setWidget(++row, 0, serverFormPanel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); serverFormPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); groupsGrid = new EndpointGroupGrid(true); groupsGrid.setSize("100%", "200px"); Label groupsLabel = new Label(Utils.constants.endpointGroups()); detailsTable.setWidget(++row, 0, groupsLabel); groupsLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.setWidget(++row, 0, groupsGrid); groupsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicsGrid = new TopicGrid(false, true); topicsGrid.setSize("100%", "200px"); Label topicLabel = new Label(Utils.constants.subscribedOnNfTopics()); topicLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitleLabel()); detailsTable.setWidget(++row, 0, topicLabel); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); detailsTable.setWidget(++row, 0, topicsGrid); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); topicsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX); }