org.apache.wicket.model.Model Java Examples

The following examples show how to use org.apache.wicket.model.Model. 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
Source File: FieldPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
public FieldPanel<T> setNewModel(final Attributable attributableTO, final String schema) {
    field.setModel(new Model() {

        private static final long serialVersionUID = -4214654722524358000L;

        @Override
        public Serializable getObject() {
            return (!attributableTO.getPlainAttr(schema).get().getValues().isEmpty())
                    ? attributableTO.getPlainAttr(schema).get().getValues().get(0)
                    : null;
        }

        @Override
        public void setObject(final Serializable object) {
            attributableTO.getPlainAttr(schema).get().getValues().clear();
            if (object != null) {
                attributableTO.getPlainAttr(schema).get().getValues().add(object.toString());
            }
        }
    });
    
    return this;
}
 
Example #2
Source File: BooleanDropDownTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testNullNotAvailable() {
	inputBoolean = true;
	BooleanDropDown dropDown = new BooleanDropDown("id", Model.of(inputBoolean));
	dropDown.setOutputMarkupId(true);
	getTester().getSession().setLocale(Locale.ENGLISH);
	startFormComponentTestWithMarkup(dropDown, "select", createFormPageMarkup("id"));

	TagTester selectTag = getTester().getTagById(dropDown.getMarkupId());
	TagTester firstOption = selectTag.getChild("option");
	TagTester trueOption = selectTag.getChild("value", "true");
	TagTester falseOption = selectTag.getChild("value", "false");
	
	assertNotEquals(firstOption.getValue(), "Choose");
	assertEquals(trueOption.getAttribute("selected"), "selected");
	assertNull(falseOption.getAttribute("selected"));
}
 
Example #3
Source File: AuditHistoryDetails.java    From syncope with Apache License 2.0 6 votes vote down vote up
private Model<String> toJSON(final AuditEntry auditEntry, final Class<T> reference) {
    try {
        String content = auditEntry.getBefore() == null
                ? MAPPER.readTree(auditEntry.getOutput()).get("entity").toPrettyString()
                : auditEntry.getBefore();

        T entity = MAPPER.readValue(content, reference);
        if (entity instanceof UserTO) {
            UserTO userTO = (UserTO) entity;
            userTO.setPassword(null);
            userTO.setSecurityAnswer(null);
        }

        return Model.of(MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(entity));
    } catch (Exception e) {
        LOG.error("While (de)serializing entity {}", auditEntry, e);
        throw new WicketRuntimeException(e);
    }
}
 
Example #4
Source File: BootstrapPaginatorTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testRenderComponent(){
	WicketTester tester = createTester();
	BootstrapPaginator paginator = new BootstrapPaginator("paginator", Model.of(100)) {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
		}
	};
	paginator.setTotalResults(Model.of(100));
	tester.startComponentInPage(paginator);
	tester.assertDisabled("paginator:first:link");
	tester.assertDisabled("paginator:previous:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:last:link");
}
 
