use of com.vaadin.v7.ui.TextArea in project CodenameOne by codenameone.
the class SharedJavascriptContextSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", new BorderLayout());
TextArea input = new TextArea();
TextArea output = new TextArea();
output.setEditable(false);
Button execute = new Button("Run");
execute.addActionListener(evt -> {
BrowserComponent bc = CN.getSharedJavascriptContext().ready().get();
bc.execute("callback.onSuccess(window.eval(${0}))", new Object[] { input.getText() }, res -> {
output.setText(res.toString());
});
});
SplitPane split = new SplitPane(SplitPane.VERTICAL_SPLIT, input, output, "0", "50%", "99%");
hi.add(CENTER, split);
hi.add(NORTH, execute);
hi.show();
}
use of com.vaadin.v7.ui.TextArea in project CodenameOne by codenameone.
the class ListFilesTest method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", new BorderLayout());
Button add = new Button("Add Directory");
add.addActionListener(e -> {
callSerially(() -> {
Command ok = new Command("OK");
Command cancel = new Command("Cancel");
TextField fileName = new TextField("", "File Path", 20, TextField.NON_PREDICTIVE);
if (ok == Dialog.show("File Path", fileName, new Command[] { ok, cancel })) {
File f = new File(fileName.getText());
if (!f.mkdir()) {
ToastBar.showErrorMessage("Failed to create directory");
}
}
});
});
Button rename = new Button("Rename File");
rename.addActionListener(e -> {
callSerially(() -> {
Command ok = new Command("OK");
Command cancel = new Command("Cancel");
TextField fileName = new TextField("", "File Path", 20, TextField.NON_PREDICTIVE);
TextField newName = new TextField("", "New Name", 20, TextField.NON_PREDICTIVE);
if (ok == Dialog.show("File Path", BoxLayout.encloseY(fileName, newName), new Command[] { ok, cancel })) {
File f = new File(fileName.getText());
FileSystemStorage fs = FileSystemStorage.getInstance();
fs.rename(f.getPath(), newName.getText());
}
});
});
TextArea listing = new TextArea();
Button refresh = new Button("Refresh");
refresh.addActionListener(e -> {
File f = new File(FileSystemStorage.getInstance().getAppHomePath());
StringBuilder sb = new StringBuilder();
appendChildren(sb, f, 0);
listing.setText(sb.toString());
});
hi.add(BorderLayout.NORTH, FlowLayout.encloseCenter(add, rename)).add(BorderLayout.CENTER, listing).add(BorderLayout.SOUTH, refresh);
hi.show();
}
use of com.vaadin.v7.ui.TextArea in project CodenameOne by codenameone.
the class ProgressAnimationsSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
hi.add(new Label("Hi World"));
hi.add(new CommonProgressAnimations.CircleProgress());
hi.add(new CommonProgressAnimations.LoadingTextAnimation());
Label labelThatIsLoading = new Label("Loading...");
hi.add(labelThatIsLoading);
CommonProgressAnimations.CircleProgress.markComponentLoading(labelThatIsLoading);
UITimer.timer(2000, false, hi, () -> {
labelThatIsLoading.setText("Found 248 results");
CommonProgressAnimations.CircleProgress.markComponentReady(labelThatIsLoading);
});
Label anotherLabelThatIsLoading = new Label("Loading...");
hi.add(anotherLabelThatIsLoading);
CommonProgressAnimations.CircleProgress.markComponentLoading(anotherLabelThatIsLoading);
UITimer.timer(4000, false, hi, () -> {
labelThatIsLoading.setText("Found 512 results");
CommonProgressAnimations.CircleProgress.markComponentReady(anotherLabelThatIsLoading, CommonTransitions.createFade(300));
});
TextArea someText = new TextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
someText.setGrowByContent(true);
someText.setRows(4);
someText.setColumns(40);
someText.setPreferredW(Display.getInstance().getDisplayWidth());
hi.add(someText);
CommonProgressAnimations.LoadingTextAnimation.markComponentLoading(someText).cols(40).rows(5);
UITimer.timer(6000, false, hi, () -> {
CommonProgressAnimations.CircleProgress.markComponentReady(someText, CommonTransitions.createFade(300));
});
hi.show();
}
use of com.vaadin.v7.ui.TextArea in project CodenameOne by codenameone.
the class TextAreaSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", new BorderLayout());
TextArea ta = new TextArea();
hi.add(BorderLayout.CENTER, ta);
hi.show();
callSerially(() -> ta.setText("Some Text"));
}
use of com.vaadin.v7.ui.TextArea in project ANNIS by korpling.
the class AnnisUITest method shareSingleResult.
@Test
void shareSingleResult() throws Exception {
executeTokenSearch("pcc2", 399, 2);
// Activate the share window
SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
_click(_get(resultPanel, Button.class, spec -> spec.withPredicate((b) -> "Share match reference".equals(b.getDescription()))));
// Get the window which shows all the different links
Window shareWindow = _get(Window.class, spec -> spec.withCaption("Match reference link"));
TextArea linkTextField = _get(shareWindow, TextArea.class, spec -> spec.withCaption("Link for publications"));
URI shortUrl = URI.create(linkTextField.getValue());
List<NameValuePair> paramsShortUrl = URLEncodedUtils.parse(shortUrl.getQuery(), StandardCharsets.UTF_8);
assertEquals(1, paramsShortUrl.size());
assertEquals("id", paramsShortUrl.get(0).getName());
// Un-shorten the URL and examine its parts
Optional<URI> originalUrl = ui.getUrlShortener().unshorten(UUID.fromString(paramsShortUrl.get(0).getValue()));
assertTrue(originalUrl.isPresent());
if (originalUrl.isPresent()) {
List<NameValuePair> paramsOriginalUrl = URLEncodedUtils.parse(originalUrl.get().getRawQuery(), StandardCharsets.UTF_8);
assertFalse(paramsOriginalUrl.isEmpty());
assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_LEFT.equals(p.getName()) && "5".equals(p.getValue())));
assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_RIGHT.equals(p.getName()) && "5".equals(p.getValue())));
assertFalse(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_INSTANCE.equals(p.getName())));
assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_SEARCH_INTERFACE.equals(p.getName()) && p.getValue().startsWith("http://localhost:8080#_q=")));
assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_MATCH.equals(p.getName()) && "pcc2/11299#tok_1".equals(p.getValue())));
}
}
Aggregations