Java Code Examples for org.apache.wicket.model.PropertyModel

The following are top voted examples for showing how to use org.apache.wicket.model.PropertyModel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: engerek   File: ReconciliationPopupPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(IModel<List<ResourceItemDto>> resources,
                        final Component component) {

    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ReconciliationReportDto.F_NAME),
            createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(name);

    TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ReconciliationReportDto.F_DESCRIPTION),
            createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(description);

    IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
    IChoiceRenderer renderer = new EnumChoiceRenderer();
    DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new
            PropertyModel<ExportType>(getModel(), ReconciliationReportDto.F_EXPORT_TYPE), choices, renderer,
            createStringResource("ReconciliationPopupPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(exportType);

    DropDownFormGroup resourceDropDown = new DropDownFormGroup(ID_RESOURCE, createModel(resources.getObject()),
            resources, renderer, createStringResource("ReconciliationPopupPanel.resource"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(resourceDropDown);
}
 
Example 2
Project: Unicorn   File: BasicTransformationRuleEditorPanel.java   Source Code and License 6 votes vote down vote up
private void buildTextFields() {
	this.transformationRuleNameTextField = new TextField<String>("transformationRuleNameTextField", new PropertyModel<String>(this, "transformationRuleName"));
	this.transformationRuleNameTextField.setOutputMarkupId(true);
	this.layoutForm.add(this.transformationRuleNameTextField);

	final List<String> eventTypes = EapEventType.getAllTypeNames();
	this.eventTypeDropDownChoice = new DropDownChoice<String>("eventTypeDropDownChoice", new PropertyModel<String>(this, "selectedEventTypeName"), eventTypes);
	this.eventTypeDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			BasicTransformationRuleEditorPanel.this.updateOnChangeOfDropDownChoice(target);
		}
	});
	this.layoutForm.add(this.eventTypeDropDownChoice);

	this.transformationRuleTextArea = new TextArea<String>("transformationRuleTextArea", new PropertyModel<String>(this, "transformationRule"));
	this.transformationRuleTextArea.setOutputMarkupId(true);
	this.layoutForm.add(this.transformationRuleTextArea);
}
 
Example 3
Project: engerek   File: UserReportConfigPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(final Component component){

        TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), UserReportDto.F_NAME),
                createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
        add(name);

        TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), UserReportDto.F_DESCRIPTION),
                createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
        add(description);

        IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
        IChoiceRenderer renderer = new EnumChoiceRenderer();
        DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new
                PropertyModel<ExportType>(getModel(), UserReportDto.F_EXPORT_TYPE), choices, renderer,
                createStringResource("UserReportConfigPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(exportType);

        DateFormGroup dateFrom = new DateFormGroup(ID_DATE_FROM, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_FROM_GREG),
                createStringResource("UserReportConfigPanel.dateFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(dateFrom);

        DateFormGroup dateTo = new DateFormGroup(ID_DATE_TO, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_TO_GREG),
                createStringResource("UserReportConfigPanel.dateTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(dateTo);
    }
 
Example 4
Project: engerek   File: DefaultHandlerPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(final PageTaskEdit parentPage) {
	WebMarkupContainer objectRefContainer = new WebMarkupContainer(ID_OBJECT_REF_CONTAINER);
	objectRefContainer.add(new VisibleEnableBehaviour() {
		@Override
		public boolean isVisible() {
			return getModelObject().getTaskDto().getObjectRef() != null;
		}
	});

	final LinkPanel objectRef = new LinkPanel(ID_OBJECT_REF, new PropertyModel<String>(getModel(), HandlerDto.F_OBJECT_REF_NAME)) {
		@Override
		public void onClick(AjaxRequestTarget target) {
			ObjectReferenceType ref = getModelObject().getObjectRef();
			if (ref != null) {
				WebComponentUtil.dispatchToObjectDetailsPage(ref, parentPage, false);
			}
		}
		@Override
		public boolean isEnabled() {
			return WebComponentUtil.hasDetailsPage(getModelObject().getObjectRef());
		}
	};
	objectRefContainer.add(objectRef);
	add(objectRefContainer);
}
 
Example 5
Project: engerek   File: AssignmentDataTablePanel.java   Source Code and License 6 votes vote down vote up
private ChooseTypePanel<OrgType> getChooseOrgPanel(String id, IModel<AssignmentEditorDto> model, ObjectQuery query){
    ChooseTypePanel chooseOrgPanel = new ChooseTypePanel(id, new PropertyModel<ObjectViewDto>(model, AssignmentEditorDto.F_TENANT_REF)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected ObjectQuery getChooseQuery() {
            return query;
        }

        @Override
        public Class getObjectTypeClass(){
            return OrgType.class;
        }

        @Override
        protected boolean isSearchEnabled() {
            return true;
        }

        @Override
        protected QName getSearchProperty() {
            return OrgType.F_NAME;
        }
    };
    return chooseOrgPanel;
}
 
Example 6
Project: engerek   File: DateInput.java   Source Code and License 6 votes vote down vote up
@Override
protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
    String localizedDatePattern = WebComponentUtil.getLocalizedDatePattern(DateLabelComponent.SHORT_NOTIME_STYLE);
    if (localizedDatePattern != null && !localizedDatePattern.contains("yyyy")){
        localizedDatePattern = localizedDatePattern.replaceAll("yy", "yyyy");
    }
    DateTextField dateField = DateTextField.forDatePattern(id, dateFieldModel, localizedDatePattern);
    dateField.add(new EmptyOnChangeAjaxFormUpdatingBehavior(){
        @Override
        protected void onUpdate(AjaxRequestTarget target){
            DateInput.this.setModelObject(computeDateTime());
        }
    });
    return dateField;

}
 
Example 7
Project: engerek   File: ColumnUtils.java   Source Code and License 6 votes vote down vote up
private static <T> PropertyColumn<T, String> createPropertyColumn(String name, String sortableProperty,
		final String expression, final boolean multivalue) {

	return new PropertyColumn<T, String>(createStringResource(name), sortableProperty, expression) {
		private static final long serialVersionUID = 1L;

		@Override
		public void populateItem(Item item, String componentId, IModel rowModel) {
			if (multivalue) {
				IModel<List> values = new PropertyModel<List>(rowModel, expression);
				RepeatingView repeater = new RepeatingView(componentId);
				for (final Object task : values.getObject()) {
					repeater.add(new Label(repeater.newChildId(), task.toString()));
				}
				item.add(repeater);
				return;
			}

			super.populateItem(item, componentId, rowModel);
		}
	};

}
 
Example 8
Project: vlo-curation   File: AvailabilityFacetPanel.java   Source Code and License 6 votes vote down vote up
@Override
protected void populateItem(Item<Count> item) {
    //model for actual value
    final PropertyModel<String> valueModel = new PropertyModel<>(item.getModel(), "name");

    //checkbox
    final Component selector = createValueCheckbox("selector", valueModel.getObject());
    item.add(selector);

    //label
    item.add(new WebMarkupContainer("label")
            //child label
            .add(new FieldValueLabel("name", valueModel, fieldNameModel))
            //count label
            .add(new Label("count", new PropertyModel<String>(item.getModel(), "count")))
            //reference to checkbox
            .add(new AttributeModifier("for", selector.getMarkupId()))
            .add(new AttributeAppender("class", valueModel, " "))
    );

    //description as tooltip (title)
    final IModel<FieldValueDescriptor> descriptorModel = new MapValueModel<>(descriptorsModel, valueModel);
    final IModel<String> descriptionModel = new PropertyModel<>(descriptorModel, "description");
    item.add(new AttributeModifier("title", descriptionModel));
}
 
Example 9
Project: vlo-curation   File: SearchResultsHeaderPanel.java   Source Code and License 6 votes vote down vote up
private Form createResultPageSizeForm(String id, final IPageableItems resultsView) {
    final Form resultPageSizeForm = new Form(id);

    final DropDownChoice<Long> pageSizeDropDown
            = new DropDownChoice<Long>("resultPageSize",
                    // bind to items per page property of pageable
                    new PropertyModel<Long>(resultsView, "itemsPerPage"),
                    ITEMS_PER_PAGE_OPTIONS);
    pageSizeDropDown.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            onChange(target);
        }
    });
    resultPageSizeForm.add(pageSizeDropDown);

    return resultPageSizeForm;
}
 