Example #5
Source File: FooterPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public FooterPanel(String id) {
	super(id);
	add(new Label("smile", new StringResourceModel("footer.links.smile", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false));
	add(new BookmarkablePageLink<Void>("aboutLink", AboutPage.class));
	WebMarkupContainer gitHubProjectContainer = new WebMarkupContainer("gitHubProjectContainer") {
		private static final long serialVersionUID = 1L;
		
		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(StringUtils.hasText(ExternalLinks.get(configurer).getGitHubProject()));
		}
	};
	add(gitHubProjectContainer);
	gitHubProjectContainer.add(new Label("gitHubProject", new StringResourceModel("footer.links.gitHubProject", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false));
	
	add(new Label("twitter", new StringResourceModel("footer.links.twitter", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false));
	
	add(new ObfuscatedEmailLink("contactUsLink", Model.of(configurer.getLinkContactUs())));

	add(new ExternalLink("smileLink", configurer.getLinkSmile()));
}
 
Example #6
Source File: StudentVisitsWidget.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private Fragment getLazyLoadedMiniStats(String markupId) {
    Fragment ministatFragment = new Fragment(markupId, "ministatFragment", this);
    int miniStatsCount = widgetMiniStats != null ? widgetMiniStats.size() : 0;
    Loop miniStatsLoop = new Loop("widgetRow", miniStatsCount) {
        private static final long serialVersionUID = 1L;
        @Override
        protected void populateItem(LoopItem item) {
            int index = item.getIndex();
            WidgetMiniStat ms = widgetMiniStats.get(index);

            Label widgetValue = new Label("widgetValue", Model.of(ms.getValue()));
            Label widgetLabel = new Label("widgetLabel", Model.of(ms.getLabel()));
            WebMarkupContainer widgetIcon = new WebMarkupContainer("widgetIcon");
            widgetIcon.add(new AttributeAppender("class", " " + ms.getSecondValue()));

            item.add(widgetValue);
            item.add(widgetLabel);
            item.add(widgetIcon);
        }
    };
    ministatFragment.add(miniStatsLoop);
    return ministatFragment;
}
 
Example #7
Source File: ProjectQueryEditor.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
   	
   	input = new TextField<String>("input", getModel());
       input.add(new ProjectQueryBehavior());
       
	input.setLabel(Model.of(getDescriptor().getDisplayName()));
       
       add(input);
	input.add(new OnTypingDoneBehavior() {

		@Override
		protected void onTypingDone(AjaxRequestTarget target) {
			onPropertyUpdating(target);
		}
		
	});
}
 
Example #8
Source File: DateFormatValidator.java    From ontopia with Apache License 2.0 6 votes vote down vote up
@Override
protected void onValidate(IValidatable<String> validatable) {
  final String value = validatable.getValue();
  if (value == null) return;
  try {
    DateFormat df = createDateFormat();
    df.parse(value);
  } catch (ParseException e) {
    String message = Application.get().getResourceSettings().getLocalizer().getString(resourceKey(), (Component)null, 
          new Model<Serializable>(new Serializable() {
            @SuppressWarnings("unused")
            public String getValue() {
              return value;
            }
          }));
    component.error(AbstractFieldInstancePanel.createErrorMessage(fieldInstanceModel, new Model<String>(message)));
  }
}
 
Example #9
Source File: SakaiNavigatorLabel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private SakaiNavigatorLabel(final String id, final PageableComponent table) {
	super(id);
	Model model = new Model(new LabelModelObject(table)); 
	setDefaultModel(
			new StringResourceModel(
					"pager_textStatus", 
					this, 
					model,
					"Viewing {0} - {1} of {2} {3}",
					new Object[] {
						new PropertyModel(model, "from"),
						new PropertyModel(model, "to"),
						new PropertyModel(model, "of"),
						new ResourceModel("pager_textItem"),
					})
	);
}
 
Example #10
Source File: ConnObjectPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Get panel for attribute value (not remote status).
 *
 * @param id component id to be replaced with the fragment content.
 * @param attrTO remote attribute.
 * @return fragment.
 */
private static Panel getValuePanel(final String id, final String schemaName, final Attr attrTO) {
    Panel field;
    if (attrTO == null) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (CollectionUtils.isEmpty(attrTO.getValues())) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (ConnIdSpecialName.PASSWORD.equals(schemaName)) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>("********"));
    } else if (attrTO.getValues().size() == 1) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>(attrTO.getValues().get(0)));
    } else {
        field = new MultiFieldPanel.Builder<>(new ListModel<>(attrTO.getValues())).build(
                id,
                schemaName,
                new AjaxTextFieldPanel("panel", schemaName, new Model<>()));
    }

    field.setEnabled(false);
    return field;
}
 
Example #11
Source File: AnalysisTablePanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private List<IColumn<AnalysisRow, String>> getPropertyColumns(List<String> header) {
List<IColumn<AnalysisRow, String>> columns = new ArrayList<IColumn<AnalysisRow, String>>();
int columnCount = header.size();		

for (int i = 0; i < columnCount; i++) {
	final int j = i;
	columns.add(new PropertyColumn<AnalysisRow, String>(new Model<String>(header.get(i)), header.get(i), "cellValues." + i) {
		public void populateItem(Item cellItem, String componentId, IModel rowModel) {
			setCellStyle(cellItem, rowModel, j);
			super.populateItem(cellItem, componentId, rowModel);
		}
	});
}		
// critical case when someone deleted the database folder
if (columns.size() == 0) {
	columns.add(new PropertyColumn<AnalysisRow, String>(new Model<String>(""), ""));
}
return columns;
  }
 
