Java Code Examples for org.apache.wicket.markup.html.list.ListItem

The following examples show how to use org.apache.wicket.markup.html.list.ListItem. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void onInitialize()
{
	super.onInitialize();
	List<EventDetail> detailsList = getDetails();
	add(new ListView<EventDetail>("detailsList", detailsList)
	{
		@Override
		protected void populateItem(ListItem<EventDetail> item)
		{
			EventDetail ref = item.getModelObject();
			item.add(new Label("key", Model.of(ref.getKey())).setRenderBodyOnly(true));
			Fragment frag = buildDetailsFragment(ref);
			item.add(frag);
		}
	});
}
 
Example 2
Source Project: syncope   Source File: PlainAttrs.java    License: Apache License 2.0 6 votes vote down vote up
public PlainSchemasOwn(
        final String id,
        final Map<String, PlainSchemaTO> schemas,
        final IModel<List<Attr>> attrTOs) {

    super(id, schemas, attrTOs);

    add(new ListView<Attr>("schemas", attrTOs) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<Attr> item) {
            setPanel(schemas, item, false);
        }
    });
}
 
Example 3
public GazeteerList(String aId, IModel<? extends List<Gazeteer>> aChoices)
{
    super(aId, aChoices);
    
    setOutputMarkupPlaceholderTag(true);
    
    gazeteerList = new ListView<Gazeteer>("gazeteer", aChoices) {
        private static final long serialVersionUID = 2827701590781214260L;

        @Override
        protected void populateItem(ListItem<Gazeteer> aItem)
        {
            Gazeteer gazeteer = aItem.getModelObject();
            
            aItem.add(new Label("name", aItem.getModelObject().getName()));

            aItem.add(new LambdaAjaxLink("delete",
                _target -> actionDeleteGazeteer(_target, gazeteer)));

            aItem.add(new DownloadLink("download",
                    LoadableDetachableModel.of(() -> getGazeteerFile(gazeteer)),
                    gazeteer.getName()));
        }
    };
    add(gazeteerList);
}
 
Example 4
Source Project: AppStash   Source File: OrderItemListPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component orderItemList() {
    return new ListView<OrderItemInfo>("orderItems", new PropertyModel<List<OrderItemInfo>>(getDefaultModel(), "orderItems")) {

        private int orderItemCounter = 1;
       
        @Override
        protected void populateItem(ListItem<OrderItemInfo> orderItem) {
            orderItem.add(new Label("orderItemCounter", Model.of(orderItemCounter++)));
            orderItem.add(new Label("product", new PropertyModel<String>(orderItem.getModel(), "product.name")));
            orderItem.add(new Label("description", new PropertyModel<String>(orderItem.getModel(), "product.description")));
            orderItem.add(new Label("totalSum", new PriceModel(new PropertyModel<>(orderItem.getModel(), "totalSum"))));
        }

        @Override
        protected void onDetach() {
            orderItemCounter = 1;
            super.onDetach();
        }
    };
}
 
Example 5
Source Project: inception   Source File: ProjectsOverviewPage.java    License: Apache License 2.0 6 votes vote down vote up
private ListView<ProjectPermission> createRoleBadges(Project aProject)
{
    return new ListView<ProjectPermission>(MID_ROLE, projectService
            .listProjectPermissionLevel(userRepository.getCurrentUser(), aProject))
    {
        private static final long serialVersionUID = -96472758076828409L;

        @Override
        protected void populateItem(ListItem<ProjectPermission> aItem)
        {
            PermissionLevel level = aItem.getModelObject().getLevel();
            aItem.add(new Label(MID_LABEL, getString(
                    Classes.simpleName(level.getDeclaringClass()) + '.' + level.toString())));
        }
    };
}
 