Example 10
Project: engerek   File: PrismContainerPanel.java   Source Code and License 6 votes vote down vote up
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced){
     ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties",
             new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<ItemWrapper> item) {
             item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
             item.add(new VisibleEnableBehaviour() {
             	private static final long serialVersionUID = 1L;
             	
             	@Override
             	public boolean isVisible() {
             		return item.getModel().getObject().isVisible();
             	}
             });
             item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 11
Project: vlo-curation   File: FacetValuesPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a form with an input bound to the filter model
 *
 * @param id component id
 * @return filter form
 */
private Form createFilterForm(String id) {
    final Form filterForm = new Form(id);
    final TextField<String> filterField = new TextField<>("filterText",
            new PropertyModel<String>(filterModel, "name"));
    // make field update 
    filterField.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            //update values
            target.add(valuesContainer);
        }
    });
    filterForm.add(filterField);
    return filterForm;
}
 
Example 12
Project: Unicorn   File: FilterExpressionPanel.java   Source Code and License 6 votes vote down vote up
private void buildFilterExpressionOperatorDropDownChoice() {

		this.filterExpressionOperator = (FilterExpressionOperatorEnum) this.element.getValue();

		final DropDownChoice<FilterExpressionOperatorEnum> filterExpressionOperatorDropDownChoice = new DropDownChoice<FilterExpressionOperatorEnum>("filterExpressionOperatorDropDownChoice", new PropertyModel<FilterExpressionOperatorEnum>(this, "filterExpressionOperator"), Arrays.asList(FilterExpressionOperatorEnum.values()), new ChoiceRenderer<FilterExpressionOperatorEnum>() {
			private static final long serialVersionUID = 1L;

			@Override
			public Object getDisplayValue(final FilterExpressionOperatorEnum element) {
				return element.getValue();
			}
		});
		filterExpressionOperatorDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
			private static final long serialVersionUID = -5452061293278720695L;

			@Override
			protected void onUpdate(final AjaxRequestTarget target) {
				FilterExpressionPanel.this.element.setValue(FilterExpressionPanel.this.filterExpressionOperator);
				FilterExpressionPanel.this.table.getSelectedElements().remove(FilterExpressionPanel.this.element);
				target.add(FilterExpressionPanel.this.table);
			}
		});
		filterExpressionOperatorDropDownChoice.setOutputMarkupId(true);
		this.layoutForm.add(filterExpressionOperatorDropDownChoice);
	}
 
Example 13
Project: engerek   File: PageSelfRegistration.java   Source Code and License 6 votes vote down vote up
private void createPasswordPanel(WebMarkupContainer staticRegistrationForm) {
	// ProtectedStringType initialPassword = null;
	PasswordPanel password = new PasswordPanel(ID_PASSWORD,
			new PropertyModel<ProtectedStringType>(userModel, "credentials.password.value"), false, true);
	password.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
	password.getBaseFormComponent().setRequired(true);
	staticRegistrationForm.add(password);

	Label help = new Label(ID_TOOLTIP);
	final StringResourceModel tooltipText = createStringResource("PageSelfRegistration.password.policy");
	help.add(AttributeModifier.replace("title", tooltipText));
	help.add(new InfoTooltipBehavior());
	help.add(new VisibleEnableBehaviour() {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean isVisible() {

			return StringUtils.isNotEmpty(tooltipText.getObject());
		}
	});
	staticRegistrationForm.add(help);
}
 
