com.vaadin.flow.component.html.H3 Java Examples
The following examples show how to use
com.vaadin.flow.component.html.H3.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserGroupsView.java From radman with MIT License | 6 votes |
UserGroupFormDialog() { TextField username = new TextField("Name"); username.setValueChangeMode(ValueChangeMode.EAGER); TextField description = new TextField("Description"); description.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(RadiusGroupDto.class); binder.bind(username, "name"); binder.bind(description, "description"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(username, description)); add(new Hr()); add(controlsLayout); }
Example #2
Source File: AppConfigView.java From alibaba-rsocket-broker with Apache License 2.0 | 6 votes |
VerticalLayout makeAppList() { VerticalLayout appList = new VerticalLayout(); appList.add(new H3("App List")); Accordion accordion = new Accordion(); configurationService.getGroups().subscribe(groupName -> { UnorderedList keys = new UnorderedList(); configurationService.findNamesByGroup(groupName).subscribe(key -> { keys.add(makeConfigItem(groupName, key.substring(key.indexOf(":") + 1))); }); accordion.add(groupName, keys); }); accordion.addOpenedChangeListener(openedChangeEvent -> { openedChangeEvent.getOpenedPanel().ifPresent(accordionPanel -> { clearForm(); appName.setValue(accordionPanel.getSummaryText()); }); }); appList.add(accordion); return appList; }
Example #3
Source File: NasGroupsView.java From radman with MIT License | 6 votes |
NasGroupFormDialog(NasService nasService) { this.nasService = nasService; TextField groupname = new TextField("Group name"); groupname.setValueChangeMode(ValueChangeMode.EAGER); TextField nasIpAddress = new TextField("IP address"); nasIpAddress.setValueChangeMode(ValueChangeMode.EAGER); TextField nasPortId = new TextField("Port ID"); nasPortId.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(NasGroupDto.class); binder.bind(groupname, "groupName"); binder.bind(nasIpAddress, "nasIpAddress"); binder.bind(nasPortId, "nasPortId"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(groupname, nasIpAddress, nasPortId)); add(new Hr()); add(controlsLayout); }
Example #4
Source File: UsersView.java From radman with MIT License | 6 votes |
UserFormDialog() { TextField username = new TextField("Username"); username.setValueChangeMode(ValueChangeMode.EAGER); TextField description = new TextField("Description"); description.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(RadiusUserDto.class); binder.bind(username, "username"); binder.bind(description, "description"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(username, description)); add(new Hr()); add(controlsLayout); }
Example #5
Source File: LoadingResultNotification.java From radman with MIT License | 5 votes |
public static void show(String title, LoadingResult result) { Notification notification = new Notification(); notification.setDuration(5000); notification.add(new H3(title)); VerticalLayout description = new VerticalLayout(); description.setMargin(false); description.setSpacing(false); description.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER); description.add(row(label("Loaded", "100px"), label(result.getLoaded()))); description.add(row(label("Duplicate", "100px"), label(result.getDuplicate()))); description.add(row(label("Errored", "100px"), label(result.getErrored()))); notification.add(description); notification.setPosition(Notification.Position.TOP_END); notification.open(); }
Example #6
Source File: DemoView.java From flow with Apache License 2.0 | 5 votes |
private Card addCard(String tabName, String tabUrl, String heading, Component... components) { Div tab = tabComponents.computeIfAbsent(tabUrl, url -> { navBar.addLink(tabName, getTabUrl(tabUrl)); return new Div(); }); if (heading != null && !heading.isEmpty()) { tab.add(new H3(heading)); } Card card = new Card(); card.getElement().getNode().runWhenAttached(ui -> { WhenDefinedManager.get(ui).whenDefined(components, () -> { if (components != null && components.length > 0) { card.add(components); } List<SourceCodeExample> list = sourceCodeExamples.get(heading); if (list != null) { list.stream().map(this::createSourceContent) .forEach(card::add); } }); }); tab.add(card); return card; }
Example #7
Source File: WindowBasedCrudLayout.java From crudui with Apache License 2.0 | 5 votes |
@Override public void showDialog(String caption, Component form) { VerticalLayout dialogLayout = new VerticalLayout(form); dialogLayout.setWidth("100%"); dialogLayout.setMargin(false); dialogLayout.setPadding(false); dialog = new Dialog(new H3(caption), dialogLayout); dialog.setWidth(formWindowWidth); dialog.open(); }
Example #8
Source File: SystemView.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
public SystemView() { setAlignItems(Alignment.CENTER); Div infoDiv = new Div(); infoDiv.add(new H3("JVM")); Grid<Tuple2<String, String>> appMetadataGrid = new Grid<>(); appMetadataGrid.setItems(systemInfo()); appMetadataGrid.addColumn(Tuple2::getT1).setHeader("Name"); appMetadataGrid.addColumn(Tuple2::getT2).setHeader("Value"); appMetadataGrid.setWidth("1280px"); infoDiv.add(appMetadataGrid); add(infoDiv); }
Example #9
Source File: AppConfigView.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
VerticalLayout makeConfigForm() { VerticalLayout content = new VerticalLayout(); appName = new TextField("App Name"); appName.setWidth("300px"); configName = new TextField("Key"); configName.setWidth("300px"); configValue = new TextArea("Value"); configValue.setWidth("600px"); HorizontalLayout buttons = new HorizontalLayout(); saveButton = new Button("Save", buttonClickEvent -> { String key = appName.getValue() + ":" + configName.getValue(); AppConfigEvent appConfigEvent = new AppConfigEvent(appName.getValue(), configName.getValue(), configValue.getValue()); configurationService.put(key, configValue.getValue()) .doOnSuccess(aVoid -> Notification.show("Saved Successfully")) .then(brokerManager.broadcast(appConfigEvent.toCloudEvent(URI.create("broker:" + brokerManager.localBroker().getIp())))) .subscribe(); }); content.add(new H3("Key/Value")); content.add(appName); content.add(configName); content.add(configValue); buttons.add(saveButton); buttons.add(new Button("New Configuration", buttonClickEvent -> { clearForm(); })); content.add(buttons); return content; }
Example #10
Source File: ErrorNotification.java From radman with MIT License | 5 votes |
public static void show(String title, String description) { Notification notification = new Notification(); notification.setDuration(3000); notification.add(new H3(title)); notification.add(new Label(description)); notification.setPosition(Notification.Position.TOP_END); notification.open(); }
Example #11
Source File: AccountingView.java From radman with MIT License | 4 votes |
SetAcctStopTimeDialog(UpdateListener<AccountingDto> updateListener) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setPadding(false); verticalLayout.setMargin(false); timestampField = new TextField("Timestamp"); timestampField.setErrorMessage("Timestamp number is required"); timestampField.setValueChangeMode(ValueChangeMode.EAGER); timestampField.addValueChangeListener(event -> isValid(event.getValue())); checkboxNow = new Checkbox("Now"); Button setBtn = new Button("Set"); Button cancelBtn = new Button("Cancel", event -> setOpened(false)); checkboxNow.addValueChangeListener(event -> { if (event.getValue()) { timestampField.setValue(String.valueOf(Instant.now().getEpochSecond())); } timestampField.setEnabled(!event.getValue()); }); timestampField.addValueChangeListener(event -> setBtn.setEnabled(Objects.nonNull(event.getValue()))); setBtn.setEnabled(false); setBtn.addClickListener(event -> { if (isValid(timestampField.getValue())) { try { long timestamp = Long.valueOf(timestampField.getValue()); AccountingDto updatedAccountingDto = accountingService.setAcctStopTime(accountingDto, new Date(timestamp * 1000)); updateListener.onUpdated(this, updatedAccountingDto); setOpened(false); } catch (NotFoundException e) { e.printStackTrace(); } } }); HorizontalLayout controls = new HorizontalLayout(); controls.add(cancelBtn, setBtn); verticalLayout.add(new H3("Set Acct Stop Time"), timestampField, checkboxNow, new Hr(), controls); verticalLayout.setHorizontalComponentAlignment(Alignment.END, controls); add(verticalLayout); }
Example #12
Source File: AccountingView.java From radman with MIT License | 4 votes |
private void buildView() { setHeightFull(); setSpacing(false); Grid<AccountingDto> grid = new Grid<>(AccountingDto.class, false); grid.addColumns("username", "callingStationId", "nasIpAddress", "serviceType"); grid.addColumn(new LocalDateTimeRenderer<>((ValueProvider<AccountingDto, LocalDateTime>) accountingDto -> { if (Objects.isNull(accountingDto.getAcctStartTime())) { return null; } return LocalDateTime.ofInstant(accountingDto.getAcctStartTime().toInstant(), TimeZone.getDefault().toZoneId()); })).setSortProperty("acctStartTime").setHeader("Acct Start Time"); grid.addColumn(new LocalDateTimeRenderer<>((ValueProvider<AccountingDto, LocalDateTime>) accountingDto -> { if (Objects.isNull(accountingDto.getAcctStopTime())) { return null; } return LocalDateTime.ofInstant(accountingDto.getAcctStopTime().toInstant(), TimeZone.getDefault().toZoneId()); })).setSortProperty("acctStopTime").setHeader("Acct Stop Time"); grid.addColumns("acctTerminateCause", "framedIpAddress", "framedProtocol"); grid.addColumns("acctAuthentic", "acctInputOctets", "acctInterval", "acctOutputOctets", "acctSessionId"); grid.addColumn(accountingDto -> { if (Objects.isNull(accountingDto.getAcctSessionTime())) { return null; } return DurationFormatUtils.formatDurationHMS(accountingDto.getAcctSessionTime()); }).setSortProperty("acctSessionTime").setHeader("Acct Session Time"); grid.addColumns("acctUniqueId", "acctUpdateTime", "calledStationId", "connectInfoStart", "connectInfoStop", "nasPortId", "nasPortType", "radAcctId", "realm"); DataProvider<AccountingDto, Object> dataProvider = new SpringDataProviderBuilder<>( (pageable, o) -> accountingService.pageAccountingRecords(filter, pageable), value -> accountingService.countAccountingRecords(filter)) .withDefaultSort("acctStartTime", SortDirection.DESCENDING) .build(); grid.setDataProvider(dataProvider); grid.getColumns().forEach(column -> column.setResizable(true)); grid.setColumnReorderingAllowed(true); grid.setMinHeight("500px"); grid.setHeight("100%"); TextField search = new TextField(event -> { filter.setSearchText(event.getValue()); grid.getDataProvider().refreshAll(); }); search.setValueChangeMode(ValueChangeMode.EAGER); search.setPlaceholder("Search..."); SetAcctStopTimeDialog setAcctStopTimeDialog = new SetAcctStopTimeDialog((source, bean) -> grid.getDataProvider().refreshItem(bean)); Button setAcctStopTimeButton = new Button("Set Acct Stop Time", event -> { Optional<AccountingDto> optional = grid.getSelectionModel().getFirstSelectedItem(); optional.ifPresent(setAcctStopTimeDialog::set); }); setAcctStopTimeButton.setEnabled(false); grid.asSingleSelect().addValueChangeListener(event -> setAcctStopTimeButton.setEnabled(Objects.nonNull(event.getValue()))); Checkbox onlyActiveSessions = new Checkbox("Filter only active sessions"); onlyActiveSessions.setValue(filter.isSearchOnlyActiveSessions()); onlyActiveSessions.addValueChangeListener(event -> { filter.setSearchOnlyActiveSessions(event.getValue()); grid.getDataProvider().refreshAll(); }); add(new H4("Data from Radius DB - \"radacct\" table")); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setDefaultVerticalComponentAlignment(FlexComponent.Alignment.BASELINE); horizontalLayout.add(new H3("Accounting")); horizontalLayout.add(setAcctStopTimeButton); horizontalLayout.add(search); horizontalLayout.add(onlyActiveSessions); add(horizontalLayout); add(grid); }
Example #13
Source File: ServiceTestingView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
VerticalLayout makeServiceCallForm() { VerticalLayout content = new VerticalLayout(); this.serviceNameFiled = new TextField("Service Name"); serviceNameFiled.setWidth("300px"); this.methodNameField = new TextField("Method Name"); methodNameField.setWidth("300px"); TextArea jsonDataTextArea = new TextArea("JSON Data"); jsonDataTextArea.setWidth("600px"); jsonDataTextArea.setHeight("200px"); Pre responsePre = new Pre(); HorizontalLayout buttons = new HorizontalLayout(); Button callButton = new Button("Invoke", buttonClickEvent -> { String serviceName = serviceNameFiled.getValue(); String methodName = methodNameField.getValue(); String jsonData = jsonDataTextArea.getValue(); if (serviceName == null || serviceName.isEmpty()) { serviceNameFiled.setErrorMessage("Please input service name"); } if (methodName == null || methodName.isEmpty()) { methodNameField.setErrorMessage("Please input service name"); } if (jsonData != null) { jsonData = jsonData.trim(); if (!jsonData.isEmpty() && !jsonData.startsWith("[")) { jsonData = "[" + jsonData + "]"; } } callRSocketService(serviceName, methodName, jsonData, responsePre); }); content.add(new H3("RSocket Service Testing")); content.add(serviceNameFiled); content.add(methodNameField); content.add(jsonDataTextArea); content.add(new H4("Response")); content.add(responsePre); buttons.add(callButton); buttons.add(new Button("Clear", buttonClickEvent -> { serviceNameFiled.clear(); serviceNameFiled.setInvalid(false); methodNameField.clear(); jsonDataTextArea.clear(); responsePre.setText(""); })); content.add(buttons); return content; }
Example #14
Source File: DashboardView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
public DashboardView(@Autowired RSocketBrokerHandlerRegistry handlerRegistry, @Autowired ServiceRoutingSelector serviceRoutingSelector, @Autowired RSocketBrokerManager rSocketBrokerManager) { this.handlerRegistry = handlerRegistry; this.serviceRoutingSelector = serviceRoutingSelector; this.rSocketBrokerManager = rSocketBrokerManager; setAlignItems(Alignment.CENTER); //---- top HorizontalLayout top = new HorizontalLayout(); top.setAlignItems(Alignment.CENTER); add(top); // brokers panel Panel brokersPanel = new Panel("Brokers"); brokersPanel.add(brokersCount); top.add(brokersPanel); // apps panel Panel appsPanel = new Panel("Apps"); appsPanel.add(appsCount); top.add(appsPanel); // services panel Panel servicePanel = new Panel("Services"); servicePanel.add(servicesCount); top.add(servicePanel); // connections panel Panel connectionPanel = new Panel("Connections"); connectionPanel.add(connectionsCount); top.add(connectionPanel); // requests count panel Panel requestsPanel = new Panel("Requests"); requestsPanel.add(requestsCounter); top.add(requestsPanel); //--- last ten apps Div div2 = new Div(); div2.add(new H3("Last apps")); appMetadataGrid.addColumn(AppMetadata::getName).setHeader("App Name"); appMetadataGrid.addColumn(AppMetadata::getIp).setHeader("IP"); appMetadataGrid.addColumn(AppMetadata::getConnectedAt).setHeader("Timestamp"); appMetadataGrid.setWidth("1024px"); div2.add(appMetadataGrid); add(div2); }
Example #15
Source File: NasView.java From radman with MIT License | 4 votes |
NasFormDialog(NasService nasService) { this.nasService = nasService; TextField name = new TextField("Name"); name.setValueChangeMode(ValueChangeMode.EAGER); TextField shortName = new TextField("Short name"); shortName.setValueChangeMode(ValueChangeMode.EAGER); TextField type = new TextField("Type"); type.setValueChangeMode(ValueChangeMode.EAGER); NumberField port = new NumberField("Port"); port.setValueChangeMode(ValueChangeMode.EAGER); PasswordField secret = new PasswordField("Secret"); secret.setValueChangeMode(ValueChangeMode.EAGER); TextField server = new TextField("Server"); server.setValueChangeMode(ValueChangeMode.EAGER); TextField community = new TextField("Community"); community.setValueChangeMode(ValueChangeMode.EAGER); TextArea description = new TextArea("Description"); description.setValueChangeMode(ValueChangeMode.EAGER); FormLayout formLayout = new FormLayout(); formLayout.setWidthFull(); formLayout.setMaxWidth("700px"); formLayout.add(name, shortName, server, port, secret, type, community, description); formLayout.setResponsiveSteps( new FormLayout.ResponsiveStep("0px", 1), new FormLayout.ResponsiveStep("450px", 2)); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(formLayout); add(new Hr()); add(controlsLayout); binder = new BeanValidationBinder<>(NasDto.class); binder.bind(name, "nasName"); binder.bind(shortName, "shortName"); binder.bind(type, "type"); binder.forField(port) .withConverter(new DoubleToIntegerConverter("Port must be number " + "between 1 and " + 65535 + ".")) .bind("ports"); binder.bind(secret, "secret"); binder.bind(server, "server"); binder.bind(community, "community"); binder.bind(description, "description"); }
Example #16
Source File: UserToGroupView.java From radman with MIT License | 4 votes |
private void buildView() { setHeightFull(); setSpacing(false); RoleDto role = securityService.getLoggedUserRole(); Grid<RadiusUserToGroupDto> grid = new Grid<>(RadiusUserToGroupDto.class, false); grid.addColumns("username", "groupName", "userInRadman", "groupInRadman"); DataProvider<RadiusUserToGroupDto, Object> dataProvider = new SpringDataProviderBuilder<>( (pageable, o) -> userService.pageRadiusUserToGroupRecords(filter, pageable), value -> userService.countRadiusUserToGroupRecords(filter)) .withDefaultSort("username", SortDirection.ASCENDING) .build(); grid.setDataProvider(dataProvider); grid.setSortableColumns("username", "groupName"); grid.setColumnReorderingAllowed(true); grid.setMinHeight("500px"); grid.setHeight("100%"); Button addUserToGroup = new Button("Add user to group", event -> { AddUserToGroupDialog addDialog = new AddUserToGroupDialog( (source, bean) -> grid.getDataProvider().refreshAll()); addDialog.startAdding(); }); addUserToGroup.setEnabled(role == RoleDto.ADMIN); ConfirmationDialog deleteDialog = new ConfirmationDialog(); deleteDialog.setTitle("Delete User to Group mapping"); deleteDialog.setDescription("Are you sure?"); deleteDialog.setConfirmButtonCaption("Delete"); deleteDialog.setConfirmListener(() -> { Optional<RadiusUserToGroupDto> optional = grid.getSelectionModel().getFirstSelectedItem(); try { optional.ifPresent(userService::removeRadiusUserFromGroup); grid.getDataProvider().refreshAll(); } catch (Exception e) { log.warn("Failed to delete user to group mapping. Reason = '{}'", e.getMessage()); ErrorNotification.show("Error", "Ooops, something went wrong, try again please"); } deleteDialog.setOpened(false); }); Button removeUserFromGroup = new Button("Remove user from group", event -> deleteDialog.setOpened(true)); removeUserFromGroup.setEnabled(false); grid.asSingleSelect().addValueChangeListener(event -> removeUserFromGroup.setEnabled(Objects.nonNull(event.getValue()) && role == RoleDto.ADMIN)); TextField search = new TextField(event -> { filter.setSearchText(event.getValue()); grid.getDataProvider().refreshAll(); }); search.setValueChangeMode(ValueChangeMode.EAGER); search.setPlaceholder("Search..."); add(new H4("Data from Radius DB - \"radusergroup\" table")); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setDefaultVerticalComponentAlignment(FlexComponent.Alignment.BASELINE); horizontalLayout.add(new H3("Users to Groups")); horizontalLayout.add(addUserToGroup); horizontalLayout.add(removeUserFromGroup); horizontalLayout.add(search); add(horizontalLayout); add(grid); }
Example #17
Source File: SystemUsersView.java From radman with MIT License | 4 votes |
SystemUserEditDialog(UpdateListener<SystemUserDto> updateListener) { FormLayout formLayout = new FormLayout(); formLayout.add(new H3("Edit system user")); ComboBox<RoleDto> role = new ComboBox<>("Role", RoleDto.values()); role.setPreventInvalidInput(true); role.setWidthFull(); binder = new Binder<>(SystemUserDto.class); binder.forField(role) .asRequired("Role is required") .withValidator((Validator<RoleDto>) (value, context) -> { if (value == null) { return ValidationResult.error("System user access role is required."); } return ValidationResult.ok(); }) .bind(SystemUserDto::getRole, SystemUserDto::setRole); Button saveBtn = new Button("Save", event -> { BinderValidationStatus<SystemUserDto> validationStatus = binder.validate(); if (validationStatus.isOk()) { try { SystemUserDto userDto = binder.getBean(); userDto = service.updateSystemUser(userDto); updateListener.onUpdated(this, userDto); setOpened(false); } catch (Exception e) { log.warn("Failed to update system user. Reason = '{}'", e.getMessage()); ErrorNotification.show("Error", "Ooops, something went wrong, try again please"); } } }); Button cancelBtn = new Button("Cancel", event -> setOpened(false)); HorizontalLayout controls = new HorizontalLayout(); controls.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controls.add(cancelBtn, saveBtn); controls.setWidthFull(); formLayout.add(role); formLayout.add(new Hr()); formLayout.add(controls); formLayout.setMaxWidth("400px"); add(formLayout); }