Package org.apache.click.control

Examples of org.apache.click.control.Field


        Options options = (Options) ExampleUtils.getSessionObject(Options.class);

        form.setJavaScriptValidation(options.javaScriptValidate);
        List formFiels = ContainerUtils.getInputFields(form);
        for (Iterator i = formFiels.iterator(); i.hasNext();) {
            Field field = (Field) i.next();
            field.setRequired(options.allFieldsRequired);
        }

        allFieldsRequired.setChecked(options.allFieldsRequired);
        jsValidate.setChecked(options.javaScriptValidate);
    }
View Full Code Here


            String[] propertyNames = metadata.getPropertyNames();

            boolean[] propertyNullability = metadata.getPropertyNullability();

            for (int i = 0; i < propertyNames.length; i++) {
                Field field = getField(propertyNames[i]);
                if (field != null) {
                    boolean isMandatory = !propertyNullability[i];
                    if (!field.isRequired() && isMandatory) {
                        if (!(field instanceof Checkbox)) {
                            field.setRequired(true);
                        }
                    }
                }
            }
View Full Code Here

    protected void renderTableDataContent(Object row, HtmlStringBuffer buffer,
            Context context, int rowIndex) {

        Object columnValue = getProperty(row);

        Field field = getField();

        //fallback to super implementation
        if (field == null) {
            super.renderTableDataContent(row, buffer, context, rowIndex);
            return;
        }

        field.setName(getName() + "_" + rowIndex);

        if (getTable() instanceof FormTable) {
            FormTable formTable = (FormTable) getTable();
            Form form = formTable.getForm();

            if (formTable.getRenderSubmittedValues()
                && !formTable.getControlLink().isClicked()
                && form.isFormSubmission()) {

                field.onProcess();

                if (field.getError() != null) {
                    field.setTitle(field.getError());
                }

            } else {
                field.setTitle(null);
                field.setError(null);
                field.setValueObject(columnValue);
            }

            if (getDecorator() != null) {
                Object value = getDecorator().render(row, context);
                if (value != null) {
                    buffer.append(value);
                }

            } else {
                getField().render(buffer);
            }

        } else {
            field.setValueObject(columnValue);

            if (getDecorator() != null) {
                Object value = getDecorator().render(row, context);
                if (value != null) {
                    buffer.append(value);
                }

            } else {
                getField().render(buffer);
            }
        }

        field.setValue(null);
    }
View Full Code Here

     */
    protected void renderContent(HtmlStringBuffer buffer) {
        // Render hidden fields
        List fields = ContainerUtils.getInputFields(this);
        for (Iterator it = fields.iterator(); it.hasNext();) {
            Field field = (Field) it.next();
            if (field.isHidden()) {
                field.render(buffer);
                buffer.append("\n");
            }
        }
        renderChildren(buffer);
    }
View Full Code Here

            for (int i = 0; i < getControls().size(); i++) {
                Control control = (Control) getControls().get(i);

                // Don't render hidden fields again.
                if (control instanceof Field) {
                    Field field = (Field) control;
                    if (field.isHidden()) {
                        continue;
                    }
                }
                int before = buffer.length();
                control.render(buffer);
View Full Code Here

        boolean result = super.onProcess();

        if (!isValid()) {
            List errorFields = getErrorFields();
            if (!errorFields.isEmpty()) {
                Field field = (Field) errorFields.get(0);
                int sheetNumber = getTabSheetNumber(field.getName());
                setDisplayTab(sheetNumber);
            }
        }

        return result;
View Full Code Here

        int lastRow = getLastRow();

        for (int i = 0; i < getColumnList().size(); i++) {
            Column column = (Column) getColumnList().get(i);
            if (column instanceof FieldColumn) {
                Field field = ((FieldColumn) column).getField();

                for (int j = firstRow; j < lastRow; j++) {
                    field.setName(column.getName() + "_" + j);

                    htmlImports = field.getHtmlImports();
                    if (htmlImports != null) {
                        buffer.append(htmlImports);
                    }
                }
            }
View Full Code Here

            int lastRow = getLastRow();

            for (int i = 0; i < getColumnList().size(); i++) {
                Column column = (Column) getColumnList().get(i);
                if (column instanceof FieldColumn) {
                    Field field = ((FieldColumn) column).getField();

                    for (int j = firstRow; j < lastRow; j++) {
                        field.setName(column.getName() + "_" + j);

                        headElements.addAll(field.getHeadElements());
                    }
                }
            }
        }
        return headElements;
View Full Code Here

     * @see org.apache.click.control.Table#setSortedColumn(java.lang.String)
     *
     * @param columnName the name of the sorted column
     */
    public void setSortedColumn(String columnName) {
        Field field = (Field) getForm().getFields().get(COLUMN);
        if (field != null) {
            field.setValue(columnName);
        }
        setSorted(false);
        super.setSortedColumn(columnName);
    }
View Full Code Here

     * @see org.apache.click.control.Table#setSortedAscending(boolean)
     *
     * @param ascending the ascending sort order status
     */
    public void setSortedAscending(boolean ascending) {
        Field field = (Field) getForm().getFields().get(ASCENDING);
        if (field != null) {
            field.setValue(Boolean.toString(ascending));
        }
        setSorted(false);
        super.setSortedAscending(ascending);
    }
View Full Code Here

TOP

Related Classes of org.apache.click.control.Field

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.