Example 14
Project: engerek   File: CapabilityValuePanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout(PageResourceWizard parentPage) {

		parentPage.addEditingEnabledBehavior(this);

        Label label = new Label(ID_LABEL, createStringResource(getCapabilityLabelKey()));
        add(label);

        CheckBox enabled = new CheckBox(ID_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.enabled"));
		enabled.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				target.add(capabilityTable);
			}
		});
        add(enabled);
    }
 
Example 15
Project: vlo-curation   File: RecordNavigationPanel.java   Source Code and License 6 votes vote down vote up
public RecordNavigationPanel(String id, final IModel<SearchContext> model, IModel<String> tabModel) {
    super(id, model);

    // Add a label 'record X of Y'
    add(new Label("recordIndex", StringResourceModelMigration.of("record.navigation.index", this, model,
            new Object[]{
                // These values get inserted into the string
                // First: index shifted with +1 (because count starts at 0)
                new ShiftedIndexModel(new PropertyModel<Long>(model, "index"), +1),
                // Second: total result count, unmodified
                new PropertyModel<>(model, "resultCount")
            }
    )));

    // Add a link to go to the previous record
    add(createPreviousLink(model, tabModel));
    // Add a link to go to the next record
    add(createNextLink(model, tabModel));
}
 
Example 16
Project: engerek   File: SearchFilterPanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {

		TextArea<String> description = new TextArea<>(ID_DESCRIPTION,
				new PropertyModel<String>(getModel(), SearchFilterType.F_DESCRIPTION.getLocalPart()));
		description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
		add(description);

		AceEditor clause = new AceEditor(ID_FILTER_CLAUSE, clauseStringModel);
		clause.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
		add(clause);

        AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                updateClausePerformed(target);
            }
        };
		update.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
        add(update);

        Label clauseTooltip = new Label(ID_T_CLAUSE);
        clauseTooltip.add(new InfoTooltipBehavior());
        add(clauseTooltip);
    }
 
Example 17
Project: engerek   File: SystemInfoPanel.java   Source Code and License 6 votes vote down vote up
@Override
protected void initLayout() {
    final WebMarkupContainer table = new WebMarkupContainer(ID_TABLE);
    table.setOutputMarkupId(true);
    add(table);
    table.add(new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(10000)));

    Label cpuUsage = new Label(ID_CPU_USAGE, new PropertyModel<>(getModel(), SystemInfoDto.F_CPU_USAGE));
    table.add(cpuUsage);

    Label heapMemory = new Label(ID_HEAP_MEMORY, createMemoryModel(true));
    table.add(heapMemory);

    Label nonHeapMemory = new Label(ID_NON_HEAP_MEMORY, createMemoryModel(false));
    table.add(nonHeapMemory);

    Label threads = new Label(ID_THREADS, createThreadModel());
    table.add(threads);

    DateLabelComponent startTime = new DateLabelComponent(ID_START_TIME, createStartTimeModel(), DateLabelComponent.MEDIUM_MEDIUM_STYLE);
    table.add(startTime);

    Label uptime = new Label(ID_UPTIME, createUptimeModel());
    table.add(uptime);
}
 
Example 18
Project: engerek   File: CapabilitiesPanel.java   Source Code and License 6 votes vote down vote up
private void createCapabilityButton(String id) {
	AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO:
		}

	};

	button.add(new AttributeModifier("class",
			button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
					: "btn btn-app btn-resource-capability bg-gray text-light-blue"));

	button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));

	add(button);
}
 
Example 19
Project: vlo-curation   File: AllFacetValuesPage.java   Source Code and License 6 votes vote down vote up
private void addComponents() {
    add(new BreadCrumbPanel("breadcrumbs", selectionModel, getModelObject().getName()));

    add(new Label("name", new SolrFieldNameModel(new PropertyModel<String>(getModel(), "name"))));

    add(new AllFacetValuesPanel("values", getModel()) {

        @Override
        protected void onValuesSelected(Collection<String> values, AjaxRequestTarget target) {
            // Create updated selection state
            final QueryFacetsSelection newSelection;
            if (selectionModel != null) {
                newSelection = selectionModel.getObject().getCopy();
            } else {
                newSelection = new QueryFacetsSelection();
            }
            newSelection.selectValues(getModelObject().getName(), new FacetSelection(values));

            // Redirect to search page with updated model
            final FacetedSearchPage searchPage = new FacetedSearchPage(Model.of(newSelection));
            setResponsePage(searchPage);
        }
    });
}
 
Example 20
Project: engerek   File: InformationPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout() {
	Label titleLabel = new Label(ID_TITLE, new PropertyModel<>(getModel(), InformationType.F_TITLE.getLocalPart()));
	titleLabel.add(new VisibleBehaviour(() -> getModelObject().getTitle() != null));
	add(titleLabel);

	ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS,
			new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
		@Override
		protected void populateItem(ListItem<InformationPartType> item) {
			InformationPartType part = item.getModelObject();
			Label label = new Label(ID_PART, part.getText());
			if (Boolean.TRUE.equals(part.isHasMarkup())) {
				label.setEscapeModelStrings(false);
			}
			item.add(label);
		}
	};
	add(list);
}
 
Example 21
Project: engerek   File: TaskResultTabPanel.java   Source Code and License 6 votes vote down vote up
private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
	SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this,
			new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
	TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
	resultTablePanel.setStyle("padding-top: 0px;");
	resultTablePanel.setShowPaging(false);
	resultTablePanel.setOutputMarkupId(true);
	add(resultTablePanel);

	add(new AjaxFallbackLink(ID_SHOW_RESULT) {
		public void onClick(AjaxRequestTarget target) {
			OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
			OperationResultPanel body = new OperationResultPanel(
					pageBase.getMainPopupBodyId(),
					new Model<>(OpResult.getOpResult(pageBase, opResult)),
					pageBase);
			body.setOutputMarkupId(true);
			pageBase.showMainPopup(body, target);
		}
	});
}
 
