/** * 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 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 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 * @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)); }
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); } }
/** * 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)); }
public View(String id, Node dateNode, IModel<Date> valueModel) throws RepositoryException { super(id, "view", DatePickerPlugin.this); add(new DateLabel("label", valueModel, new StyleDateConverter(true))); String weekOfYear = dateNode.hasProperty(HIPPOSTD_WEEKOFYEAR) ? dateNode.getProperty(HIPPOSTD_WEEKOFYEAR).getString() : "-"; add(new Label("weekofyear", weekOfYear)); if (dateNode.hasProperty(HIPPOSTD_DAYOFWEEK)) { add(new Label("dayofweek", new TypeTranslator(new JcrNodeTypeModel(HIPPOSTD_DATE)).getValueName( HIPPOSTD_DAYOFWEEK, new Model<String>(dateNode.getProperty(HIPPOSTD_DAYOFWEEK).getString())))); } else { add(new Label("dayofweek", "-")); } String dayOfYear = dateNode.hasProperty(HIPPOSTD_DAYOFYEAR) ? dateNode.getProperty(HIPPOSTD_DAYOFYEAR).getString() : "-"; add(new Label("dayofyear", dayOfYear)); } }
/** * Creates a new DateLabel defaulting to using a short date pattern * * @param id * The id of the text field * @param model * The model * @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, IModel<Date> model, String dateStyle) { return new DateLabel(id, model, new StyleDateConverter(dateStyle, 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 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, IModel<Date> model, String dateStyle) { return new DateLabel(id, model, new StyleDateConverter(dateStyle, true)); }
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); }