Example #12
Source File: BooleanDropDownTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testStartingNull() {
	inputBoolean = null;
	BooleanDropDown dropDown = new BooleanDropDown("id", Model.of(inputBoolean));
	dropDown.setOutputMarkupId(true);
	getTester().getSession().setLocale(Locale.ENGLISH);
	startFormComponentTestWithMarkup(dropDown, "select", createFormPageMarkup("id"));

	TagTester selectTag = getTester().getTagById(dropDown.getMarkupId());
	TagTester firstOption = selectTag.getChild("option");
	TagTester trueOption = selectTag.getChild("value", "true");
	TagTester falseOption = selectTag.getChild("value", "false");
	
	assertEquals(firstOption.getValue(), "Choose");
	assertEquals(firstOption.getAttribute("selected"), "selected");
	assertEquals(trueOption.getValue(), "Yes");
	assertEquals(falseOption.getValue(), "No");
}
 
Example #13
Source File: ViewGradeLogAction.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public ActionResponse handleEvent(final JsonNode params, final AjaxRequestTarget target) {
	final String assignmentId = params.get("assignmentId").asText();
	final String studentUuid = params.get("studentId").asText();

	final Map<String, Object> model = new HashMap<>();
	model.put("assignmentId", Long.valueOf(assignmentId));
	model.put("studentUuid", studentUuid);

	final GradebookPage gradebookPage = (GradebookPage) target.getPage();
	final GbModalWindow window = gradebookPage.getGradeLogWindow();

	window.setAssignmentToReturnFocusTo(assignmentId);
	window.setStudentToReturnFocusTo(studentUuid);
	window.setContent(new GradeLogPanel(window.getContentId(), Model.ofMap(model), window));
	window.show(target);

	return new EmptyOkResponse();
}
 
Example #14
Source File: SearchEntityPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
protected List<IColumn<Entity, String>> createTableColumns() {
    List<IColumn<Entity, String>> columns = new ArrayList<IColumn<Entity, String>>();
    columns.add(new EntityNameColumn());
    columns.add(new ActionsColumn());

    if (sectionManager.getSelectedSection() instanceof ReportSection) {
        columns.add(new TypeColumn());
    }

    //columns.add(new EntityPathColumn());

    if (sectionManager.getSelectedSection() instanceof SchedulerSection) {
        columns.add(new ActivePropertyColumn());
        columns.add(new BooleanImagePropertyColumn<Entity>(new Model<String>(getString("ActionContributor.Search.entityRun")), "isRunning", "isRunning"));
        columns.add(new NextRunDateColumn<Entity>());
    }

    columns.add(new CreatedByColumn());
    columns.add(new CreationDateColumn());
    return columns;
}
 
Example #15
Source File: SchemasPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
private List<ITab> buildTabList() {
    List<ITab> tabs = new ArrayList<>();

    for (final SchemaType schemaType : SchemaType.values()) {
        tabs.add(new AbstractTab(new Model<>(schemaType.name())) {

            private static final long serialVersionUID = 1037272333056449378L;

            @Override
            public Panel getPanel(final String panelId) {
                return new SchemaTypePanel(panelId, schemaType, pageRef);
            }
        });
    }

    return tabs;
}
 
Example #16
Source File: DefaultTreeTablePanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
private WebMarkupContainer createTreeRow(final T node)
{
  final WebMarkupContainer row = new WebMarkupContainer(rowRepeater.newChildId(), new Model<TreeTableNode>(node));
  row.setOutputMarkupId(true);
  row.add(AttributeModifier.replace("class", "even"));
  if (clickRows == true) {
    WicketUtils.addRowClick(row);
  }
  rowRepeater.add(row);
  final RepeatingView colBodyRepeater = new RepeatingView("cols");
  row.add(colBodyRepeater);
  final String cssStyle = getCssStyle(node);

  // Column: browse icons
  final TreeIconsActionPanel< ? extends TreeTableNode> treeIconsActionPanel = createTreeIconsActionPanel(node);
  addColumn(row, treeIconsActionPanel, cssStyle);
  treeIconsActionPanel.init(this, node);
  treeIconsActionPanel.add(AttributeModifier.append("style", new Model<String>("white-space: nowrap;")));

  addColumns(colBodyRepeater, cssStyle, node);
  return row;
}
 
Example #17
Source File: TestModels.java    From wicket-orientdb with Apache License 2.0 6 votes vote down vote up
@Test
public void testOQueryModelContextVariables()
{
	IModel<String> nameModel = Model.of();
	OQueryModel<ODocument> queryModel = new OQueryModel<ODocument>("select from ClassA where name = $name");
	queryModel.setContextVariable("name", nameModel);
	nameModel.setObject("doc1");
	assertEquals(1, queryModel.size());
	assertEquals("doc1", queryModel.getObject().get(0).field("name"));
	queryModel.detach();
	
	nameModel.setObject("doc2");
	assertEquals(1, queryModel.size());
	assertEquals("doc2", queryModel.getObject().get(0).field("name"));
	queryModel.detach();
	
	nameModel.setObject("doc3");
	assertEquals(1, queryModel.size());
	assertEquals("doc3", queryModel.getObject().get(0).field("name"));
	queryModel.detach();
}
 