Example 22
Project: engerek   File: TaskChangesPanel.java   Source Code and License 6 votes vote down vote up
protected void initLayout() {
//        add(new Label(ID_TITLE, new AbstractReadOnlyModel<String>() {
//			@Override
//			public String getObject() {
//				return getString(getModelObject().getTitleKey());
//			}
//		}));

        ScenePanel deltaPanel = new ScenePanel(ID_PRIMARY_DELTA, new PropertyModel<>(getModel(), TaskChangesDto.F_PRIMARY_DELTAS));
        deltaPanel.add(new VisibleEnableBehaviour() {
            @Override
            public boolean isVisible() {
                return getModelObject() != null && getModelObject().getPrimaryDeltas() != null;
            }
        });
        add(deltaPanel);
    }
 
Example 23
Project: openNaEF   File: VrfSearchPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName), String.class);
    this.form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 24
Project: openNaEF   File: CustomerResourceEditPage.java   Source Code and License 5 votes vote down vote up
public static DateTextField createDateTextField(Object self, String wicketId, String fieldName) {
    DateTextField textField = new DateTextField(
            wicketId,
            new PropertyModel<>(self, fieldName),
            new PatternDateConverter("yyyy/MM/dd", true));

    DatePicker datePicker = new DatePicker() {
        @Override
        protected String getAdditionalJavascript() {
            return "${calendar}.cfg.setProperty(\"navigator\",true,false); ${calendar}.render();";
        }
    };
    datePicker.setShowOnFieldClick(true);
    textField.add(datePicker);

    textField.add(new OnChangeAjaxBehavior() {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            Component component = this.getComponent();
            if (component instanceof DateTextField) {
                System.out.printf("input changed: %s \n", this.getComponent().getDefaultModelObject());
            }
        }
    });

    return textField;
}
 
Example 25
Project: openNaEF   File: SubnetSelectionPanel.java   Source Code and License 5 votes vote down vote up
public SubnetSelectionPanel(String id, List<VlanDto> vlanDtos) {
	super(id);
	this.subnets = new ArrayList<>();
	this.subnetsMap = new HashMap<>();
	try{
		DropDownChoice<String> vlanfield;
		if(vlanDtos == null || vlanDtos.size() == 0){
			vlanfield = new DropDownChoice<String>("vlanName",
					new PropertyModel<>(this, "vlanName"), vlans);
		}else {
			vlanDtos.forEach(vlanDto -> vlans.add(vlanDto.getVlanId().toString()));
			vlanfield = new DropDownChoice<String>("vlanName",
					new PropertyModel<>(this, "vlanName"), vlans);
		}
		vlanfield.setRequired(true);
		add(vlanfield);

		addAllIpSubnet(SubnetRenderer.getAllIpSubnetNamespace(),subnets,subnetsMap);
		DropDownChoice<String> subnetfield = new DropDownChoice<String>("subnetName",
				new PropertyModel<>(this, "subnetName"), subnets);
		subnetfield.setRequired(true);
		add(subnetfield);
	} catch (ExternalServiceException e) {
		e.printStackTrace();
	}

}
 
Example 26
Project: openNaEF   File: VplsSearchPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName), String.class);
    this.form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 27
Project: openNaEF   File: VlanIfEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto port, String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName), String.class);
    this.form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 28
Project: openNaEF   File: AliasPortEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto port, String id, String varName,
                                       String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, varName));
    form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 29
Project: openNaEF   File: LoopbackPortEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto port, String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName));
    form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 30
Project: openNaEF   File: LogicalPortEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto port, String id, String varName,
                                       String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, varName));
    form.add(tf);
    tf.setEnabled(supportdAttributes.contains(attributeName));
    tf.setVisible(supportdAttributes.contains(attributeName));
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 31
Project: openNaEF   File: PortEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto port, String id, String varName,
                                       String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, varName));
    form.add(tf);
    tf.setEnabled(supportdAttributes.contains(attributeName));
    tf.setVisible(supportdAttributes.contains(attributeName));
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 32
Project: openNaEF   File: ChannelPortEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto channel, String id,
                                       String attributeName, AbstractValidator<String> validator, boolean required) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName));
    editInterface.add(tf);
    tf.setRequired(required);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 33
Project: openNaEF   File: AtmPvcEditPage.java   Source Code and License 5 votes vote down vote up
private TextField<String> addTextField(PortDto pvc, String id,
                                       String attributeName, AbstractValidator<String> validator, boolean required) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName));
    form.add(tf);
    tf.setRequired(required);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 34
Project: GeoCrawler   File: AbstractBasePage.java   Source Code and License 5 votes vote down vote up
protected Component addInstancesMenuMenu() {
  IModel<String> instanceName = PropertyModel.of(currentInstance, "name");
  DropDownButton instancesMenu = new NavbarDropDownButton(instanceName) {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Override
    protected List<AbstractLink> newSubMenuButtons(String buttonMarkupId) {
      List<NutchInstance> instances = instanceService.getInstances();
      List<AbstractLink> subMenu = Lists.newArrayList();
      for (NutchInstance instance : instances) {
        subMenu.add(new Link<NutchInstance>(buttonMarkupId, Model
            .of(instance)) {
          /**
               * 
               */
              private static final long serialVersionUID = 1L;

          @Override
          public void onClick() {
            currentInstance.setObject(getModelObject());
            setResponsePage(DashboardPage.class);
          }
        }.setBody(Model.of(instance.getName())));
      }
      return subMenu;
    }
  }.setIconType(FontAwesomeIconType.gears);

  return instancesMenu;
}
 
