Example usage for com.vaadin.ui TextArea setRows

List of usage examples for com.vaadin.ui TextArea setRows

Introduction

In this page you can find the example usage for com.vaadin.ui TextArea setRows.

Prototype

public void setRows(int rows) 

Source Link

Document

Sets the number of rows in the text area.

Usage

From source file:edu.nps.moves.mmowgli.modules.administration.CallToActionGameDesignPanel.java

License:Open Source License

public CallToActionGameDesignPanel(MovePhase phase, AuxiliaryChangeListener auxLis, GameDesignGlobals globs) {
    super(false, globs);

    addEditComponent("1 Video", "MovePhase.callToActionBriefingVideo",
            vidComp = new VideoChangerComponent(phase, "setCallToActionBriefingVideo",
                    phase.getCallToActionBriefingVideo(), globs)).auxListener = auxLis;
    addEditLine("2 Summary", "MovePhase.callToActionBriefingSummary", phase, phase.getId(),
            "CallToActionBriefingSummary").auxListener = auxLis;
    EditLine edLine = addEditLine("3 Text ", "MovePhase.callToActionBriefingText", phase, phase.getId(),
            "CallToActionBriefingText");
    TextArea ta = (TextArea) edLine.ta;
    ta.setRows(12);
    edLine.auxListener = auxLis;/*  ww w.ja  va 2  s.co  m*/
}

From source file:edu.nps.moves.mmowgli.modules.administration.GameLinksGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public GameLinksGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    setWidth("100%");

    GameLinks links = GameLinks.getTL();
    //@formatter:off    
    ((TextArea) addEditLine("1 Action plan request link", "GameLinks.actionPlanRequestLink", links,
            links.getId(), "ActionPlanRequestLink").ta).setRows(1);
    ((TextArea) addEditLine("2 FOUO link", "GameLinks.fouoLink", links, links.getId(), "FouoLink").ta)
            .setRows(1);/*from   ww  w .  j  av a 2 s. c o m*/
    ((TextArea) addEditLine("3 Game email sender", "GameLinks.gameFromEmail", links, links.getId(),
            "GameFromEmail").ta).setRows(1);
    ((TextArea) addEditLine("4 Game-full link", "GameLinks.gameFullLink", links, links.getId(),
            "GameFullLink").ta).setRows(1);
    ((TextArea) addEditLine("5 Game home URL", "GameLinks.gameHomeUrl", links, links.getId(), "GameHomeUrl").ta)
            .setRows(1);
    TextArea ta = ((TextArea) addEditLine("6 How-to-play link", "GameLinks.howToPlayLink", links, links.getId(),
            "HowToPlayLink").ta);
    ta.setRows(1);
    ta.setInputPrompt("An empty entry signifies default behavior");
    ta.setNullRepresentation("");
    ta.setNullSettingAllowed(true);
    ((TextArea) addEditLine("7 Improve your score link", "GameLinks.improveScoreLink", links, links.getId(),
            "ImproveScoreLink").ta).setRows(1);
    ((TextArea) addEditLine("8 Informed consent link", "GameLinks.informedConsentLink", links, links.getId(),
            "InformedConsentLink").ta).setRows(2);
    ((TextArea) addEditLine("9 Map link", "GameLinks.mmowgliMapLink", links, links.getId(),
            "MmowgliMapLink").ta).setRows(4);
    ((TextArea) addEditLine("10 Survey consent link", "GameLinks.surveyConsentLink", links, links.getId(),
            "SurveyConsentLink").ta).setRows(2);
    ((TextArea) addEditLine("11 Thanks for interest link", "GameLinks.thanksForInterestLink", links,
            links.getId(), "ThanksForInterestLink").ta).setRows(1);
    ((TextArea) addEditLine("12 Thanks for playing link", "GameLinks.thanksForPlayingLink", links,
            links.getId(), "ThanksForPlayingLink").ta).setRows(1);
    ((TextArea) addEditLine("13 Trouble mail-to address", "GameLinks.troubleMailto", links, links.getId(),
            "TroubleMailto").ta).setRows(2);
    ((TextArea) addEditLine("14 User agreement link", "GameLinks.userAgreementLink", links, links.getId(),
            "UserAgreementLink").ta).setRows(1);
    //@formatter:off
}

