Package org.apache.click.control

Examples of org.apache.click.control.Field


     * @see org.apache.click.control.Table#setPageNumber(int)
     *
     * @param pageNumber set the currently displayed page number
     */
    public void setPageNumber(int pageNumber) {
        Field field = (Field) getForm().getFields().get(PAGE);
        if (field != null) {
            field.setValue(Integer.toString(pageNumber));
        }
        super.setPageNumber(pageNumber);
    }
View Full Code Here


        ActionLink controlLink = getControlLink();

        boolean continueProcessing = super.onProcess();

        if (!controlLink.isClicked() && getForm().isFormSubmission()) {
            Field pageField = getForm().getField(PAGE);
            pageField.onProcess();
            if (StringUtils.isNotBlank(pageField.getValue())) {
                setPageNumber(Integer.parseInt(pageField.getValue()));
            }

            Field columnField = getForm().getField(COLUMN);
            columnField.onProcess();
            setSortedColumn(columnField.getValue());

            Field ascendingField = getForm().getField(ASCENDING);
            ascendingField.onProcess();
            setSortedAscending("true".equals(ascendingField.getValue()));

            // Range sanity check
            int pageNumber = Math.min(getPageNumber(), getRowList().size() - 1);
            pageNumber = Math.max(pageNumber, 0);
            setPageNumber(pageNumber);

            //Have to sort list here before we process each field. Otherwise if
            //sortRowList() is only called in Table.toString(), the fields values set here
            //will not correspond to their rows in the rowList.
            sortRowList();

            int firstRow = getFirstRow();
            int lastRow = getLastRow();

            List rowList = getRowList();
            List columnList = getColumnList();

            for (int i = firstRow; i < lastRow; i++) {
                Object row = rowList.get(i);

                for (int j = 0; j < columnList.size(); j++) {

                    Column column = (Column) columnList.get(j);

                    if (column instanceof FieldColumn) {
                        FieldColumn fieldColumn = (FieldColumn) column;
                        Field field = fieldColumn.getField();

                        field.setName(column.getName() + "_" + i);

                        field.onProcess();

                        if (field.isValid()) {
                            fieldColumn.setProperty(row, column.getName(),
                                field.getValueObject());
                        } else {
                            getForm().setError(getMessage("formtable-error"));
                        }
                    }
                }
View Full Code Here

     *
     * @see org.apache.click.control.Form#clearValues()
     */
    public void clearValues() {
        List fields = ContainerUtils.getInputFields(this);
        Field field = null;
        for (int i = 0, size = fields.size(); i < size; i++) {
            field = (Field) fields.get(i);

            if (!field.getName().equals(FORM_NAME)
                && !field.getName().startsWith(SUBMIT_CHECK)
                && !field.getName().startsWith(FO_CLASS)) {
                field.setValue(null);
            }
        }
    }
View Full Code Here

            // Clear any form data
            oidField.setValueObject(null);

            List fields = ContainerUtils.getInputFields(this);
            for (int i = 0; i < fields.size(); i++) {
                Field field = (Field) fields.get(i);
                if (field instanceof HiddenField == false) {
                    field.setValue("");
                }
            }
        }
    }
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

            String fieldName = objAttribute.getName();
            if (relationshipName != null) {
                fieldName = relationshipName + "." + fieldName;
            }

            Field field = getField(fieldName);

            if (field != null) {
                if (!field.isRequired() && dbAttribute.isMandatory()) {
                    if (!(field instanceof Checkbox)) {
                        field.setRequired(true);
                    }
                }

                int maxlength = dbAttribute.getMaxLength();
                if (maxlength != -1) {
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

     * @see org.apache.click.control.Form#clearValues()
     */
    @Override
    public void clearValues() {
        List fields = ContainerUtils.getInputFields(this);
        Field field = null;
        for (int i = 0, size = fields.size(); i < size; i++) {
            field = (Field) fields.get(i);

            if (!field.getName().equals(FORM_NAME)
                && !field.getName().startsWith(SUBMIT_CHECK)
                && !field.getName().startsWith(FO_CLASS)) {
                field.setValue(null);
            }
        }
    }
View Full Code Here

            String fieldName = objAttribute.getName();
            if (relationshipName != null) {
                fieldName = relationshipName + "." + fieldName;
            }

            Field field = form.getField(fieldName);

            if (field != null) {
                if (!field.isRequired() && dbAttribute.isMandatory()) {
                    if (!(field instanceof Checkbox)) {
                        field.setRequired(true);
                    }
                }

                int maxlength = dbAttribute.getMaxLength();
                if (maxlength != -1) {
View Full Code Here

    @Override
    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

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.