Package org.apache.empire.commons

Examples of org.apache.empire.commons.Options


    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();
        if (isAllowNull())
        { // Empty entry
            options = new Options(options);
            addSelectItem(input, textResolver, new OptionEntry("", getNullText()));
        }
        for (OptionEntry e : options)
        { // Option entries
            addSelectItem(input, textResolver, e);
View Full Code Here

    @Override
    protected String formatValue(Object value, ValueInfo vi, boolean hasError)
    {
        // Lookup and Print value
        Options options = vi.getOptions();
        if (options != null && !options.isEmpty())
        { // 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

    } catch (IllegalAccessException e2) {
      throw new InternalException(e2);
    }
        copyAttributes(parent, ii, input);

        Options options = ii.getOptions();
        if (ii.isRequired()==false)
        {   // Empty entry
            options = new Options(options);
            addSelectItem(input, ii, new OptionEntry("", getNullText(ii)));
        }
        if (options!=null && options.size()>0)
        {   // Add options
            for (OptionEntry e : options)
            { // Option entries
                addSelectItem(input, ii, e);
            }
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

            // Set timestamp column for save updates
            setTimestampColumn(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");
            GENDER.setOptions(genders);
            GENDER.setControlType("select");

            Options retireds = new Options();
            retireds.set("N", "!option.employee.retired.true");
            retireds.set("F", "!option.employee.retired.false");
            RETIRED.setOptions(retireds);
            RETIRED.setControlType("checkbox");
           
            // Set special control types
            DEPARTMENT_ID.setControlType("select");
View Full Code Here

     * @return the formatted value
     */
    protected String formatValue(Object value, ValueInfo vi, boolean hasError)
    {
        // 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[] { FIRSTNAME, LASTNAME, DATE_OF_BIRTH });
            // Set timestamp column for save updates
            setTimestampColumn(UPDATE_TIMESTAMP);

            // Create Options for GENDER column
            Options genders = new Options();
            genders.set("M", "Male");
            genders.set("F", "Female");
            GENDER.setOptions(genders);
        }
View Full Code Here

    }
    super.validate(context);
  }

  private void addSelectItems(UIComponent component) {
    Options options = getRecord().getFieldOptions(getColumn());
    if (options != null) {
      Iterator<OptionEntry> optionsIterator = options.iterator();
      while (optionsIterator.hasNext()) {
        OptionEntry optionEntry = optionsIterator.next();
        UISelectItem selectItem = new UISelectItem();
        selectItem.setItemValue(optionEntry.getValueString());
        selectItem.setItemLabel(FacesUtils.getMessageForKey(optionEntry
View Full Code Here

     * @param conn a valid connection to the database.
     * @return an Options object containing a set a of values and their corresponding names
     */
    public Options queryOptionList(String sqlCmd, Connection conn)
    {   // Execute the  Statement
        Options options = new Options();
        queryOptionList(sqlCmd, conn, options);
        return options;
    }
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.