Java Code Examples for com.vaadin.flow.component.textfield.TextField#setWidth()
The following examples show how to use
com.vaadin.flow.component.textfield.TextField#setWidth() .
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: 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 2
Source File: JwtGeneratorView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
VerticalLayout makeGeneratorForm() { VerticalLayout content = new VerticalLayout(); appNameText = new TextField("App Name"); appNameText.setWidth("300px"); appNameText.setPlaceholder("your-app-name"); ownersText = new TextField("Owners"); ownersText.setWidth("300px"); orgIdsText = new TextField("Org IDs"); orgIdsText.setPlaceholder("1"); orgIdsText.setWidth("300px"); serviceAccountsText = new TextField("Service Accounts"); serviceAccountsText.setValue("default"); serviceAccountsText.setWidth("300px"); rolesText = new TextField("Roles"); rolesText.setWidth("300px"); rolesText.setValue("user"); authoritiesText = new TextField("Authorities"); rolesText.setWidth("300px"); rolesText.setValue(""); tokenTextArea = new TextArea("JWT Token"); tokenTextArea.setWidth("800px"); tokenTextArea.setHeight("240px"); tokenTextArea.setReadOnly(true); rolesText.setWidth("200px"); HorizontalLayout buttons = new HorizontalLayout(); generateBtn = new Button("Generate", buttonClickEvent -> { String appName = appNameText.getValue(); String[] orgIds = orgIdsText.getValue().trim().split("[,;\\s]*"); String[] serviceAccounts = serviceAccountsText.getValue().trim().split("[,;\\s]*"); String[] owners = ownersText.getValue().trim().split("[,;\\s]*"); String[] roles = rolesText.getValue().trim().split("[,;\\s]*"); String[] authorities = authoritiesText.getValue().trim().split("[,;\\s]*"); try { String token = authenticationService.generateCredentials(UUID.randomUUID().toString(), orgIds, serviceAccounts, roles, authorities, appName, owners); tokenTextArea.setValue(token); } catch (Exception ignore) { } }); content.add(appNameText); content.add(ownersText); content.add(orgIdsText); content.add(serviceAccountsText); content.add(rolesText); content.add(authoritiesText); content.add(tokenTextArea); buttons.add(generateBtn); buttons.add(new Button("Clear", buttonClickEvent -> { clearForm(); })); content.add(buttons); return content; }