Package org.apache.syncope.console.wicket.markup.html.form

Examples of org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel


                            }
                        };
                    }
                });

                final AjaxDropDownChoicePanel intAttrNames = new AjaxDropDownChoicePanel<String>("intAttrNames",
                        getString("intAttrNames"), new PropertyModel(mappingTO, "intAttrName"));
                intAttrNames.setChoices(schemaNames);
                intAttrNames.setRequired(true);
                intAttrNames.setStyleShet(fieldStyle);
                item.add(intAttrNames);

                final AjaxDropDownChoicePanel typesPanel = new AjaxDropDownChoicePanel("intMappingTypes",
                        new ResourceModel("intMappingTypes", "intMappingTypes").getObject(),
                        new PropertyModel<IntMappingType>(mappingTO, "intMappingType"));

                // typesPanel onChange behavior provided below ...

                typesPanel.setRequired(true);
                typesPanel.setChoices(attrTypes);
                typesPanel.setStyleShet(fieldStyle);
                item.add(typesPanel);

                final AjaxDropDownChoicePanel mappingTypesPanel = new AjaxDropDownChoicePanel("mappingTypes",
                        new ResourceModel("mappingTypes", "mappingTypes").getObject(), new Model(entity));

                mappingTypesPanel.setChoices(Arrays.asList(AttributableType.values()));
                mappingTypesPanel.setStyleShet(defFieldStyle);

                item.add(mappingTypesPanel);

                mappingTypesPanel.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {

                    private static final long serialVersionUID = -1107858522700306810L;

                    @Override
                    protected void onUpdate(final AjaxRequestTarget target) {

                        attrTypes = getAttributeTypes((AttributableType) mappingTypesPanel.getModelObject());

                        typesPanel.setChoices(attrTypes);
                        intAttrNames.setChoices(Collections.EMPTY_LIST);

                        target.add(typesPanel.getField());
View Full Code Here


                item.add(label);

                FieldPanel field;
                switch (prop.getType()) {
                    case Boolean:
                        field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(),
                                new Model(Boolean.valueOf(prop.getValue()))).setChoices(Arrays.asList(
                                new String[]{"Yes", "No"}));
                        break;

                    case Date:
                        SimpleDateFormat df = StringUtils.isNotBlank(prop.getDatePattern())
                                ? new SimpleDateFormat(prop.getDatePattern())
                                : new SimpleDateFormat();
                        Date parsedDate = null;
                        if (StringUtils.isNotBlank(prop.getValue())) {
                            try {
                                parsedDate = df.parse(prop.getValue());
                            } catch (ParseException e) {
                                LOG.error("Unparsable date: {}", prop.getValue(), e);
                            }
                        }

                        field = new DateTimeFieldPanel("value", label.getDefaultModelObjectAsString(), new Model(
                                parsedDate), df.toLocalizedPattern());
                        break;

                    case Enum:
                        MapChoiceRenderer<String, String> enumCR =
                                new MapChoiceRenderer<String, String>(prop.getEnumValues());

                        field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(),
                                new Model(prop.getValue())).setChoiceRenderer(enumCR).setChoices(new Model() {

                            private static final long serialVersionUID = -858521070366432018L;

                            @Override
View Full Code Here

                try {
                    if (field.getType().equals(ConflictResolutionAction.class)) {
                        classMethod = policy.getClass().getMethod("get" + StringUtils.capitalize(field.getName()),
                                new Class[]{});

                        component = new AjaxDropDownChoicePanel("field", field.getName(), new PropertyModel(policy,
                                field.getName()));

                        ((AjaxDropDownChoicePanel) component).setChoices(
                                Arrays.asList(ConflictResolutionAction.values()));
View Full Code Here

            result = new AjaxNumberFieldPanel(id, fieldName, model, ClassUtils.resolvePrimitiveIfNecessary(type));
        } else if (Date.class.equals(type)) {
            result = new DateTimeFieldPanel(id, fieldName, model, SyncopeConstants.DEFAULT_DATE_PATTERN);
        } else if (type.isEnum()) {
            result = new AjaxDropDownChoicePanel(id, fieldName, model).setChoices(Arrays
                    .asList(type.getEnumConstants()));
        }

        // treat as String if nothing matched above
        if (result == null) {
View Full Code Here

                        item.add(label);

                        FieldPanel field;
                        switch (prop.getType()) {
                            case Boolean:
                                field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(),
                                        new Model<Boolean>(Boolean.valueOf(prop.getValue()))).setChoices(Arrays.asList(
                                                new String[] { "Yes", "No" }));
                                break;

                            case Date:
                                SimpleDateFormat df = StringUtils.isNotBlank(prop.getDatePattern())
                                ? new SimpleDateFormat(prop.getDatePattern())
                                : new SimpleDateFormat();
                                Date parsedDate = null;
                                if (StringUtils.isNotBlank(prop.getValue())) {
                                    try {
                                        parsedDate = df.parse(prop.getValue());
                                    } catch (ParseException e) {
                                        LOG.error("Unparsable date: {}", prop.getValue(), e);
                                    }
                                }

                                field = new DateTimeFieldPanel("value", label.getDefaultModelObjectAsString(),
                                        new Model<Date>(parsedDate), df.toLocalizedPattern());
                                break;

                            case Enum:
                                MapChoiceRenderer<String, String> enumCR =
                                new MapChoiceRenderer<String, String>(prop.getEnumValues());

                                field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(),
                                        new Model(prop.getValue())).setChoiceRenderer(enumCR).setChoices(new Model() {

                                    private static final long serialVersionUID = -858521070366432018L;

                                    @Override
View Full Code Here

                item.add(new Label("label", new ResourceModel(field.getName())));

                AbstractFieldPanel component;
                try {
                    if (field.getClassList() != null) {
                        component = new AjaxDropDownChoicePanel("field", field.getName(), new PropertyModel(policy,
                                field.getName()));

                        final List<String> rules = correlationRules.getObject();

                        if (rules != null && !rules.isEmpty()) {
                            ((AjaxDropDownChoicePanel) component).setChoices(correlationRules.getObject());
                        }

                        item.add(component);

                        item.add(getActivationControl(
                                component,
                                propDesc.getReadMethod().invoke(policy, new Object[] {}) != null,
                                null,
                                null));

                    } else if (field.getType().isEnum()) {
                        component = new AjaxDropDownChoicePanel("field", field.getName(), new PropertyModel(policy,
                                field.getName()));

                        final Serializable[] values = (Serializable[]) field.getType().getEnumConstants();

                        if (values != null && values.length > 0) {
View Full Code Here

        } else if (ClassUtils.isAssignable(Number.class, type)) {
            result = new SpinnerFieldPanel<Number>(id, fieldName, (Class<Number>) type, model, null, null);
        } else if (Date.class.equals(type)) {
            result = new DateTimeFieldPanel(id, fieldName, model, SyncopeConstants.DEFAULT_DATE_PATTERN);
        } else if (type.isEnum()) {
            result = new AjaxDropDownChoicePanel(id, fieldName, model).setChoices(
                    Arrays.asList(type.getEnumConstants()));
        }

        // treat as String if nothing matched above
        if (result == null) {
View Full Code Here

            result = new AjaxNumberFieldPanel(id, fieldName, model, ClassUtils.resolvePrimitiveIfNecessary(type));
        } else if (Date.class.equals(type)) {
            result = new DateTimeFieldPanel(id, fieldName, model, SyncopeConstants.DEFAULT_DATE_PATTERN);
        } else if (type.isEnum()) {
            result = new AjaxDropDownChoicePanel(id, fieldName, model).setChoices(Arrays
                    .asList(type.getEnumConstants()));
        }

        // treat as String if nothing matched above
        if (result == null) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel

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.