Example 6
Source Project: ontopia   Source File: FunctionBoxesPanel.java    License: Apache License 2.0 6 votes vote down vote up
public FunctionBoxesPanel(String id) {
  super(id);
  
  Form<Object> form = new Form<Object>("functionBoxesForm");
  add(form);
  
  List<Component> list = getFunctionBoxesList("functionBox"); 
  ListView<Component> functionBoxes = new ListView<Component>("functionBoxesList", list) {
    @Override
    protected void populateItem(ListItem<Component> item) {
      item.add(item.getModelObject());
    }
  };
  functionBoxes.setVisible(!list.isEmpty());
  form.add(functionBoxes);
}
 
Example 7
Source Project: the-app   Source File: CartPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component cartView() {
    cartView = new ListView<CartItemInfo>("cart", cartListModel()) {
        @Override
        protected void populateItem(ListItem<CartItemInfo> item) {
            WebMarkupContainer cartItem = new WebMarkupContainer("item");
            cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name")));
            cartItem.add(new IndicatingAjaxLink<Void>("delete") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    IModel<CartItemInfo> model = item.getModel();
                    send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target));
                }
            });
            cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum"))));
            item.add(cartItem);
        }
    };
    cartView.setReuseItems(false);
    cartView.setOutputMarkupId(true);
    return cartView;
}
 
Example 8
Source Project: the-app   Source File: OrderItemListPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component orderItemList() {
    return new ListView<OrderItemInfo>("orderItems", new PropertyModel<List<OrderItemInfo>>(getDefaultModel(), "orderItems")) {

        private int orderItemCounter = 1;

        @Override
        protected void populateItem(ListItem<OrderItemInfo> orderItem) {
            orderItem.add(new Label("orderItemCounter", Model.of(orderItemCounter++)));
            orderItem.add(new Label("product", new PropertyModel<String>(orderItem.getModel(), "product.name")));
            orderItem.add(new Label("description", new PropertyModel<String>(orderItem.getModel(), "product.description")));
            orderItem.add(new Label("totalSum", new PriceModel(new PropertyModel<>(orderItem.getModel(), "totalSum"))));
        }

        @Override
        protected void onDetach() {
            orderItemCounter = 1;
            super.onDetach();
        }
    };
}
 
Example 9
Source Project: yes-cart   Source File: PaymentPage.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the negative result fragment.
 * @return negative result fragment
 */