Example 35
Project: Unicorn   File: DependenciesPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Create and add input fields for new values of the dependency.
 *
 */
private void addDependencyValuesInputs() {
    baseAttributeInputField = new TextField<>("baseAttributeInput", new PropertyModel<String>(this,
            "currentBaseAttributeInput"));
    dependentAttributeInputField = new TextField<>("dependentAttributeInput", new PropertyModel<String>(this,
            "currentDependentAttributeInput"));
    baseAttributeInputField.setLabel(new Model<String>("Input for base attribute"));
    baseAttributeInputField.setOutputMarkupId(true);
    baseAttributeInputField.setEnabled(false);
    dependentAttributeInputField.setLabel(new Model<String>("Input for dependent attribute"));
    dependentAttributeInputField.setOutputMarkupId(true);
    dependentAttributeInputField.setEnabled(false);
    dependencyForm.add(baseAttributeInputField);
    dependencyForm.add(dependentAttributeInputField);
}
 
Example 36
Project: MBaaS   File: DatePanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    DateTextField field = new DateTextField("field", new PropertyModel<>(this.fields, this.name));
    field.setType(Date.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 37
Project: MBaaS   File: StringPanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<String> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    field.add(StringValidator.maximumLength(255));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 38
Project: MBaaS   File: DoublePanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Double> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.add(RangeValidator.range(Double.MIN_VALUE, Double.MAX_VALUE));
    field.setType(Double.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 39
Project: vlo-curation   File: AllFacetValuesPanel.java   Source Code and License 5 votes vote down vote up
private DataView<FacetField.Count> createValuesView(String id) {
    final IModel<String> fieldNameModel = new PropertyModel<>(getModel(), "name");
    return new DataView<FacetField.Count>(id, valuesProvider, ITEMS_PER_PAGE) {

        @Override
        protected void populateItem(final Item<FacetField.Count> item) {
            item.setDefaultModel(new CompoundPropertyModel<>(item.getModel()));

            // link to select an individual facet value
            final Link selectLink = new AjaxFallbackLink("facetSelect") {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    // call callback
                    onValuesSelected(
                            // for now only single values can be selected
                    		Collections.singleton(item.getModelObject().getName()),
                            target);
                }
            };
            item.add(selectLink);

            // 'name' field from Count (name of value)
            selectLink.add(new FieldValueLabel("name", fieldNameModel));

            // 'count' field from Count (document count for value)
            item.add(new Label("count"));
        }
    };
}
 
Example 40
Project: MBaaS   File: TextPanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    CKEditorTextArea field = new CKEditorTextArea("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 41
Project: MBaaS   File: BooleanPanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    Label inlineLabel = new Label("inlineLabel", this.name);
    this.add(inlineLabel);
    CheckBox field = new CheckBox("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(this.name));
    this.add(field);
}
 
Example 42
Project: engerek   File: ScannerHandlerPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout() {
		WebMarkupContainer lastScanTimestampContainer = new WebMarkupContainer(ID_LAST_SCAN_TIMESTAMP_CONTAINER);
//		lastScanTimestampContainer.add(new VisibleEnableBehaviour() {
//			@Override
//			public boolean isVisible() {
//				return getModelObject().getTaskDto().getObjectRefOid() != null;
//			}
//		});
		lastScanTimestampContainer.add(new Label(ID_LAST_SCAN_TIMESTAMP, new PropertyModel<>(getModel(), ScannerHandlerDto.F_LAST_SCAN_TIMESTAMP)));
		add(lastScanTimestampContainer);
	}
 
Example 43
Project: engerek   File: ExecuteChangesHandlerPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout() {
	WebMarkupContainer changeContainer = new WebMarkupContainer(ID_CHANGE_CONTAINER);
	TextArea change = new TextArea<>(ID_CHANGE, new PropertyModel<>(getModel(), ExecuteChangesHandlerDto.F_OBJECT_DELTA_XML));
	change.setEnabled(false);
	changeContainer.add(change);
	add(changeContainer);

	WebMarkupContainer optionsContainer = new WebMarkupContainer(ID_OPTIONS_CONTAINER);
	TextArea options = new TextArea<>(ID_OPTIONS, new PropertyModel<>(getModel(), ExecuteChangesHandlerDto.F_OPTIONS));
	options.setEnabled(false);
	optionsContainer.add(options);
	add(optionsContainer);
}
 
Example 44
Project: MBaaS   File: SectionModifyPage.java   Source Code and License 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    DSLContext context = Spring.getBean(DSLContext.class);
    SectionTable sectionTable = Tables.SECTION.as("sectionTable");

    PageParameters parameters = getPageParameters();
    this.sectionId = parameters.get("sectionId").toString("");
    SectionPojo section = context.select(sectionTable.fields()).from(sectionTable).where(sectionTable.SECTION_ID.eq(this.sectionId)).fetchOneInto(SectionPojo.class);
    this.order = section.getOrder();
    this.title = section.getTitle();

    this.form = new Form<>("form");
    layout.add(this.form);

    this.titleField = new TextField<>("titleField", new PropertyModel<>(this, "title"));
    this.titleField.setRequired(true);
    this.titleField.add(new SectionTitleValidator(this.sectionId));
    this.form.add(this.titleField);
    this.titleFeedback = new TextFeedbackPanel("titleFeedback", this.titleField);
    this.form.add(this.titleFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.orderField = new TextField<>("orderField", new PropertyModel<>(this, "order"));
    this.orderField.setRequired(true);
    this.form.add(this.orderField);
    this.orderFeedback = new TextFeedbackPanel("orderFeedback", this.orderField);
    this.form.add(this.orderFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", SectionBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 45
Project: engerek   File: ReportConfigurationPanel.java   Source Code and License 5 votes vote down vote up
protected void initLayout() {
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ID_NAME),
            createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(name);

    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION,
            new PropertyModel<String>(getModel(), ID_DESCRIPTION),
            createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(description);

    IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
    IChoiceRenderer renderer = new EnumChoiceRenderer();
    DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), ReportDto.F_EXPORT_TYPE), choices, renderer,
            createStringResource("ReportType.export"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(exportType);

    TextFormGroup virtualizerKickOn = null;
    DropDownFormGroup virtualizer = new DropDownFormGroup(ID_VIRTUALIZER, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER),
            createVirtualizerListModel(), new ChoiceRenderer<String>(),
            createStringResource("ReportType.virtualizer"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    //virtualizer.add(new VirtualizerAjaxFormUpdatingBehaviour(virtualizerKickOn));
    add(virtualizer);

    virtualizerKickOn = new TextFormGroup(ID_VIRTUALIZER_KICKON, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER_KICKON),
            createStringResource("ReportType.virtualizerKickOn"), ID_LABEL_SIZE, "col-md-4", false);
    add(virtualizerKickOn);

    TextFormGroup maxPages = new TextFormGroup(ID_MAXPAGES, new PropertyModel<String>(getModel(), ReportDto.F_MAXPAGES),
            createStringResource("ReportType.maxPages"), ID_LABEL_SIZE, "col-md-4", false);
    add(maxPages);

    TextFormGroup timeout = new TextFormGroup(ID_TIMEOUT, new PropertyModel<String>(getModel(), ReportDto.F_TIMEOUT),
            createStringResource("ReportType.timeout"), ID_LABEL_SIZE, "col-md-4", false);
    add(timeout);
}
 
Example 46
Project: engerek   File: ImportOptionsPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout() {
    CheckBox protectedByEncryption = new CheckBox(ID_PROTECTED_BY_ENCRYPTION,
            new PropertyModel<Boolean>(model, "encryptProtectedValues"));
    add(protectedByEncryption);
    CheckBox fetchResourceSchema = new CheckBox(ID_FETCH_RESOURCE_SCHEMA,
            new PropertyModel<Boolean>(model, "fetchResourceSchema"));
    add(fetchResourceSchema);
    CheckBox keepOid = new CheckBox(ID_KEEP_OID,
            new PropertyModel<Boolean>(model, "keepOid"));
    add(keepOid);
    CheckBox overwriteExistingObject = new CheckBox(ID_OVERWRITE_EXISTING_OBJECT,
            new PropertyModel<Boolean>(model, "overwrite"));
    add(overwriteExistingObject);
    CheckBox referentialIntegrity = new CheckBox(ID_REFERENTIAL_INTEGRITY,
            new PropertyModel<Boolean>(model, "referentialIntegrity"));
    add(referentialIntegrity);
    CheckBox summarizeErrors = new CheckBox(ID_SUMMARIZE_ERRORS,
            new PropertyModel<Boolean>(model, "summarizeErrors"));
    add(summarizeErrors);
    CheckBox summarizeSuccesses = new CheckBox(ID_SUMMARIZE_SUCCESSES,
            new PropertyModel<Boolean>(model, "summarizeSucceses"));
    add(summarizeSuccesses);
    CheckBox validateDynamicSchema = new CheckBox(ID_VALIDATE_DYNAMIC_SCHEMA,
            new PropertyModel<Boolean>(model, "validateDynamicSchema"));
    add(validateDynamicSchema);
    CheckBox validateStaticSchema = new CheckBox(ID_VALIDATE_STATIC_SCHEMA,
            new PropertyModel<Boolean>(model, "validateStaticSchema"));
    add(validateStaticSchema);
    TextField<Integer> errors = new TextField<Integer>(ID_ERRORS,
            new PropertyModel<Integer>(model, "stopAfterErrors"));
    add(errors);
}
 
Example 47
Project: Unicorn   File: Scenario3Panel.java   Source Code and License 5 votes vote down vote up
private void addEventsCheckBoxMultipleChoice(final Form<Void> layoutForm) {

		final List<String> fileNames = Arrays.asList("shipToEnns", "shipToEnns_additionalKremsToEnns");

		this.eventsCheckBoxMultipleChoice = new CheckBoxMultipleChoice<String>("eventsCheckBoxMultipleChoice", new PropertyModel<List<String>>(this, "selectedFiles"), fileNames);
		this.eventsCheckBoxMultipleChoice.setOutputMarkupId(true);
		layoutForm.add(this.eventsCheckBoxMultipleChoice);
	}
 
Example 48
Project: Unicorn   File: PatternBuilderPanel.java   Source Code and License 5 votes vote down vote up
private void buildEventTypeDropDownChoice() {

		final List<EapEventType> eventTypes = EapEventType.findAll();
		this.eventTypeDropDownChoice = new DropDownChoice<EapEventType>("eventTypeDropDownChoice", new PropertyModel<EapEventType>(this, "selectedEventType"), eventTypes);
		this.eventTypeDropDownChoice.setOutputMarkupId(true);
		this.layoutForm.add(this.eventTypeDropDownChoice);
	}
 
Example 49
Project: engerek   File: LiveSyncHandlerPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout(final PageTaskEdit parentPage) {
	WebMarkupContainer tokenContainer = new WebMarkupContainer(ID_TOKEN_CONTAINER);
	tokenContainer.add(new VisibleEnableBehaviour() {
		@Override
		public boolean isVisible() {
			return true;	//TODO
		}
	});
	tokenContainer.add(new Label(ID_TOKEN, new PropertyModel<>(getModel(), LiveSyncHandlerDto.F_TOKEN)));

	LinkIconPanel deleteTokenPanel = new LinkIconPanel(ID_DELETE_TOKEN, new Model("fa fa-fw fa-trash-o fa-lg text-danger"), createStringResource("LiveSyncHandlerPanel.deleteToken")) {
		@Override
		protected void onClickPerformed(AjaxRequestTarget target) {
			parentPage.getController().deleteSyncTokenPerformed(target);
		}
	};
	deleteTokenPanel.add(new VisibleEnableBehaviour() {
		@Override
		public boolean isVisible() {
			return !parentPage.isEdit() && getModelObject().hasToken();		// TODO ... and security
		}
	});
	deleteTokenPanel.setRenderBodyOnly(true);
	tokenContainer.add(deleteTokenPanel);
	add(tokenContainer);
                               
               WebMarkupContainer retryContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CONTAINER);
	add(retryContainer);
	WebMarkupContainer retryCheckboxContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CHECKBOX_CONTAINER);
	retryContainer.add(retryCheckboxContainer);
	CheckBox retryCheckbox = new CheckBox(ID_TOKEN_RETRY_CHECKBOX, new PropertyModel<Boolean>(getModel(), ResourceRelatedHandlerDto.F_TOKEN_RETRY_UNHANDLED_ERR));
	retryCheckbox.add(enabledIfEdit);
	retryCheckboxContainer.add(retryCheckbox);
}
 
