Search in sources :

Example 21 with TextArea

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();
}
Also used : BorderLayout(com.codename1.ui.layouts.BorderLayout) Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) Button(com.codename1.ui.Button) BrowserComponent(com.codename1.ui.BrowserComponent) SplitPane(com.codename1.components.SplitPane)

Example 22 with TextArea

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();
}
Also used : BorderLayout(com.codename1.ui.layouts.BorderLayout) Form(com.codename1.ui.Form) Button(com.codename1.ui.Button) Command(com.codename1.ui.Command) TextArea(com.codename1.ui.TextArea) FileSystemStorage(com.codename1.io.FileSystemStorage) TextField(com.codename1.ui.TextField) File(com.codename1.io.File)

Example 23 with TextArea

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();
}
Also used : Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) SpanLabel(com.codename1.components.SpanLabel) Label(com.codename1.ui.Label) CommonProgressAnimations(com.codename1.ui.CommonProgressAnimations)

Example 24 with TextArea

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"));
}
Also used : BorderLayout(com.codename1.ui.layouts.BorderLayout) Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea)

Example 25 with TextArea

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())));
    }
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) Window(com.vaadin.ui.Window) NameValuePair(org.apache.http.NameValuePair) Button(com.vaadin.ui.Button) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) URI(java.net.URI) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TextArea (com.codename1.ui.TextArea)60 Form (com.codename1.ui.Form)23 Component (com.codename1.ui.Component)21 Button (com.codename1.ui.Button)16 Label (com.codename1.ui.Label)16 TextArea (com.vaadin.v7.ui.TextArea)15 Container (com.codename1.ui.Container)13 BorderLayout (com.codename1.ui.layouts.BorderLayout)12 Label (com.vaadin.ui.Label)11 ComboBox (com.vaadin.v7.ui.ComboBox)10 TextField (com.codename1.ui.TextField)9 DateComparisonValidator (de.symeda.sormas.ui.utils.DateComparisonValidator)9 DateField (com.vaadin.v7.ui.DateField)8 TextField (com.vaadin.v7.ui.TextField)8 NullableOptionGroup (de.symeda.sormas.ui.utils.NullableOptionGroup)7 RadioButton (com.codename1.ui.RadioButton)6 Field (com.vaadin.v7.ui.Field)6 BoxLayout (com.codename1.ui.layouts.BoxLayout)5 Paint (android.graphics.Paint)4 CheckBox (com.codename1.ui.CheckBox)4