Example #18
Source File: TeamAttendeesPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @see org.apache.wicket.Component#onInitialize()
 */
@Override
protected void onInitialize()
{
  super.onInitialize();
  statusChoiceRenderer = new LabelValueChoiceRenderer<TeamAttendeeStatus>(this, TeamAttendeeStatus.values());
  mainContainer = new WebMarkupContainer("main");
  add(mainContainer.setOutputMarkupId(true));
  attendeesRepeater = new RepeatingView("liRepeater");
  mainContainer.add(attendeesRepeater);
  rebuildAttendees();
  final WebMarkupContainer item = new WebMarkupContainer("liAddNewAttendee");
  mainContainer.add(item);
  item.add(new AttendeeEditableLabel("editableLabel", Model.of(new TeamEventAttendeeDO()), true));
  item.add(new Label("status", "invisible").setVisible(false));
  attendeesRepeater.setVisible(true);
}
 
Example #19
Source File: ConfirmEmailHtmlNotificationDemoPage.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public ConfirmEmailHtmlNotificationDemoPage(PageParameters parameters) {
	super(parameters);
	
	User user = userService.getByUserName(ConsoleNotificationIndexPage.DEFAULT_USERNAME);
	EmailAddress emailAddress = null;
	if (user != null) {
		emailAddress = Iterables.getFirst(user.getAdditionalEmails(), null);
	}
	if (user == null || emailAddress == null) {
		LOGGER.error("There is no user or email address available");
		Session.get().error(getString("console.notifications.noDataAvailable"));
		
		throw new RestartResponseException(ConsoleNotificationIndexPage.class);
	}

	if (emailAddress.getEmailHash() == null) {
		emailAddress.setEmailHash(userService.getHash(user, emailAddress.getEmail()));
	}
	
	add(new ConfirmEmailHtmlNotificationPanel("htmlPanel", Model.of(emailAddress)));
}
 
Example #20
Source File: HibernateValidatorPropertyTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testNotNull() {
	IValidator<Object> validator = new HibernateValidatorProperty(new Model<TestBean>(new TestBean("aaa", "aaa")), "a");
	
	Validatable<Object> validatable = new Validatable<Object>(null);
	validator.validate(validatable);
	
	assertEquals(1, validatable.getErrors().size());
	assertEquals("NotNull", getError(validatable).getKeys().get(0));
}
 
Example #21
Source File: MappingPurposePanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
private void setOpacity(final MappingPurpose mappingPurpose) {
    switch (mappingPurpose) {
        case PROPAGATION:
            propagation.add(new AttributeModifier("style", new Model<>("opacity: 1;")));
            pull.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            both.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            none.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            break;

        case PULL:
            pull.add(new AttributeModifier("style", new Model<>("opacity: 1;")));
            propagation.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            both.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            none.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            break;

        case BOTH:
            both.add(new AttributeModifier("style", new Model<>("opacity: 1;")));
            propagation.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            pull.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            none.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            break;

        case NONE:
            none.add(new AttributeModifier("style", new Model<>("opacity: 1;")));
            pull.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            propagation.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            both.add(new AttributeModifier("style", new Model<>("opacity: 0.3;")));
            break;

        default:
        // do nothing
    }
}
 
Example #22
Source File: RadioButtonLabelPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public RadioButtonLabelPanel(final String id, final IModel<T> model, final String label)
{
  super(id);
  radioButton = new Radio<T>("radioButton", model);
  add(radioButton);
  final Model<String> labelModel = new Model<String>(label);
  radioButton.setLabel(labelModel);
  // I18n key must be implemented as Model not as String because in constructor (before adding this component to parent) a warning will be
  // logged for using getString(String).
  add(new Label("label", labelModel).add(AttributeModifier.replace("for", radioButton.getMarkupId())));
  setRenderBodyOnly(true);
}
 
