Package org.xhtmlrenderer.simple.xhtml

Examples of org.xhtmlrenderer.simple.xhtml.FormControlAdapter


                            .getSelectionIndex()));
                    }
                }
            });

            sc.addFormControlListener(new FormControlAdapter() {
                public void changed(FormControl control) {
                    if (sc.isSuccessful()) {
                        if (sc.isMultiple()) {
                            String[] values = sc.getMultipleValues();
                            int[] indices = new int[values.length];
                            for (int i = 0; i < values.length; i++) {
                                indices[i] = _values.indexOf(values[i]);
                            }
                            list.setSelection(indices);
                        } else {
                            list.setSelection(_values.indexOf(sc.getValue()));
                        }
                    } else {
                        list.deselectAll();
                    }
                }

                public void successful(FormControl control) {
                    changed(control);
                }
            });

            if (sc.isSuccessful()) {
                if (sc.isMultiple()) {
                    String[] values = sc.getMultipleValues();
                    int[] indices = new int[values.length];
                    for (int i = 0; i < values.length; i++) {
                        indices[i] = _values.indexOf(values[i]);
                    }
                    list.setSelection(indices);
                } else {
                    list.setSelection(_values.indexOf(sc.getValue()));
                }
            }

            return list;
        } else {
            _combo = true;

            final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
            combo.setItems((String[]) _labels
                .toArray(new String[_labels.size()]));

            combo.addSelectionListener(new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    int selection = combo.getSelectionIndex();
                    if (selection < 0) {
                        sc.setSuccessful(false);
                    } else {
                        sc.setValue((String) _values.get(selection));
                    }
                }
            });

            sc.addFormControlListener(new FormControlAdapter() {
                public void changed(FormControl control) {
                    if (sc.isSuccessful()) {
                        combo.select(_values.indexOf(sc.getValue()));
                    } else {
                        combo.deselectAll();
View Full Code Here


        String title = control.getElement().getAttribute("title");
        if (title.length() != 0) {
            _swtControl.setToolTipText(title);
        }
        // enable/disable handler
        control.addFormControlListener(new FormControlAdapter() {
            public void enabled(FormControl control) {
                _swtControl.setEnabled(control.isEnabled());
            }
        });
    }
View Full Code Here

        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;
View Full Code Here

                    cc.setSuccessful(button.getSelection());
                }
            }
        });

        cc.addFormControlListener(new FormControlAdapter() {
            public void successful(FormControl control) {
                button.setSelection(control.isSuccessful());
            }
        });
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.simple.xhtml.FormControlAdapter

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.