Examples of AbstractField


Examples of com.googlecode.wicketwebbeans.fields.AbstractField

      boolean errorsFound = false;
       
        public Object component(Component component)
        {
            AbstractField field = (AbstractField)component;
            if (field.isRequiredField() && Strings.isEmpty(field.getDefaultModelObjectAsString())) {
              FieldLabel fieldName = new FieldLabel(field.getElementMetaData().getLabel());
              StringResourceModel labelModel = new StringResourceModel("wicketwebbeans.BeanForm.fieldIsRequired", field.getElementMetaData().getBeanMetaData().getComponent(), new Model<FieldLabel>(fieldName), "${fieldLabel} is required");
              BeanForm.this.error(labelModel.getObject().toString());
                errorsFound = true;
            }
           
            return CONTINUE_TRAVERSAL;
View Full Code Here

Examples of com.googlecode.wicketwebbeans.fields.AbstractField

                public boolean accept(FeedbackMessage message)
                {
                    // If the reporter is a field and this is refreshing because of a non-Ajax form submit, it's very likely that the field has been detached
                    // from its parent because it is in a list view. As a result, findParent doesn't return the BeanForm.
                    Component reporter = message.getReporter();
                    AbstractField reporterField = (AbstractField)(reporter instanceof AbstractField ? reporter : reporter.findParent(AbstractField.class));
                    if (reporterField != null) {
                        return reporterField.getBeanForm().getId().equals(BeanForm.this.getId());
                    }
                   
                    Component parent = (reporter instanceof BeanForm ? reporter : reporter.findParent(BeanForm.class));
                    return reporter == BeanForm.this || parent == null || parent == BeanForm.this;
                }
View Full Code Here

Examples of com.log4jviewer.logfile.fields.AbstractField

        if (patternMatcher.find()) {
            logRecord = new LogRecord();

            for (int i = 0; i < logFields.size(); i++) {
                String value = patternMatcher.group(i + 1).trim();
                AbstractField logField = logFields.get(i);
                LogFieldName fieldName = logField.getLogFieldName();
                Object fieldValue = logField.decodeValue(value);

                switch (fieldName) {
                case CATEGORY:
                    logRecord.setCategoryName((String) fieldValue);
                    break;
View Full Code Here

Examples of com.sun.jersey.api.model.AbstractField

            return;
       
        while (c != Object.class) {
             for (final Field f : c.getDeclaredFields()) {
                if (f.getDeclaredAnnotations().length > 0) {
                    final AbstractField af = new AbstractField(f);
                    Parameter p = createParameter(
                            resource.getResourceClass(),
                            f.getDeclaringClass(),
                            isEncoded,
                            f.getType(),
                            f.getGenericType(),
                            f.getAnnotations());
                    if (null != p) {
                        af.getParameters().add(p);
                        resource.getFields().add(af);
                    }
                }
             }
             c = c.getSuperclass();
View Full Code Here

Examples of com.vaadin.ui.AbstractField

        return null;
    }

    private <T extends Field> T createDateField(Class<?> type,
            Class<T> fieldType) {
        AbstractField field;

        if (InlineDateField.class.isAssignableFrom(fieldType)) {
            field = new InlineDateField();
        } else if (DateField.class.isAssignableFrom(fieldType)
                || fieldType == Field.class) {
            field = new PopupDateField();
        } else if (AbstractTextField.class.isAssignableFrom(fieldType)) {
            field = createAbstractTextField((Class<? extends AbstractTextField>) fieldType);
        } else {
            return null;
        }

        field.setImmediate(true);
        return (T) field;
    }
View Full Code Here

Examples of com.vaadin.ui.AbstractField

    }

    private void checkDataBinding(Class<? extends AbstractField> class1) {
        boolean ok = false;
        AbstractField b;
        try {
            b = class1.newInstance();
            b.setCaption("Button of type " + class1.getSimpleName());
            try {
                b.setBuffered(false);
                ObjectProperty<String> prop = new ObjectProperty<String>(
                        "ABC 123");
                /*
                 * This should throw an exception or somehow tell that the
                 * property was invalid (wrong type). See #2223.
                 */
                b.setPropertyDataSource(prop);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e1) {
            e1.printStackTrace();
View Full Code Here

Examples of com.vaadin.ui.AbstractField

        form2.setFormFieldFactory(new FormFieldFactory() {

            @Override
            public Field createField(Item item, Object propertyId,
                    Component uiContext) {
                AbstractField f = (AbstractField) DefaultFieldFactory.get()
                        .createField(item, propertyId, uiContext);
                if (propertyId.equals("age")) {
                    f.setPropertyDataSource(new PropertyFormatter() {

                        @Override
                        public Object parse(String formattedValue)
                                throws Exception {
                            String str = formattedValue.replaceAll("[^0-9.]",
                                    "");
                            if (formattedValue.toLowerCase().contains("months")) {
                                return Double.parseDouble(str) / 12;
                            }
                            return Double.parseDouble(str);
                        }

                        @Override
                        public String format(Object value) {
                            Double dValue = (Double) value;
                            if (dValue < 1) {
                                return ((int) (dValue * 12)) + " months";
                            }
                            return dValue + " years";
                        }
                    });
                    f.setImmediate(true);
                }
                return f;
            }
        });
        form2.setItemDataSource(createItem());
View Full Code Here

Examples of com.vaadin.ui.AbstractField

        return null;
    }

    @Override
    public void valueChange(ValueChangeEvent event) {
        AbstractField field = (AbstractField) event.getProperty();
        // if (field == localeSelect) {
        // return;
        // }

        Object newValue = field.getValue();
        if (newValue != null) {
            newValue = newValue + " (" + newValue.getClass().getName() + ")";
        }

        String message = "Value of " + field.getCaption() + " changed to "
                + newValue + ".";
        if (field.getPropertyDataSource() != null) {
            Object dataSourceValue = field.getPropertyDataSource().getValue();
            message += "Data model value is " + dataSourceValue;
            message += " (" + field.getPropertyDataSource().getType().getName()
                    + ")";
        }
        log.log(message);

    }
View Full Code Here

Examples of honeycrm.client.field.AbstractField

import junit.framework.TestCase;

// TODO rewrite formatting tests without requiring client side GWT.create() call caused by NumberFormat/Random class.
public class FieldCurrencyTest extends TestCase {
  public void testFormatting() {
    final AbstractField field = new FieldCurrency("revenue", "Some label", "0");

    final Dto test = new Dto();
    test.set("1", 0);
    test.set("2", Integer.MAX_VALUE);
    test.set("3", Integer.MIN_VALUE);
View Full Code Here

Examples of honeycrm.client.field.AbstractField

     * for (final String key: test.getAllData().keySet()) { field.getWidget(View.DETAIL, test, key); }
     */
  }

  public void testGetData() {
    final AbstractField field = new FieldCurrency("income", "Some label", "0");
    // final String formattedString = NumberFormat.getCurrencyFormat("EUR").format(Double.MAX_VALUE);
    // assertEquals(Double.MAX_VALUE, field.getData(formattedString));
  }
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.