Example 50
Project: vlo-curation   File: SearchResultItemExpandedPanel.java   Source Code and License 5 votes vote down vote up
private PageableListView createResourcesList(String id, SolrFieldModel<String> resourceModel) {
    // list of resources in this record
    final IModel<List<String>> resourceListModel = new CollectionListModel<>(resourceModel);
    // use a a pageable view so that the number of resources actually shown is limited
    return new PageableListView<String>(id, resourceListModel, MAX_RESOURCES_TO_SHOW) {

        @Override
        protected void populateItem(final ListItem<String> item) {
            // get resource string converted into a ResourceInfo model
            final ResourceInfoModel resourceInfoModel = new ResourceInfoModel(resourceStringConverter, item.getModel());

            final Label resourceName = new Label("resourceName", new PropertyModel(resourceInfoModel, "fileName"));
            // once loaded, make Ajax request to resolve handles and update resource link
            resourceName.add(new LazyResourceInfoUpdateBehavior(resolvingResourceStringConverter, resourceInfoModel) {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    // update resource link
                    target.add(resourceName);
                }
            });
            resourceName.setOutputMarkupId(true);
            item.add(new RecordPageLink("resourceLink", SearchResultItemExpandedPanel.this.getModel(), searchContextModel, RecordPage.RESOURCES_SECTION)
                    .add(resourceName));

            item.add(new ExternalLink("downloadLink", new HandleLinkModel(new PropertyModel(resourceInfoModel, "href"))));
            item.add(new ResourceTypeGlyphicon("resourceTypeIcon", new PropertyModel<String>(resourceInfoModel, "resourceType")));
        }
    };
}
 