private MarkupContainer createNegativePaymentResultFragment() {

    error(getLocalizer().getString(NEGATIVE_PAYMENT_NOTES, this));

    final List<CustomerOrderPayment> payments = checkoutServiceFacade.findPaymentRecordsByOrderNumber(getOrderNumber());


    return new Fragment(RESULT_CONTAINER, NEGATIVE_RESULT_FRAGMENT, this)
            .add(
                    new ListView<CustomerOrderPayment>(PAYMENT_DETAIL_LIST, payments) {
                        @Override
                        protected void populateItem(final ListItem<CustomerOrderPayment> item) {
                            final CustomerOrderPayment payment = item.getModelObject();
                            item.add(new Label(PAYMENT_ID_LABEL, String.valueOf(payment.getCustomerOrderPaymentId())));
                            item.add(new Label(PAYMENT_TRANS_ID, StringUtils.defaultIfEmpty(payment.getTransactionReferenceId(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_AUTH_CODE, StringUtils.defaultIfEmpty(payment.getTransactionAuthorizationCode(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_ERROR_CODE, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultCode(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_ERROR_DESCR, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultMessage(), StringUtils.EMPTY)));
                        }
                    }

            );
}
 
Example 10
Source Project: yes-cart   Source File: SkuAttributesSectionView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 *
 * Some times need additional format for value (keyValue.getSecond()).
 *
 */
@Override
protected void onBeforeRender() {

    add(
            new Label(HEAD, headKeyValues.getFirst())
    );

    add(
            new ListView<Pair<String, String>>(KEY_VALUES_LIST, headKeyValues.getSecond()) {
                @Override
                protected void populateItem(ListItem<Pair<String, String>> pairListItem) {
                    final Pair<String, String> keyValue = pairListItem.getModelObject();
                    pairListItem.add(
                            new Label(KEY, keyValue.getFirst())
                    ).add(
                            new Label(VALUE, StringUtils.defaultIfEmpty(keyValue.getSecond(), StringUtils.EMPTY) )
                    );
                }
            }
    );
    super.onBeforeRender();
}
 
Example 11
Source Project: yes-cart   Source File: SkuAttributesView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onBeforeRender() {

    add(
            new ListView<Pair<String, List<Pair<String, String>>>>(ATTR_GROUPS, attributesToShow) {

                @Override
                protected void populateItem(ListItem<Pair<String, List<Pair<String, String>>>> pairListItem) {
                    final Pair<String, List<Pair<String, String>>> item = pairListItem.getModelObject();
                    pairListItem.add(
                            new SkuAttributesSectionView(ATTR_GROUP, item)
                    );
                }

            }
    );

    super.onBeforeRender();
}
 
Example 12
Source Project: yes-cart   Source File: ProductPerPageListView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void populateItem(ListItem<String> stringListItem) {

    final String pageSize = stringListItem.getModelObject();
    final Label label = new Label(WebParametersKeys.QUANTITY, pageSize);

    final AbstractWebPage page = ((AbstractWebPage) getPage());
    final PageParameters pageParameters = page.getPageParameters();
    final LinksSupport links = page.getWicketSupportFacade().links();
    final PaginationSupport pagination = page.getWicketSupportFacade().pagination();

    final PageParameters params = links.getFilteredCurrentParameters(pageParameters);
    params.set(WebParametersKeys.QUANTITY, pageSize);

    final Link pageSizeLink = links.newLink(ITEMS_PER_PAGE, params);
    pageSizeLink.add(label);
    stringListItem.add(pageSizeLink);

    if (pagination.markSelectedPageSizeLink(pageSizeLink, pageParameters, getModelObject(), NumberUtils.toInt(pageSize))) {
        stringListItem.add(new AttributeModifier("class", "active"));
    }

}
 
Example 13
Source Project: Orienteer   Source File: RangeFilterPanel.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public RangeFilterPanel(String id, IModel<List<T>> model, String filterId, IModel<OProperty> propertyModel,
                        IVisualizer visualizer, IFilterCriteriaManager manager) {
    super(id, model, filterId, propertyModel, visualizer, manager, Model.of(true));
    startComponent = (FormComponent<T>) createFilterComponent(Model.of());
    endComponent = (FormComponent<T>) createFilterComponent(Model.of());
    startComponent.setOutputMarkupId(true);
    endComponent.setOutputMarkupId(true);
    List<Component> rangeContainers = Lists.newArrayList();
    rangeContainers.add(getRangeContainer(startComponent, getFilterId(), true));
    rangeContainers.add(getRangeContainer(endComponent, getFilterId(), false));

    ListView<Component> listView = new ListView<Component>("rangeFilters", rangeContainers) {
        @Override
        protected void populateItem(ListItem<Component> item) {
            item.add(item.getModelObject());
        }
    };
    add(listView);
}
 
Example 14
Source Project: AppStash   Source File: CartPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component cartView() {
    cartView = new ListView<CartItemInfo>("cart", cartListModel()) {
        @Override
        protected void populateItem(ListItem<CartItemInfo> item) {
            WebMarkupContainer cartItem = new WebMarkupContainer("item");
            cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name")));
            cartItem.add(new IndicatingAjaxLink<Void>("delete") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    IModel<CartItemInfo> model = item.getModel();
                    send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target));
                }
            });
            cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum"))));
            item.add(cartItem);
        }
    };
    cartView.setReuseItems(false);
    cartView.setOutputMarkupId(true);
    return cartView;
}
 
Example 15
Source Project: syncope   Source File: LogsITCase.java    License: Apache License 2.0 6 votes vote down vote up
private static Component searchLog(final String property, final String searchPath, final String key) {
    Component component = TESTER.getComponentFromLastRenderedPage(searchPath);

    Component result = component.getPage().
            visitChildren(ListItem.class, (final ListItem<LoggerTO> object, final IVisit<Component> visit) -> {
                try {
                    if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter(
                            property, object.getModelObject()).invoke(object.getModelObject()).equals(key)) {
                        visit.stop(object);
                    }
                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                    LOG.error("Error invoke method", ex);
                }
            });
    return result;
}
 
