@Override public void execute(final ActionEvent event) { String html = htmlEditor.getText(); injectedHtml.setText(html); } });
@Override public void execute(final ActionEvent event) { comment2.setText(textComment.getText()); } });
/** * Appends the given text to the console. * * @param text the text to append */ private void appendToConsole(final String text) { console.setText(console.getText() + text); }
/** * {@inheritDoc} */ @Override public void handleRequest(final Request request) { // A dodgy example of using the unsaved changes flag on the // cancel button. String t1 = textField.getText(); String t2 = textArea.getText(); boolean hasChanges = (t1 != null && t1.length() > 0) || (t2 != null && t2.length() > 0); this.cancelBtn.setUnsavedChanges(hasChanges); }
@Override public void execute(final ActionEvent event) { String txt = txtAdd.getText(); if (!Util.empty(txt)) { // NOTE: one would NOT usually unencode content from a user input: this is VERY dangerous. messageBox.addMessage(false, txt.trim()); applySettings(); } } });
@Override public void execute(final ActionEvent event) { styled.reset(); styled.setType((WStyledText.Type) type.getSelected()); styled.setWhitespaceMode((WStyledText.WhitespaceMode) mode.getSelected()); styled.setText(text.getText()); styled.setHtmlClass(useBigTextClass.isSelected() ? "bigText" : null); styled.setEncodeText(cbEncodeText.isSelected()); // text.setRichTextArea(cbEncodeText.isSelected()); } });
@Test public void testNoSanitizeOnOutput() { String input = "<form>content</form>"; WTextArea textArea = new WTextArea(); textArea.setData(input); textArea.setSanitizeOnOutput(false); // do not setRichText until after setData otherwise content will be sanitized on setData textArea.setRichTextArea(true); Assert.assertEquals("Expect output to not be sanitized", input, textArea.getText()); }
@Test public void testSanitizeOnOutput() { WTextArea textArea = new WTextArea(); textArea.setData("<form>content</form>"); textArea.setSanitizeOnOutput(true); // do not setRichText until after setData otherwise content will be sanitized on setData textArea.setRichTextArea(true); Assert.assertEquals("Expect output to be sanitized", "content", textArea.getText()); }
/** * Set up the WPanel so that the appropriate items are visible based on configuration settings. */ public void updateUI() { if (!Util.empty(panelContent.getText())) { panelContentRO.setData(panelContent.getData()); } else { panelContentRO.setText(SAMPLE_CONTENT); } panel.setType((WPanel.Type) panelType.getSelected()); String headingText = tfHeading.getText(); if (!Util.empty(tfHeading.getText())) { heading.setText(tfHeading.getText()); panel.setTitleText(headingText); } else { heading.setText(SAMPLE_HEADER); panel.setTitleText(SAMPLE_TITLE_TEXT); } }
String textString = textArea.getText(); if (textString != null) { if (textArea.isReadOnly() && textArea.isRichTextArea()) {
assertXpathEvaluatesTo(field.getText(), "normalize-space(//ui:textarea)", field);