Example 51
Project: engerek   File: ACAttributeValuePanel.java   Source Code and License 5 votes vote down vote up
private InputPanel createTypedInputComponent(String id, PrismPropertyDefinition definition) {
    QName valueType = definition.getTypeName();

    final String baseExpression = ACValueConstructionDto.F_VALUE;

    InputPanel panel;
    if (DOMUtil.XSD_DATETIME.equals(valueType)) {
        panel = new DatePanel(id, new PropertyModel<XMLGregorianCalendar>(getModel(), baseExpression));
    } else if (ProtectedStringType.COMPLEX_TYPE.equals(valueType)) {
        panel = new PasswordPanel(id, new PropertyModel<ProtectedStringType>(getModel(), baseExpression));
    } else if (DOMUtil.XSD_BOOLEAN.equals(valueType)) {
        panel = new TriStateComboPanel(id, new PropertyModel<Boolean>(getModel(), baseExpression));
    } else if (SchemaConstants.T_POLY_STRING_TYPE.equals(valueType)) {
        panel = new TextPanel<String>(id, new PropertyModel<String>(getModel(), baseExpression + ".orig"), String.class);
    } else {
        Class type = XsdTypeMapper.getXsdToJavaMapping(valueType);
        if (type != null && type.isPrimitive()) {
            type = ClassUtils.primitiveToWrapper(type);
        }
        panel = new TextPanel<String>(id, new PropertyModel<String>(getModel(), baseExpression),
                type);

        if (ObjectType.F_NAME.equals(definition.getName())) {
            panel.getBaseFormComponent().setRequired(true);
        }
    }

    return panel;
}
 
Example 52
Project: engerek   File: ACAttributePanel.java   Source Code and License 5 votes vote down vote up
protected void initLayout(boolean ignoreMandatoryAttributes) {
    Label attributeLabel = new Label(ID_ATTRIBUTE_LABEL, new PropertyModel(getModel(), ACAttributeDto.F_NAME));
    add(attributeLabel);

    WebMarkupContainer required = new WebMarkupContainer(ID_REQUIRED);
    required.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            ACAttributeDto dto = getModel().getObject();
            PrismPropertyDefinition def = dto.getDefinition();

            return def.isMandatory();
        }
    });
    add(required);

    WebMarkupContainer hasOutbound = new WebMarkupContainer(ID_HAS_OUTBOUND);
    hasOutbound.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return hasOutbound();
        }
    });
    add(hasOutbound);


    ListView<ACValueConstructionDto> values = new ListView<ACValueConstructionDto>(ID_VALUES,
            new PropertyModel<List<ACValueConstructionDto>>(getModel(), ACAttributeDto.F_VALUES)) {

        @Override
        protected void populateItem(ListItem<ACValueConstructionDto> listItem) {
            Form form = findParent(Form.class);
            listItem.add(new ACAttributeValuePanel(ID_VALUE, listItem.getModel(), ignoreMandatoryAttributes, form));
        }
    };
    add(values);
}
 