Example #23
Source File: TypeExtensionDirectoryPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
protected List<IColumn<TypeExtensionTO, String>> getColumns() {
    List<IColumn<TypeExtensionTO, String>> columns = new ArrayList<>();

    columns.add(new PropertyColumn<>(
            Model.of("Any Type"), "anyType", "anyType"));
    columns.add(new PropertyColumn<>(
            new StringResourceModel("auxClasses", this), "auxClasses", "auxClasses"));

    return columns;
}
 
Example #24
Source File: EventRegistryTree.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public EventRegistryTree(String id, List<?> eventRegistry, String toolId) {
	super(id);
	ul = new WebMarkupContainer("ul");
	if(toolId != null) {
		ul.add(new AttributeModifier("style", new Model("padding: 0 0 0 20px; display: none;")));
		ul.add(new AttributeModifier("class", new Model("events")));
	}else{
		ul.add(new AttributeModifier("style", new Model("padding: 0px;")));
		ul.add(new AttributeModifier("class", new Model("tools")));
	}
	add(ul);
	rows = new Rows("row", eventRegistry, toolId);
	ul.add(rows);
}
 
Example #25
Source File: NumberPropertyColumn.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel)
{
  final Object obj = getValue(rowModel);
  final String value;
  if (obj == null) {
    value = "";
  } else if (obj instanceof BigDecimal) {
    if (displayZeroValues == true || NumberHelper.isNotZero((BigDecimal) obj) == true) {
      if (this.scale >= 0) {
        value = NumberFormatter.format((BigDecimal) obj, this.scale);
      } else {
        value = NumberFormatter.format((BigDecimal) obj);
      }
    } else {
      value = "";
    }
  } else {
    value = obj.toString();
  }
  if (suffix != null && value.length() > 0) {
    item.add(new Label(componentId, value + suffix));
  } else {
    item.add(new Label(componentId, value));
  }
  if (cellItemListener != null) {
    cellItemListener.populateItem(item, componentId, rowModel);
  }
  if (textAlign != null) {
    item.add(AttributeModifier.append("style", new Model<String>("text-align: " + textAlign + ";")));
  }
}
 
Example #26
Source File: PFAutoCompleteTextField.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("serial")
public PFAutoCompleteTextField<T> enableTooltips()
{
  WicketUtils.addTooltip(this, new Model<String>() {
    @Override
    public String getObject()
    {
      return PFAutoCompleteTextField.this.getTooltip();
    }
  }, tooltipRightAlignment);
  return this;
}
 
Example #27
Source File: SkillTreeBuilder.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
protected void addColumn(final WebMarkupContainer parent, final Component component, final String cssStyle)
{
  if (cssStyle != null) {
    component.add(AttributeModifier.append("style", new Model<String>(cssStyle)));
  }
  parent.add(component);
}
 
Example #28
Source File: ProvisioningForm.java    From JPPF with Apache License 2.0 5 votes vote down vote up
@Override
protected void createFields() {
  add(nbSlavesField = createIntField(prefix + ".nb_slaves.field", 0, 0, 1024, 1));
  add(interruptField = new CheckBox(prefix + ".interrupt.field", Model.of(true)));
  add(useOverridesField = new CheckBox(prefix + ".use_overrides.field", Model.of(false)));
  add(overridesField = new TextArea<>(prefix + ".overrides.field", Model.of("")));
}
 
Example #29
Source File: AuditTableRendererPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private Link<TableResource> createSaveToExcelLink(final IModel<TableData> model) {
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd_HH-mm-ss");
	String fileName = "audit-" +  type.toLowerCase() + "-" + sdf.format(new Date()) + ".xls";
	ByteArrayResource download = new TableResource(excludeColumns(model.getObject()), fileName);		
	ResourceLink resourceLink =  new ResourceLink<TableResource>("download", download);
	// see busy-indicator.js
	// we do not want a busy indicator in this situation
	resourceLink.add(new AttributeAppender("class", new Model<String>("noBusyIndicator"), " "));
	return resourceLink;
}
 
Example #30
Source File: TestFilters.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Test
public void testDateTimeCollection() throws ParseException {
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    List<Date> list = Lists.newArrayList();
    list.add(format.parse(DATETIME_VALUE_1));
    list.add(format.parse(DATETIME_VALUE_2));
    IModel<OProperty> property = wicket.getProperty(DATETIME_FIELD);
    IFilterCriteriaManager manager = new FilterCriteriaManager(property);
    manager.addFilterCriteria(manager.createCollectionFilterCriteria(new CollectionModel<>(list), Model.of(true)));
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.getObject().size() == 2);
}