Examples of Field


Examples of org.apache.cocoon.forms.formmodel.Field

                }
            }
        } else if (delegate != null) {
            Widget sub = delegate.lookupWidget(id);
            if (sub instanceof Field) {
                Field field = (Field)sub;
                value = unwrap(value);
                if (value instanceof Double) {
                    // make cforms accept a JS Number
                    Class typeClass =
                        field.getFieldDefinition().getDatatype().getTypeClass();
                    if (typeClass == long.class || typeClass == Long.class) {
                        value = new Long(((Number)value).longValue());
                    } else if (typeClass == int.class || typeClass == Integer.class) {
                        value = new Integer(((Number)value).intValue());
                    } else if (typeClass == float.class || typeClass == Float.class) {
                        value = new Float(((Number)value).floatValue());
                    } else if (typeClass == short.class || typeClass == Short.class) {
                        value = new Short(((Number)value).shortValue());
                    }
                }
                field.setValue(value);
                return;
            } else if (sub instanceof BooleanField) {
                BooleanField field = (BooleanField)sub;
                value = unwrap(value);
                field.setValue(value);
            } else if (sub instanceof Output) {
                Output field = (Output)sub;
                value = unwrap(value);
                field.setValue(value);
            } else if (sub instanceof Repeater) {
                Repeater repeater = (Repeater)sub;
                if (value instanceof NativeArray) {
                    NativeArray arr = (NativeArray)value;
                    Object length = getProperty(arr, "length");
                    int len = ((Number)length).intValue();
                    for (int i = repeater.getSize(); i >= len; --i) {
                        repeater.removeRow(i);
                    }
                    for (int i = 0; i < len; i++) {
                        Object elemValue = getProperty(arr, i);
                        if (elemValue instanceof Scriptable) {
                            Scriptable s = (Scriptable)elemValue;
                            Object[] ids = s.getIds();
                            ScriptableWidget wid = wrap(repeater.getRow(i));
                            for (int j = 0; j < ids.length; j++) {
                                String idStr = ids[j].toString();
                                wid.put(idStr, wid, getProperty(s, idStr));
                            }
                        }
                    }
                    return;
                }
            } else if (sub instanceof MultiValueField) {
                MultiValueField field = (MultiValueField)sub;
                Object[] values = null;
                if (value instanceof NativeArray) {
                    NativeArray arr = (NativeArray)value;
                    Object length = getProperty(arr, "length");
                    int len = ((Number)length).intValue();
                    values = new Object[len];
                    for (int i = 0; i < len; i++) {
                        Object elemValue = getProperty(arr, i);
                        values[i] = unwrap(elemValue);
                    }
                } else if (value instanceof Object[]) {
                    values = (Object[])value;
                }
                field.setValues(values);
            } else {
                if (value instanceof Scriptable) {
                    Scriptable s = (Scriptable)value;
                    Object[] ids = s.getIds();
                    ScriptableWidget wid = wrap(sub);
View Full Code Here

Examples of org.apache.cocoon.woody.formmodel.Field

        FormDefinition formDefinition = formManager.getFormDefinition(resolver.resolveURI(formSource));
        Form form = (Form)formDefinition.createInstance();

        Repeater repeater = (Repeater)form.getWidget("contacts");
        repeater.addRow();
        Field field = (Field)repeater.getWidget(0, "firstname");
        field.setValue("Jules");

        repeater.addRow();
        field = (Field)repeater.getWidget(1, "firstname");
        field.setValue("Lucien");

        Request request = ObjectModelHelper.getRequest(objectModel);
        request.setAttribute(formAttribute, form);

        return null;
View Full Code Here

Examples of org.apache.commons.validator.Field

                final Form validatorForm = getValidatorResources().getForm(
                    Locale.getDefault(),
                    this.formId);
                if (validatorForm != null)
                {
                    final Field field = this.getFormField(validatorForm, component.getId());
                    if (field != null)
                    {
                        final Collection errors = new ArrayList();
                        this.getValidatorMethod().invoke(
                            this.getValidatorClass(),
View Full Code Here

Examples of org.apache.etch.bindings.java.msg.Field

//    Log.report( "KeepAliveInstalled",
//      "delay", delay, "count", count, "server", server );
   
    vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );

    mf_delay = new Field( "delay" );
    mf_count = new Field( "count" );
   
    mt_request = new Type( "_Etch_KeepAliveReq" );
    mt_request.putValidator( mf_delay, Validator_int.get( 0 ) );
    mt_request.putValidator( mf_count, Validator_int.get( 0 ) );
    vf.addType( mt_request );
View Full Code Here

Examples of org.apache.fulcrum.intake.model.Field

            FieldReference ref = (FieldReference)i.next();
            boolean comp_true = true;

            try
            {
                Field refField = group.get(ref.getFieldName());
               
                if (refField.isSet())
                {
                    /*
                     * Fields are processed in sequence so that our
                     * reference field might have been set but not
                     * yet validated. We check this here.
                     */
                    if (!refField.isValidated())
                    {
                        refField.validate();
                    }
                   
                    if (refField.isValid())
                    {
                        try
                        {
                            comp_true = compareCallback.compareValues(ref.getCompare(),
                                    value,
                                    refField.getValue());
                        }
                        catch (ClassCastException e)
                        {
                            throw new IntakeException("Type mismatch comparing " +
                                    value + " with " + refField.getValue(), e);
                        }
                    }
                }
            }
            catch (IntakeException e)
View Full Code Here

Examples of org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineReader.Field

      }
    }
    if (fieldList.size() == 0) {
      return null;
    }
    Field f1 = fieldList.remove(fieldList.size() - 1);
    if (fieldList.size() == 0) {
      return EnumSet.of(f1);
    } else {
      return EnumSet.of(f1, fieldList.toArray(new Field[fieldList.size()]));
    }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.TimelineReader.Field

      }
    }
    if (fieldList.size() == 0) {
      return null;
    }
    Field f1 = fieldList.remove(fieldList.size() - 1);
    if (fieldList.size() == 0) {
      return EnumSet.of(f1);
    } else {
      return EnumSet.of(f1, fieldList.toArray(new Field[fieldList.size()]));
    }
View Full Code Here

Examples of org.apache.james.mime4j.field.Field

                writer.write(boundary);
                writer.write("\r\n");
                writer.flush();
                BodyPart part = (BodyPart) bodyParts.get(i);
               
                Field cd = part.getHeader().getField(MIME.CONTENT_DISPOSITION);
                writer.write(cd.toString());
                writer.write("\r\n");
                writer.write("\r\n");
                writer.flush();
                if (writeContent) {
                    part.getBody().writeTo(out, MessageUtils.LENIENT);
View Full Code Here

Examples of org.apache.james.mime4j.parser.Field

  }

  @Override
  protected InputPart extractPart(BodyPart bodyPart) throws IOException {
    InputPart currPart = super.extractPart(bodyPart);
    Field disposition = bodyPart.getHeader().getField(
        FieldName.CONTENT_DISPOSITION);
    if (disposition == null)
      throw new RuntimeException(
          "Could find no Content-Disposition header within part");
    if (disposition instanceof ContentDispositionField) {
View Full Code Here

Examples of org.apache.james.mime4j.stream.Field

        final Header hdr = msg.getHeader();
        final String listIdRaw = hdr.getField("List-Id").getBody();
        final String listId = listIdRaw.substring(1, listIdRaw.length()-1); // remove < and >

        String msgId;
        final Field msgIdField = hdr.getField("Message-ID");
        if (msgIdField != null) {
            msgId = msgIdField.getBody();
            msgId = msgId.substring(1, msgId.length()-1);
        } else {
            msgId = Integer.toHexString(hdr.getField("Date").hashCode());
        }
        msgId = makeJcrFriendly(msgId);

        String subject = null;
        final Field subjectField = hdr.getField("Subject");
        if (subjectField != null) {
            subject = subjectField.getBody();
        }

        String threadPath = store.threadKeyGen.getThreadKey(subject);
        String path = store.archivePath + getDomainNodeName(listId) + "/" + getListNodeName(listId) +
                "/" + threadPath + "/" + msgId;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.