use of com.vaadin.flow.component.textfield.TextArea in project alibaba-rsocket-broker by alibaba.
the class JwtGeneratorView method makeGeneratorForm.
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;
}
use of com.vaadin.flow.component.textfield.TextArea in project alibaba-rsocket-broker by alibaba.
the class ServiceTestingView method makeServiceCallForm.
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;
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class HasLabelTest method textArea.
@Test
public void textArea() {
TextArea c = new TextArea();
Assert.assertTrue(c instanceof HasLabel);
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaTest method patternPropertyValue.
@Test
public void patternPropertyValue() {
String testPattern = "TEST";
TextArea textArea = new TextArea();
textArea.setPattern(testPattern);
assertEquals(testPattern, textArea.getPattern());
assertEquals(testPattern, textArea.getElement().getProperty("pattern", ""));
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaTest method clearButtonVisiblePropertyValue.
@Test
public void clearButtonVisiblePropertyValue() {
TextArea textArea = new TextArea();
assertClearButtonPropertyValueEquals(textArea, true);
assertClearButtonPropertyValueEquals(textArea, false);
}
Aggregations