Package org.apache.empire.commons

Examples of org.apache.empire.commons.Options


    protected Object formatInputValue(Object value, InputInfo ii)
    {
        if (value == null)
            return "";
        // Check options
        Options options = ii.getOptions();
        if (options != null && !options.isEmpty())
            return value;
        // Format
        return formatValue(value, ii);
    }
View Full Code Here


            copyAttributes(parent, ii, input);
            // disabled
            boolean disabled = ii.isDisabled();
            input.setDisabled(disabled);
            // Options
            Options options = ii.getOptions();
            boolean hasEmpty =(!ii.isRequired() && !(disabled && ii.getColumn().isRequired()) && !options.contains(""));
            String nullText = (hasEmpty) ? getNullText(ii) : "";
            initOptions(input, ii.getTextResolver(), options, hasEmpty, nullText);
            // add
            compList.add(input);
        }
        else
        {   // check type
            UIComponent comp = compList.get(0);
            if (!(comp instanceof HtmlSelectOneMenu))
                throw new UnexpectedReturnValueException(comp.getClass().getName(), "compList.get");
            // cast
            input = (HtmlSelectOneMenu)comp;
            // disabled
            boolean disabled = ii.isDisabled();
            input.setDisabled(disabled);
            // Options (sync)
            Options options = ii.getOptions();
            boolean hasEmpty =(!ii.isRequired() && !(disabled && ii.getColumn().isRequired()) && !options.contains(""));
            String nullText = (hasEmpty) ? getNullText(ii) : "";
            syncOptions(input, ii.getTextResolver(), options, hasEmpty, nullText);
        }

        // style
View Full Code Here

     * @return the formatted value
     */
    protected String formatValue(Object value, ValueInfo vi)
    {
        // Lookup and Print value
        Options options = vi.getOptions();
        if (options != null && !options.isEmpty() && !hasFormatOption(vi, "nolookup"))
        { // Check for Options
            String text = options.get(value);
            if (text != null)
                return vi.getText(text);
            // Error
            log.error("The element '" + String.valueOf(value) + "' is not part of the supplied option list.");
        }
View Full Code Here

            addIndex("EMPLOYEE_NAME_IDX", true, new DBColumn[] { C_FIRSTNAME, C_LASTNAME, C_DATE_OF_BIRTH });
            // Set timestamp column for save updates
            setTimestampColumn(C_UPDATE_TIMESTAMP);

            // Create Options for GENDER column
            Options genders = new Options();
            genders.set("M", "Male");
            genders.set("F", "Female");
            C_GENDER.setOptions(genders);
           
            // Define Column Expressions
            C_FULLNAME = C_LASTNAME.append(", ").append(C_FIRSTNAME).as("FULL_NAME");
           
View Full Code Here

            addIndex("PERSON_NAME_IDX", true, new DBColumn[] { C_FIRSTNAME, C_LASTNAME, C_DATE_OF_BIRTH });
            // Set timestamp column for save updates
            setTimestampColumn(C_UPDATE_TIMESTAMP);
           
            // Create Options for GENDER column
            Options genders = new Options();
            genders.set("M", "!option.employee.gender.male");
            genders.set("F", "!option.employee.gender.female");
            C_GENDER.setOptions(genders);
            C_GENDER.setControlType("select");
           
            // Set special control types
            C_DEPARTMENT_ID.setControlType("select");
View Full Code Here

                {   // Print all field values
                    if (i>0)
                        System.out.print("\t");
                    // Check if conversion is necessary
                    DBColumnExpr c = reader.getColumnExpr(i);
                    Options opt = c.getOptions();
                    if (opt!=null)
                    {   // Option Lookup
                        System.out.print(opt.get(reader.getValue(i)));
                    }
                    else
                    {   // Print String
                        System.out.print(reader.getString(i));
                    }
View Full Code Here

        int valIndex = templ.indexOf("{}");
        if (valIndex >= 0)
            value = getDataValue(true);
        // Check Options
        String text;
        Options options = getValueOptions();
        if (options != null && !hasFormat("notitlelookup"))
        { // Lookup the title
            String optValue = options.get(value);
            text = getDisplayText(optValue);
        }
        else
            text = getDisplayText(StringUtils.toString(value));
        // Check for template
View Full Code Here

                SelectInputControl control = (SelectInputControl)InputControlManager.getControl(SelectInputControl.NAME);
                // disabled
                boolean disabled = isDisabled();
                ((HtmlSelectOneMenu)inputComponent).setDisabled(disabled);
                // Options (sync)
                Options options = getOptionList();
                boolean hasEmpty = isAllowNull() && !options.contains("");
                control.syncOptions((HtmlSelectOneMenu)inputComponent, textResolver, options, hasEmpty, getNullText());
                setInputValue((HtmlSelectOneMenu)inputComponent);
            }
            else
            {   // Something's wrong here?
View Full Code Here

    private Options getOptionList()
    {
        Object options = getAttributes().get("options");
        if (!(options instanceof Options))
            return new Options();
        return ((Options) options);
    }
View Full Code Here

        String cssStyle  = TagEncodingHelper.getTagStyleClass("eSelect", null, null, userStyle);
        input.setStyleClass(cssStyle);
        // other attributes
        copyAttributes(input);
        // Options
        Options options = getOptionList();
        boolean addEmpty = isAllowNull() && !options.contains("");
        control.initOptions(input, textResolver, options, addEmpty, getNullText());
        // disabled
        boolean disabled = isDisabled();
        input.setDisabled(disabled);
        control.addRemoveDisabledStyle(input, disabled);
View Full Code Here

TOP

Related Classes of org.apache.empire.commons.Options

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.