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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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);
}