From source file:edu.nps.moves.mmowgli.modules.administration.MapGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
@SuppressWarnings("serial")
public MapGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    Game g = Game.getTL();//from   w w w.  j  a va2  s.  c  om
    TextArea titleTA;
    final Serializable uid = Mmowgli2UI.getGlobals().getUserID();

    titleTA = (TextArea) addEditLine("Map Title", "Game.mapTitle", g, g.getId(), "MapTitle").ta;
    titleTA.setValue(g.getMapTitle());
    titleTA.setRows(1);

    latTA = addEditLine("Map Initial Latitude", "Game.mmowgliMapLatitude");
    boolean lastRO = latTA.isReadOnly();
    latTA.setReadOnly(false);
    latTA.setValue("" + g.getMapLatitude());
    latTA.setRows(1);
    latTA.setReadOnly(lastRO);
    latTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                double lat = Double.parseDouble(val);
                Game g = Game.getTL();
                g.setMapLatitude(lat);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map latitude", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper decimal format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });

    lonTA = addEditLine("Map Initial Longitude", "Game.mmowgliMapLongitude");
    lastRO = lonTA.isReadOnly();
    lonTA.setReadOnly(false);
    lonTA.setValue("" + g.getMapLongitude());
    lonTA.setRows(1);
    lonTA.setReadOnly(lastRO);
    lonTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            //System.out.println("lon valueChange");
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                double lon = Double.parseDouble(val);
                Game g = Game.getTL();
                g.setMapLongitude(lon);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map longitude", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper decimal format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });

    zoomTA = addEditLine("Map Initial Zoom", "Game.mmowgliMapZoom");
    lastRO = zoomTA.isReadOnly();
    zoomTA.setReadOnly(false);
    zoomTA.setValue("" + g.getMapZoom());
    zoomTA.setRows(1);
    zoomTA.setReadOnly(lastRO);
    zoomTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                int zoom = Integer.parseInt(val);
                Game g = Game.getTL();
                g.setMapZoom(zoom);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map zoom", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "Check for proper integer format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });
    Button b;
    this.addComponentLine(b = new Button("Set to generic Mmowgli Map Defaults", new MapDefaultSetter()));
    b.setEnabled(!globs.readOnlyCheck(false));
}

From source file:edu.nps.moves.mmowgli.modules.administration.ReportsGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
@SuppressWarnings("serial")
public ReportsGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    Game g = Game.getTL();/*from  w ww  .ja va  2s.c o  m*/
    long period = g.getReportIntervalMinutes();

    TextArea ta;

    ta = addEditLine("1 Game Reports publishing interval (minutes)", "Game.reportIntervalMinutes");
    boolean lastRO = ta.isReadOnly();
    ta.setReadOnly(false);
    ta.setValue("" + period);
    ta.setRows(1);
    ta.setReadOnly(lastRO);
    ta.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            //System.out.println("msid valueChange");
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                long lg = Long.parseLong(val);
                if (lg < 0)
                    throw new Exception();

                MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
                Game gm = Game.getTL(1L);
                gm.setReportIntervalMinutes(lg);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Report interval", "" + "" + lg, globs.getUserID());

                // Wake it up
                AppMaster.instance().pokeReportGenerator();
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper positive integer format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });
    addEditBoolean("2 Indicate PDF reports available", "Game.pdfAvailable", g, 1L, "PdfAvailable");
    addEditBoolean("2 Show hidden cards", "Game.reportsShowHiddenCards", g, 1L, "ReportsShowHiddenCards");
}