Example 53
Project: engerek   File: RunReportPopupPanel.java   Source Code and License 5 votes vote down vote up
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
  	WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
  	paramPanel.setOutputMarkupId(true);
  	String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
      StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[]{});

      paramPanel.add(new Label("name", paramDisplay)); // use display name rather than property name

      String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
      if (StringUtils.isBlank(paramClass)) {
      	paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
      }
      paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
      paramPanel.add(new Label("type", paramClass));
      
      ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {

  		private static final long serialVersionUID = 1L;

	@Override
  		protected void populateItem(ListItem<JasperReportValueDto> item) {
  			item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));
  			
  		}

  	};
  	listView.setOutputMarkupId(true);
      
      paramPanel.add(listView);
return paramPanel;
  }
 
Example 54
Project: engerek   File: DirectlyEditablePropertyColumn.java   Source Code and License 5 votes vote down vote up
protected InputPanel createInputPanel(String componentId, final IModel<T> model) {
    TextPanel<?> textPanel = new TextPanel<String>(componentId, new PropertyModel<>(model, getPropertyExpression()));
    TextField<?> textField = (TextField<?>) textPanel.getBaseFormComponent();     // UGLY HACK
    textField.add(new AjaxFormComponentUpdatingBehavior("blur") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            onBlur(target, model);
        }
    });
    return textPanel;
}
 
Example 55
Project: engerek   File: ComboPopupPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout() {
    IModel data = new PropertyModel(getModel(), SearchValue.F_VALUE);

    final DisplayableRenderer renderer = new DisplayableRenderer(choices);
    final DropDownChoice input = new DropDownChoice(ID_COMBO_INPUT, data, choices, renderer) {

        @Override
        public IConverter getConverter(Class type) {
            return renderer;
        }
    };
    input.setNullValid(true);
    input.setOutputMarkupId(true);
    add(input);
}
 
Example 56
Project: engerek   File: BrowserPopupPanel.java   Source Code and License 5 votes vote down vote up
private void initLayout() {
    IModel value = new PropertyModel(getModel(), SearchValue.F_LABEL);
    TextField input = new TextField(ID_BROWSER_INPUT, value);
    add(input);

    AjaxLink browse = new AjaxLink(ID_BROWSE) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            browsePerformed(target);
        }
    };
    add(browse);
}
 
Example 57
Project: engerek   File: TextPopupPanel.java   Source Code and License 5 votes vote down vote up
private TextField initTextField() {
//        IModel data = new PropertyModel(getModel(), SearchValue.F_VALUE);

        if (lookup == null) {
            return new TextField(ID_TEXT_INPUT, new PropertyModel(getModel(), SearchValue.F_VALUE));
        }
        
        LookupPropertyModel<String> lookupPropertyModel = new LookupPropertyModel<String>(getModel(), SearchValue.F_VALUE, lookup.asObjectable()) {
        	
        	private static final long serialVersionUID = 1L;

			@Override
        	public boolean isSupportsDisplayName() {
        		return true;
        	}
        };

        AutoCompleteSettings settings = new AutoCompleteSettings();
        settings.setShowListOnEmptyInput(true);

        return new AutoCompleteTextField<String>(ID_TEXT_INPUT, lookupPropertyModel, settings) {

        	private static final long serialVersionUID = 1L;
            @Override
            protected Iterator<String> getChoices(String input) {
                return prepareAutoCompleteList(input).iterator();
            }

            
            
        };
    }
 
Example 58
Project: engerek   File: PageDebugView.java   Source Code and License 5 votes vote down vote up
private void addOrReplaceEditor(){
    editor = new AceEditor("aceEditor", new PropertyModel<>(model, ObjectViewDto.F_XML));
    editor.setModeForDataLanguage(dataLanguage);
    editor.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.addOrReplace(editor);
}
 
Example 59
Project: engerek   File: ContainerValuePanel.java   Source Code and License 5 votes vote down vote up
protected void initLayout() {

        add(new ListView<ContainerItemDto>(ID_ITEM, new PropertyModel(getModel(), ContainerValueDto.F_ITEM_LIST)) {
            @Override
            protected void populateItem(ListItem<ContainerItemDto> item) {
                item.add(new Label(ID_ATTRIBUTE, new PropertyModel(item.getModel(), ContainerItemDto.F_ATTRIBUTE)));
                if (item.getModelObject().getValue() instanceof ContainerValueDto) {
                    item.add(new ContainerValuePanel(ID_VALUE, new PropertyModel(item.getModel(), ContainerItemDto.F_VALUE)));
                } else {        // should be String
                    item.add(new Label(ID_VALUE, new PropertyModel(item.getModel(), ContainerItemDto.F_VALUE)));
                }
            }
        });
    }
 
Example 60
Project: engerek   File: ModificationsPanel.java   Source Code and License 5 votes vote down vote up
protected void initLayout() {

        add(new ListView<ModificationDto>(ID_MODIFICATION, new PropertyModel(getModel(), DeltaDto.F_MODIFICATIONS)) {
            @Override
            protected void populateItem(ListItem<ModificationDto> item) {
                item.add(new Label(ID_ATTRIBUTE, new PropertyModel(item.getModel(), ModificationDto.F_ATTRIBUTE)));
                item.add(new Label(ID_CHANGE_TYPE, new PropertyModel(item.getModel(), ModificationDto.F_CHANGE_TYPE)));
                if (item.getModelObject().getValue() instanceof ContainerValueDto) {
                    item.add(new ContainerValuePanel(ID_VALUE, new Model((ContainerValueDto) item.getModelObject().getValue())));
                } else {    // should be String
                    item.add(new Label(ID_VALUE, new PropertyModel(item.getModel(), ModificationDto.F_VALUE)));
                }
            }
        });
    }