/** * Creates a new DateLabel using the provided converter. * * @param id * The id of the text field * @param model * The model * @param converter * the date converter * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel withConverter(String id, IModel<Date> model, DateConverter converter) { return new DateLabel(id, model, converter); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param datePattern * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available * patterns. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDatePattern(String id, String datePattern) { return forDatePattern(id, null, datePattern); }
/** * Creates a new DateLabel using the provided converter. * * @param id * The id of the text field * @param converter * the date converter * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel withConverter(String id, DateConverter converter) { return withConverter(id, null, converter); }
/** * {@inheritDoc} */ @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String s = getDefaultModelObjectAsString(); if (before != null) { s = before + s; } if (after != null) { s = s + after; } replaceComponentTagBody(markupStream, openTag, s); }
public static void main(String[] args) { JFrame wnd = new JFrame("DateLabel Test"); wnd.setLocation(200, 200); wnd.setSize(300, 300); wnd.setLayout(null); wnd.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); DateLabel lblDate1 = new DateLabel(24, 12, 2014, "dd.MM.yyyy"); lblDate1.setLocation(10, 10); lblDate1.setSize(100, 15); wnd.add(lblDate1); DateLabel lblDate2 = new DateLabel(24, 12, 2014, "MM/dd/yyyy"); lblDate2.setLocation(10, 30); lblDate2.setSize(100, 15); wnd.add(lblDate2); wnd.setVisible(true); lblDate2.setDay(lblDate1.getDay() + 7); } }
public ReportsPerspective(IPluginContext context, IPluginConfig config) { super(context, config, "reports"); setOutputMarkupId(true); refreshGroup = new WebMarkupContainer("refresh-group"); refreshGroup.add(new Label("latest-refresh-label", new StringResourceModel("last-refresh-label", this, null))); lastRefreshDateLabel = new DateLabel("latest-refresh-date", new PatternDateConverter("HH:mm", false)); lastRefreshDateLabel.setOutputMarkupId(true); refreshGroup.add(lastRefreshDateLabel); AjaxLink<String> refreshLink = new AjaxLink<String>("refresh-link") { @Override public void onClick(final AjaxRequestTarget target) { try { Session session = UserSession.get().getJcrSession(); session.save(); session.refresh(false); lastRefreshDateLabel.setDefaultModel(Model.of(new Date())); target.add(lastRefreshDateLabel); } catch (RepositoryException repositoryException) { log.error("Error refreshing jcr session.", repositoryException); } target.appendJavaScript("if (typeof Hippo.Reports.RefreshObservableInstance !== 'undefined') { Hippo.Reports.RefreshObservableInstance.fireEvent('refresh'); }"); } }; refreshLink.add(new Label("refresh-link-label", new StringResourceModel("refresh-link-text", this, null))); refreshGroup.add(refreshLink); add(refreshGroup); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forShortStyle(String id) { return forShortStyle(id, null); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param dateStyle * style to use in case no pattern is provided. Must be two characters from the set * {"S", "M", "L", "F", "-"}. Must be not null. See * {@link DateTimeFormat#forStyle(String)} for options. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDateStyle(String id, String dateStyle) { return forDateStyle(id, null, dateStyle); }
/** * {@inheritDoc} */ @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String s = getDefaultModelObjectAsString(); if (before != null) { s = before + s; } if (after != null) { s = s + after; } replaceComponentTagBody(markupStream, openTag, s); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forShortStyle(String id) { return forShortStyle(id, null); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param dateStyle * style to use in case no pattern is provided. Must be two characters from the set * {"S", "M", "L", "F", "-"}. Must be not null. See * {@link DateTimeFormat#forStyle(String)} for options. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDateStyle(String id, String dateStyle) { return forDateStyle(id, null, dateStyle); }
/** * Creates a new DateLabel using the provided converter. * * @param id * The id of the text field * @param model * The model * @param converter * the date converter * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel withConverter(String id, IModel<Date> model, DateConverter converter) { return new DateLabel(id, model, converter); }
/** * Creates a new DateLabel using the provided converter. * * @param id * The id of the text field * @param converter * the date converter * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel withConverter(String id, DateConverter converter) { return withConverter(id, null, converter); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param datePattern * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available * patterns. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDatePattern(String id, String datePattern) { return forDatePattern(id, null, datePattern); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param model * The model * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forShortStyle(String id, IModel<Date> model) { return new DateLabel(id, model, new StyleDateConverter(true)); }
if (viewOnly) { fragment = new Fragment("frag", "viewer"); fragment.add( DateLabel.withConverter("date", model, new InternalDateConverter()) ); DateLabel tzLabel = DateLabel.withConverter("timezone", model, new TimeZoneConverter() ); fragment.add(tzLabel);
final IModel<List<MetricValue>> metricMdl = Model.ofList(Collections.emptyList()); Label time = DateLabel.forDatePattern("time", timeMdl, datePattern); time.setOutputMarkupId(true); add(time);
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param model * The model * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forShortStyle(String id, IModel<Date> model) { return new DateLabel(id, model, new StyleDateConverter(true)); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param model * The model * @param datePattern * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available * patterns. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDatePattern(String id, IModel<Date> model, String datePattern) { return new DateLabel(id, model, new PatternDateConverter(datePattern, true)); }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param model * The model * @param datePattern * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available * patterns. * @return new instance * * @see org.apache.wicket.markup.html.form.TextField */ public static DateLabel forDatePattern(String id, IModel<Date> model, String datePattern) { return new DateLabel(id, model, new PatternDateConverter(datePattern, true)); }