Example 16
Source Project: webanno   Source File: TelemetryDetailsPanel.java    License: Apache License 2.0 6 votes vote down vote up
public TelemetryDetailsPanel(String aId, IModel<List<TelemetryDetail>> aModel)
{
    super(aId, aModel);
    
    ListView<TelemetryDetail> details = new ListView<TelemetryDetail>("details") {
        private static final long serialVersionUID = 5156853968330655499L;

        @Override
        protected void populateItem(ListItem<TelemetryDetail> aItem)
        {
            aItem.add(new Label("key", aItem.getModelObject().getKey()));
            aItem.add(new Label("value", aItem.getModelObject().getValue()));
            aItem.add(new Label("description", aItem.getModelObject().getDescription()));
        }
    };
    
    details.setModel(aModel);

    add(details);
}
 
Example 17
@Override
public void onInitialize() {
	super.onInitialize();

	final List<Assignment> assignments = this.businessService.getGradebookAssignments(SortType.SORT_BY_SORTING);

	add(new ListView<Assignment>("gradeItemList", assignments) {
		@Override
		protected void populateItem(final ListItem<Assignment> assignmentItem) {
			final Assignment assignment = assignmentItem.getModelObject();
			assignmentItem.add(new Label("name", assignment.getName()));
			assignmentItem.add(new HiddenField<Long>("id",
					Model.of(assignment.getId())).add(
							new AttributeModifier("name",
									String.format("id", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[order]", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("current_order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[current_order]", assignment.getId()))));
		}
	});
}
 
Example 18
/**
 * Helper to create a listview for what needs to be shown for new assignments
 * @param markupId wicket markup id
 * @param itemList list of Assignments populated by the item creation steps
 */
private ListView<Assignment> makeAssignmentsToCreateListView(final String markupId, final List<Assignment> itemList) {
	final ListView<Assignment> rval = new ListView<Assignment>(markupId, itemList) {
		@Override
		protected void populateItem(final ListItem<Assignment> item) {
			final Assignment assignment = item.getModelObject();

			String extraCredit = assignment.isExtraCredit() ? yes : no;
			String dueDate = FormatHelper.formatDate(assignment.getDueDate(), "");
			String releaseToStudents = assignment.isReleased() ? yes : no;
			String includeInCourseGrades = assignment.isCounted() ? yes : no;

			item.add(new Label("title", assignment.getName()));
			item.add(new Label("points", assignment.getPoints()));
			item.add(new Label("extraCredit", extraCredit));
			item.add(new Label("dueDate", dueDate));
			item.add(new Label("releaseToStudents", releaseToStudents));
			item.add(new Label("includeInCourseGrades", includeInCourseGrades));
		}
	};

	return rval;
}
 
Example 19
Source Project: webanno   Source File: KeyBindingsConfigurationPanel.java    License: Apache License 2.0 6 votes vote down vote up
private ListView<KeyBinding> createKeyBindingsList(String aId,
        IModel<List<KeyBinding>> aKeyBindings)
{
    return new ListView<KeyBinding>(aId, aKeyBindings)
    {
        private static final long serialVersionUID = 432136316377546825L;

        @Override
        protected void populateItem(ListItem<KeyBinding> aItem)
        {
            AnnotationFeature feature = KeyBindingsConfigurationPanel.this.getModelObject();
            FeatureSupport<?> fs = featureSupportRegistry.getFeatureSupport(feature);

            KeyBinding keyBinding = aItem.getModelObject();

            aItem.add(new Label("keyCombo", keyBinding.asHtml()).setEscapeModelStrings(false));

            aItem.add(
                    new Label("value", fs.renderFeatureValue(feature, keyBinding.getValue())));
            aItem.add(new LambdaAjaxLink("removeKeyBinding",
                _target -> removeKeyBinding(_target, aItem.getModelObject())));
        }
    };
}
 
Example 20
Source Project: webanno   Source File: ProjectCasDoctorPanel.java    License: Apache License 2.0 6 votes vote down vote up
private ListView<LogMessage> createMessagesView(IModel<LogMessageSet> aModel)
{
    return new ListView<LogMessage>("messages", PropertyModel.of(aModel, "messages"))
    {
        private static final long serialVersionUID = 8957632000765128508L;

        @Override
        protected void populateItem(ListItem<LogMessage> aItem)
        {
            IModel<LogMessage> msg = aItem.getModel();
            aItem.add(new Label("level", PropertyModel.of(msg, "level")));
            aItem.add(new Label("source", PropertyModel.of(msg, "source")));
            aItem.add(new Label("message", PropertyModel.of(msg, "message")));
        }
    };
}
 
Example 21
Source Project: webanno   Source File: ProjectLayersPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void populateItem(final ListItem<AnnotationLayer> item)
{
    item.add(new SelectOption<AnnotationLayer>("layer",
            new Model<>(item.getModelObject()))
    {
        private static final long serialVersionUID = 3095089418860168215L;

        @Override
        public void onComponentTagBody(MarkupStream markupStream,
                ComponentTag openTag)
        {
            replaceComponentTagBody(markupStream, openTag,
                    item.getModelObject().getUiName());
        }
    }.add(new AttributeModifier("style",
            "color:" + colors.get(item.getModelObject()) + ";")));
}
 
Example 22
Source Project: inception   Source File: AccessSpecificSettingsPanel.java    License: Apache License 2.0 5 votes vote down vote up
private ListView<KnowledgeBaseProfile> remoteSuggestionsList(String aId,
    List<KnowledgeBaseProfile> aSuggestions)
{
    return new ListView<KnowledgeBaseProfile>(aId, aSuggestions)
    {
        private static final long serialVersionUID = 4179629475064638272L;

        @Override protected void populateItem(ListItem<KnowledgeBaseProfile> item)
        {
            // add a link for one knowledge base with proper label
            LambdaAjaxLink link = new LambdaAjaxLink("suggestionLink", t -> {
                // set all the fields according to the chosen profile
                kbModel.getObject().setUrl(item.getModelObject().getAccess().getAccessUrl());
                // sets root concepts list - if null then an empty list otherwise change the
                // values to IRI and populate the list
                kbModel.getObject().getKb().applyRootConcepts(item.getModelObject());
                kbModel.getObject().getKb().applyMapping(item.getModelObject().getMapping());
                kbInfoModel.setObject(item.getModelObject().getInfo());
                kbModel.getObject().getKb().setFullTextSearchIri(
                    item.getModelObject().getAccess().getFullTextSearchIri());
                kbModel.getObject().getKb()
                    .setDefaultLanguage(item.getModelObject().getDefaultLanguage());
                kbModel.getObject().getKb()
                    .setDefaultDatasetIri(item.getModelObject().getDefaultDataset());
                kbModel.getObject().getKb()
                    .setReification(item.getModelObject().getReification());
                t.add(urlField, defaultDatasetField, infoContainerRemote);
            });
            link.add(new Label("suggestionLabel", item.getModelObject().getName()));
            item.add(link);
        }
    };
}
 
Example 23
public FortunePage() throws Exception {
	List<Fortune> fortunes = new ArrayList<>();

	DataSource dataSource = WicketApplication.get().getDataSource();
	try ( //
			Connection connection = dataSource.getConnection();
			PreparedStatement statement = connection.prepareStatement("SELECT id, message FROM Fortune",
					ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
			ResultSet resultSet = statement.executeQuery()) {

		while (resultSet.next()) {
			fortunes.add(new Fortune(resultSet.getInt("id"), resultSet.getString("message")));
		}
	}

	fortunes.add(new Fortune(0, "Additional fortune added at request time."));

	Collections.sort(fortunes);

	ListView<Fortune> listView = new ListView<Fortune>("fortunes", fortunes) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void populateItem(ListItem<Fortune> item) {
			Fortune fortune = item.getModelObject();
			item.add(new Label("id", fortune.id));
			item.add(new Label("message", fortune.message));
		}
	};
	add(listView);
}
 
Example 24
public ConsoleNotificationIndexPage(PageParameters parameters) {
	super(parameters);
	
	addHeadPageTitleKey("console.notifications");
	
	add(new ListView<PageProvider>("notifications", getNotificationPages()) {
		private static final long serialVersionUID = 1L;

		@SuppressWarnings("unchecked")
		@Override
		protected void populateItem(ListItem<PageProvider> item) {
			Class<? extends Page> pageClass = (Class<? extends Page>) item.getModelObject().getPageClass();
			Link<Void> link = new BookmarkablePageLink<Void>("link", pageClass);
			link.add(new Label("label", new ResourceModel("console.notifications." + pageClass.getSimpleName(), pageClass.getSimpleName())));
			item.add(link);
		}
	});
	
	add(new WebMarkupContainer("emptyList") {
		private static final long serialVersionUID = 6700720373087584498L;

		@Override
		public boolean isVisible() {
			return getNotificationPages().isEmpty();
		}
	});
}
 
Example 25
Source Project: inception   Source File: CurationSidebar.java    License: Apache License 2.0 5 votes vote down vote up
private Form<List<User>> createUserSelection()
{
    Form<List<User>> usersForm = new Form<List<User>>("usersForm",
            LoadableDetachableModel.of(this::listSelectedUsers));
    LambdaAjaxButton<Void> clearButton = new LambdaAjaxButton<>("clear", this::clearUsers);
    LambdaAjaxButton<Void> mergeButton = new LambdaAjaxButton<>("merge", this::merge);
    LambdaAjaxButton<Void> showButton = new LambdaAjaxButton<>("show", this::selectAndShow);
    usersForm.add(clearButton);
    usersForm.add(showButton);
    usersForm.add(mergeButton);
    selectedUsers = new CheckGroup<User>("selectedUsers", usersForm.getModelObject());
    users = new ListView<User>("users",
            LoadableDetachableModel.of(this::listUsers))
    {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<User> aItem)
        {
            aItem.add(new Check<User>("user", aItem.getModel()));
            aItem.add(new Label("name", aItem.getModelObject().getUsername()));

        }
    };
    selectedUsers.add(users);
    usersForm.add(selectedUsers);
    return usersForm;
}
 
Example 26
Source Project: AppStash   Source File: ProductCatalogPage.java    License: Apache License 2.0 5 votes vote down vote up
private Component rowView() {
    return new ListView<List<ProductInfo>>("row", productListModel) {
        @Override
        protected void populateItem(ListItem<List<ProductInfo>> item) {
            item.add(productView(item.getModel()));
        }
    };
}
 
Example 27
Source Project: syncope   Source File: ParametersWizardAttrStep.java    License: Apache License 2.0 5 votes vote down vote up
public ParametersWizardAttrStep(final ParametersWizardPanel.ParametersForm modelObject) {
    this.setOutputMarkupId(true);

    WebMarkupContainer content = new WebMarkupContainer("content");
    content.setOutputMarkupId(true);
    add(content);

    schema = new AjaxTextFieldPanel(
            "schema", getString("schema"), new PropertyModel<>(modelObject.getParam(), "schema"));
    schema.setRequired(true);
    content.add(schema);

    LoadableDetachableModel<List<PlainSchemaTO>> loadableDetachableModel =
            new LoadableDetachableModel<List<PlainSchemaTO>>() {

        private static final long serialVersionUID = 7172461137064525667L;

        @Override
        protected List<PlainSchemaTO> load() {
            return List.of(modelObject.getSchema());
        }
    };

    ListView<PlainSchemaTO> listView = new ListView<PlainSchemaTO>("attrs", loadableDetachableModel) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<PlainSchemaTO> item) {
            final Panel panel = getFieldPanel("panel", modelObject.getParam(), item.getModelObject());
            item.add(panel);
        }
    };

    content.add(listView);
}
 
Example 28
Source Project: oodt   Source File: WorkflowConditionViewer.java    License: Apache License 2.0 5 votes vote down vote up
public WorkflowConditionViewer(String id, String wmUrlStr, String conditionId) {
  super(id);
  this.wm = new WorkflowMgrConn(wmUrlStr);
  final WorkflowCondition cond = this.wm.safeGetConditionById(conditionId);
  add(new Label("condition_id", cond.getConditionId()));
  add(new Label("condition_name", cond.getConditionName()));
  add(new Label("condition_class", cond.getConditionInstanceClassName()));
  final WorkflowConditionConfiguration config = cond.getCondConfig() != null ? 
      cond.getCondConfig():new WorkflowConditionConfiguration();
  List<String> condConfigKeyNames = Arrays.asList(config
      .getProperties().keySet().toArray(
          new String[config.getProperties().size()]));
  Collections.sort(condConfigKeyNames);
  add(new ListView<String>("cond_config", new ListModel<String>(
      condConfigKeyNames)) {
    /*
     * (non-Javadoc)
     * 
     * @see
     * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache
     * .wicket.markup.html.list.ListItem)
     */
    @Override
    protected void populateItem(ListItem<String> item) {
      String keyName = item.getModelObject();
      String keyVal = config.getProperty(keyName);
      item.add(new Label("cond_pname", keyName));
      item.add(new Label("cond_pvalue", keyVal));
    }
  });

}
 
Example 29
Source Project: nextreports-server   Source File: JasperRuntimePanel.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void addComponents() {

    // initialize model
    for (QueryParameter parameter : convertList) {
        if (!runtimeModel.isEdit() || (USER_PARAM.equals(parameter.getName()))) {
            JasperRuntimeParameterModel jasperRuntimeModel = createRuntimeModel(parameter);
            runtimeModel.getParameters().put(parameter.getName(), jasperRuntimeModel);
        }
    }
    if (!runtimeModel.isEdit()) {
        // if some parameters initialized have default values, their dependent parameters
        // have to be initialized too
        for (QueryParameter qp : depParameters) {
            populateDependentParameters(qp, null);
        }
    }

    ListView<QueryParameter> listView = new ListView<QueryParameter>("params", new ArrayList<QueryParameter>(convertMap.values())) {

        @Override
        protected void populateItem(ListItem<QueryParameter> item) {
            createItem(item);
        }

    };
    listView.setReuseItems(true);
    add(listView);

    add(new DropDownChoice("exportType", new PropertyModel(runtimeModel, "exportType"), typeList).setRequired(true));                
}
 
Example 30
Source Project: inception   Source File: ImageSidebar.java    License: Apache License 2.0 5 votes vote down vote up
public ImageSidebar(String aId, IModel<AnnotatorState> aModel,
        AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
        AnnotationPage aAnnotationPage)
{
    super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage);

    mainContainer = new WebMarkupContainer("mainContainer");
    mainContainer.setOutputMarkupId(true);
    add(mainContainer);

    ListView<ImageHandle> images = new ListView<ImageHandle>("images")
    {
        private static final long serialVersionUID = -1203277069357712752L;

        @Override
        protected void populateItem(ListItem<ImageHandle> item)
        {
            item.add(new ExternalLink("open", item.getModelObject().getUrl()));
            LambdaAjaxLink jumpToLink = new LambdaAjaxLink("jumpTo",
                _target -> actionJumpTo(_target, item.getModelObject()));
            item.add(jumpToLink);
            jumpToLink.add(new ExternalImage("image", item.getModelObject().getUrl()));
        }
    };
    images.setModel(LoadableDetachableModel.of(this::listImageUrls));
    
    mainContainer.add(images);
}