Package org.xhtmlrenderer.simple.xhtml.controls

Examples of org.xhtmlrenderer.simple.xhtml.controls.TextControl


    }

    protected Control createSWTControl(FormControl control,
            BasicRenderer parent, LayoutContext c, CalculatedStyle style,
            UserAgentCallback uac) {
        final TextControl tc = (TextControl) control;

        int sty = SWT.BORDER;
        if (tc.isMultiLine()) {
            sty |= SWT.MULTI;
        }
        if (tc.isReadOnly()) {
            sty |= SWT.READ_ONLY;
        }
        if (tc.isPassword()) {
            sty |= SWT.PASSWORD;
        }
        final Text text = new Text(parent, sty);
        text.setText(encodeDelimiter(control.getInitialValue()));

        StringBuffer str = new StringBuffer(tc.getSize());
        for (int i = 0; i < tc.getSize(); i++) {
            str.append('M');
        }
        if (tc.isMultiLine()) {
            for (int i = 1; i < tc.getRows(); i++) {
                str.append(Text.DELIMITER);
            }
        }
        _sizeText = str.toString();

        if (tc.getMaxLength() >= 0) {
            text.setTextLimit(tc.getMaxLength());
        }

        tc.addFormControlListener(new FormControlAdapter() {
            public void changed(FormControl control) {
                if (!_noChangeText) {
                    text.setText(encodeDelimiter(control.getValue()));
                }
                _noChangeText = false;
            }
        });

        text.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                _noChangeText = true;
                tc.setValue(decodeDelimiter(text.getText()));
            }
        });

        return text;
    }
View Full Code Here


        FormControl control;
        String name = e.getNodeName();
        if (name.equals("input")) {
            String type = e.getAttribute("type");
            if (type.equals("text") || type.equals("password")) {
                control = new TextControl(form, e);
            } else if (type.equals("hidden")) {
                control = new HiddenControl(form, e);
            } else if (type.equals("button") || type.equals("submit")
                    || type.equals("reset")) {
                control = new ButtonControl(form, e);
            } else if (type.equals("checkbox") || type.equals("radio")) {
                control = new CheckControl(form, e);
            } else {
                return null;
            }
        } else if (name.equals("textarea")) {
            control = new TextControl(form, e);
        } else if (name.equals("button")) {
            control = new ButtonControl(form, e);
        } else if (name.equals("select")) {
            control = new SelectControl(form, e);
        } else {
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.simple.xhtml.controls.TextControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.