From source file:edu.nps.moves.mmowgli.modules.administration.ScoringGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public ScoringGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    Game g = Game.getTL();//from w  ww.  ja  v a 2  s.c  o  m
    TextArea ta = (TextArea) addEditLine("Card authorship points", "Game.cardAuthorPoints", g, 1L,
            "CardAuthorPoints", null, Float.class, "Points for the author on card creation").ta;
    ta.setValue("" + g.getCardAuthorPoints());
    setupFloatValueListener(ta);
    ta.setRows(1);

    ta = (TextArea) addEditLine("Card ancestor points", "Game.cardAncestorPoints", g, 1L, "CardAncestorPoints",
            null, Float.class, "Point bonus (adjusted by factor below) for card parents").ta;
    ta.setValue("" + g.getCardAncestorPoints());
    setupFloatValueListener(ta);
    ta.setRows(1);

    ta = (TextArea) addEditLine("Card ancestor generation factors", "Game.cardAncestorPointsGenerationFactors",
            g, 1L, "CardAncestorPointsGenerationFactors", null, String.class,
            "Factors multiplied by ancestor points to calculate ancestor card points").ta;
    ta.setValue(g.getCardAncestorPointsGenerationFactors());
    setupFactorsListener(ta);
    ta.setRows(1);
    /*
        addEditBoolean("Earliest ancestor highest reward", "Game.cardAncestorEarlyPointsBias", g, 1L, "CardAncestorEarlyPointsBias",
            "Default is ON, meaning the ancestor increment factor favors the author of earliest card instead of the nearest ancestor card");
    */
    addSeparator();

    ta = (TextArea) addEditLine("Card super-interesting bonus points", "Game.cardSuperInterestingPoints", g, 1L,
            "CardSuperInterestingPoints", null, Float.class,
            "Points added to card author when card is marked super-interesting (points removed if card unmarked)").ta;
    ta.setValue("" + g.getCardSuperInterestingPoints());
    setupFloatValueListener(ta);
    ta.setRows(1);

    if (Game.getTL().isActionPlansEnabled()) {
        addSeparator();

        ta = (TextArea) addEditLine("Action plan authorship points", "Game.actionPlanAuthorPoints", g, 1L,
                "ActionPlanAuthorPoints", null, Float.class,
                "Points awarded to players who accept action plan authorship invitations").ta;
        ta.setValue("" + g.getActionPlanAuthorPoints());
        setupFloatValueListener(ta);
        ta.setRows(1);

        //    ta = (TextArea)addEditLine("Action plan thumb points", "Game.actionPlanThumbPoints", g, 1L, "ActionPlanThumbPoints",null,Float.class,
        //        "Point bonus (adusted by factor) based on ").ta;
        //    ta.setValue(g.getActionPlanThumbPoints());
        //    ta.setRows(1);
        //
        ta = (TextArea) addEditLine("Action plan thumb factor", "Game.actionPlanThumbFactor", g, 1L,
                "ActionPlanThumbFactor", null, Float.class,
                "A point bonus for each plan author is calulated by the product of this factor and total user thumb ratings").ta;
        ta.setValue("" + g.getActionPlanThumbFactor());
        setupFloatValueListener(ta);
        ta.setRows(1);

        ta = (TextArea) addEditLine("Action plan comment points", "Game.actionPlanCommentPoints", g, 1L,
                "ActionPlanCommentPoints", null, Float.class,
                "Point bonus for each plan author when a non-author comment is entered").ta;
        ta.setValue("" + g.getActionPlanCommentPoints());
        setupFloatValueListener(ta);
        ta.setRows(1);

        ta = (TextArea) addEditLine("Action plan rater points", "Game.actionPlanRaterPoints", g, 1L,
                "ActionPlanRaterPoints", null, Float.class,
                "Point bonus to player for first rating an action plan -- removed if unrated").ta;
        ta.setValue("" + g.getActionPlanRaterPoints());
        setupFloatValueListener(ta);
        ta.setRows(1);

        ta = (TextArea) addEditLine("Action plan commenter points", "Game.userActionPlanCommentPoints", g, 1L,
                "UserActionPlanCommentPoints", null, Float.class,
                "Point bonus for commenter when posting a comment to an action plan.").ta;
        ta.setValue("" + g.getUserActionPlanCommentPoints());
        setupFloatValueListener(ta);
        ta.setRows(1);
    }
    /*
        addSeparator();
            
        ta = (TextArea)addEditLine("Action plan super-interesting bonus points", "Game.cardSuperInterestingPoints", g, 1L, "CardSuperInterestingPoints",null,Float.class,
            "Point bonus for each plan author when a plan is marked \"super-interesting\" by a game-master (points removed if plan unmarked)").ta;
        ta.setValue(g.getCardSuperInterestingPoints());
        setupFloatValueListener(ta);
        ta.setRows(1);
    */
    addSeparator();

    ta = (TextArea) addEditLine("New user bonus for answering registration question",
            "Game.userSignupAnswerPoints", g, 1L, "UserSignupAnswerPoints", null, Float.class,
            "Point bonus if a new user chooses to answer the optional question posed during the registration process").ta;
    ta.setValue("" + g.getUserSignupAnswerPoints());
    setupFloatValueListener(ta);
    ta.setRows(1);
}

From source file:edu.nps.moves.mmowgli.modules.administration.SignupHTMLGameDesignPanel.java

License:Open Source License

public SignupHTMLGameDesignPanel(MovePhase phase, AuxiliaryChangeListener auxLis, GameDesignGlobals globs) {
    super(false, globs);
    addEditComponent("Signup page header image", "MovePhase.signupHeaderImage",
            imgComponent = new SignupImageTextFieldWithDefaultButton(phase, globs));

    EditLine edLine = addEditLine("Signup page HTML", "MovePhase.signupText", phase, phase.getId(),
            "SignupText");
    TextArea ta = (TextArea) edLine.ta;
    ta.setRows(25);
    edLine.auxListener = auxLis;/*from  w  w  w.  ja  v  a  2  s .co  m*/

    addThirdColumnComponent(makeButton("Show signup HTML", new RenderListener(ta)));
}

From source file:edu.nps.moves.mmowgli.modules.administration.WelcomeScreenGameDesignPanel.java

License:Open Source License

public WelcomeScreenGameDesignPanel(MovePhase phase, AuxiliaryChangeListener auxLis, GameDesignGlobals globs) {
    super(false, globs);

    addEditComponent("1 Video", "MovePhase.orientationVideo", vidComp = new VideoChangerComponent(phase,
            "setOrientationVideo", phase.getOrientationVideo(), globs)).auxListener = auxLis;
    addEditLine("2 Text", "MovePhase.orientationCallToActionText", phase, phase.getId(),
            "OrientationCallToActionText").auxListener = auxLis;
    EditLine edLine = addEditLine("3 Headline", "MovePhase.orientationHeadline", phase, phase.getId(),
            "OrientationHeadline");
    TextArea ta = (TextArea) edLine.ta;
    ta.setRows(12); // bump up from default of 2
    edLine.auxListener = auxLis;//  w w w.j a va2 s.com
    addEditLine("3 Summary", "MovePhase.orientationSummary", phase, phase.getId(),
            "OrientationSummary").auxListener = auxLis;
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.DefineAwardsDialog.java

License:Open Source License

private TextArea makeTa(String val) {
    TextArea tf = new TextArea();
    tf.setRows(2);
    tf.setValue(val);
    tf.setWidth("100%");
    return tf;//from ww  w.  ja v a 2s. c o  m
}

From source file:eu.lod2.EPoolPartyExtractor.java

License:Apache License

public EPoolPartyExtractor(LOD2DemoState st) {

    // The internal state 
    state = st;/*w  ww.java2 s  .c o  m*/

    // second component
    VerticalLayout panel = new VerticalLayout();

    Label description = new Label(
            "This service will identify text elements (tags) which correspond to concepts in a given controlled vocabulary using the PoolParty Extractor (PPX).\n"
                    + "At the moment we have fixed the controlled vocabulary to be the Social Semantic Web thesaurus also available at CKAN.\n"
                    + "The identified concepts will be inserted as triples in the current graph.\n");
    panel.addComponent(description);

    Form t2f = new Form();
    t2f.setDebugId(this.getClass().getSimpleName() + "_t2f");
    exportGraph = new ExportSelector3(state, true);
    exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph");
    t2f.getLayout().addComponent(exportGraph);

    ppProjectId = new TextField("PoolParty project Id:");
    ppProjectId.setDebugId(this.getClass().getSimpleName() + "_ppProjectId");
    ppProjectId.setDescription(
            "The unique identifier of the PoolParty project to use for the extraction (usually a UUID like d06bd0f8-03e4-45e0-8683-fed428fca242) ");
    t2f.getLayout().addComponent(ppProjectId);

    textLanguage = new ComboBox("Language of the text:");
    textLanguage.setDebugId(this.getClass().getSimpleName() + "_textLanguage");
    textLanguage
            .setDescription("This is the language of the text. Language can be en (english) or de (german).");
    textLanguage.addItem("en");
    textLanguage.addItem("de");
    t2f.getLayout().addComponent(textLanguage);

    TextArea textToAnnotateField = new TextArea("text:");
    textToAnnotateField.setDebugId(this.getClass().getSimpleName() + "_textToAnnotateField");
    textToAnnotateField.setImmediate(false);
    textToAnnotateField.addListener(this);
    textToAnnotateField.setWidth("100%");
    textToAnnotateField.setRows(10);
    t2f.getLayout().addComponent(textToAnnotateField);

    // initialize the footer area of the form
    HorizontalLayout t2ffooterlayout = new HorizontalLayout();
    t2f.setFooter(t2ffooterlayout);

    annotateButton = new Button("Extract concepts", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            annotateText(event);
        }
    });
    annotateButton.setDebugId(this.getClass().getSimpleName() + "_annotateButton");
    annotateButton
            .setDescription("Extract the relevant concepts w.r.t. the controlled vocabulary in PoolParty");
    annotateButton.setEnabled(false);

    t2f.getFooter().addComponent(annotateButton);

    panel.addComponent(t2f);

    // The composition root MUST be set
    setCompositionRoot(panel);
}

From source file:eu.lod2.EPoolPartyLabel.java

License:Apache License

public EPoolPartyLabel(LOD2DemoState st) {

    // The internal state 
    state = st;/*  w ww. j a v a2  s  . co m*/

    // second component
    VerticalLayout panel = new VerticalLayout();

    Label description = new Label(
            "This service will identify text elements (tags) which correspond to concepts in a given controlled vocabulary using the PoolParty Extractor (PPX).\n"
                    + "At the moment we have fixed the controlled vocabulary to be the Social Semantic Web thesaurus also available at CKAN.\n"
                    + "The identified concepts will be inserted as triples in the current graph.\n");
    panel.addComponent(description);

    Form t2f = new Form();
    t2f.setDebugId(this.getClass().getSimpleName() + "_t2f");
    exportGraph = new ExportSelector3(state);
    exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph");
    t2f.getLayout().addComponent(exportGraph);

    ppProjectId = new TextField("PoolParty project Id:");
    ppProjectId.setDebugId(this.getClass().getSimpleName() + "_ppProjectId");
    ppProjectId.setDescription(
            "The unique identifier of the PoolParty project to use for the extraction (usually a UUID like d06bd0f8-03e4-45e0-8683-fed428fca242) ");
    t2f.getLayout().addComponent(ppProjectId);

    textLanguage = new ComboBox("Language of the text:");
    textLanguage.setDebugId(this.getClass().getSimpleName() + "_textLanguage");
    textLanguage
            .setDescription("This is the language of the text. Language can be en (english) or de (german).");
    textLanguage.addItem("en");
    textLanguage.addItem("de");
    t2f.getLayout().addComponent(textLanguage);

    TextArea textToAnnotateField = new TextArea("text:");
    textToAnnotateField.setDebugId(this.getClass().getSimpleName() + "_textToAnnotateField");
    textToAnnotateField.setImmediate(false);
    textToAnnotateField.addListener(this);
    textToAnnotateField.setWidth("100%");
    textToAnnotateField.setRows(10);
    t2f.getLayout().addComponent(textToAnnotateField);

    // initialize the footer area of the form
    HorizontalLayout t2ffooterlayout = new HorizontalLayout();
    t2f.setFooter(t2ffooterlayout);

    annotateButton = new Button("Extract concepts", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            annotateText(event);
        }
    });
    annotateButton.setDebugId(this.getClass().getSimpleName() + "_annotateButton");
    annotateButton
            .setDescription("Extract the relevant concepts w.r.t. the controlled vocabulary in PoolParty");
    annotateButton.setEnabled(false);

    t2f.getFooter().addComponent(annotateButton);

    panel.addComponent(t2f);

    // The composition root MUST be set
    setCompositionRoot(panel);
}