List of usage examples for com.google.gwt.core.client JsDate create
public static native JsDate create(String dateString) ;
From source file:org.gwtnode.modules.helenus.TimeUUID.java
License:Apache License
/** * Creates a TimeUUID from a Timestamp //from ww w .ja v a 2 s .c om */ @GwtNodeFunction("constructor") public static TimeUUID fromTimestamp(Date ts) { return fromTimestamp(JsDate.create(ts.getTime())); }
From source file:org.jboss.errai.databinding.client.api.converter.AbstractDateInputConverter.java
License:Apache License
protected static JsDate toJsDate(final Date date) { final Long time = date.getTime(); return JsDate.create(time.doubleValue()); }
From source file:org.jboss.errai.demo.client.local.DateConverter.java
License:Apache License
@Override public Date toModelValue(final String widgetValue) { if (widgetValue == null || widgetValue.equals("")) { return null; }//w w w. ja v a2s . c om final JsDate jsDate = JsDate.create(widgetValue); return new Date((long) jsDate.getTime()); }
From source file:org.jboss.errai.demo.client.local.DateConverter.java
License:Apache License
@Override public String toWidgetValue(final Date modelValue) { if (modelValue == null) { return ""; } else {//from w ww .j a v a 2 s . com final JsDate jsDate = JsDate.create(((Long) modelValue.getTime()).doubleValue()); return toISODate(jsDate); } }
From source file:org.sigmah.offline.js.ContactHistoryJS.java
License:Open Source License
public void setUpdatedAt(Date updatedAt) { if (updatedAt != null) { setUpdatedAt(JsDate.create(updatedAt.getTime())); } }
From source file:org.sigmah.offline.js.ContactJS.java
License:Open Source License
public void setDateCreated(Date dateCreated) { setDateCreated(JsDate.create(dateCreated.getTime())); }
From source file:org.sigmah.offline.js.ContactModelJS.java
License:Open Source License
public void setDateMaintenance(Date dateMaintenance) { setDateMaintenance(JsDate.create(dateMaintenance.getTime())); }
From source file:org.sigmah.offline.js.Values.java
License:Open Source License
public static JsDate toJsDate(Date date) { if (date != null) { return JsDate.create(date.getTime()); } else {/*from ww w .j a v a 2 s .c o m*/ return null; } }
From source file:org.thechiselgroup.choosel.protovis.client.CandlestickChartExample.java
License:Apache License
private void createVisualization(DaySummary[] days) { /* Parse dates. */ DateTimeFormat format = DateTimeFormat.getFormat("dd-MMM-yyyy"); for (DaySummary d : days) { d.jsDate = JsDate.create(format.parse(d.date).getTime()); }//from w w w . j a v a2 s . co m /* Scales. */ int w = 840; int h = 200; final PVLinearScale x = PV.Scale.linear(days, new JsFunction<JsDate>() { public JsDate f(JsArgs args) { DaySummary d = args.getObject(); return d.jsDate; } }).range(0, w); final PVLinearScale y = PV.Scale.linear(days, new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return d.low; } }, new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return d.high; } }).range(0, h).nice(); PVPanel vis = getPVPanel().width(w).height(h).margin(10).left(30); /* Dates. */ vis.add(PV.Rule).data(x.ticks()).left(x).strokeStyle("#eee").anchor(BOTTOM).add(PV.Label) .text(x.tickFormat()); /* Prices. */ vis.add(PV.Rule).data(y.ticks(7)).bottom(y).left(-10).right(-10).strokeStyle(new JsStringFunction() { public String f(JsArgs args) { double d = args.getDouble(); return d % 10 != 0 ? "#ccc" : "#333"; } }).anchor(LEFT).add(PV.Label).textStyle(new JsStringFunction() { public String f(JsArgs args) { double d = args.getDouble(); return d % 10 != 0 ? "#999" : "#333"; } }).text(y.tickFormat()); /* Candlestick. */ vis.add(PV.Rule).data(days).left(new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return x.fd(d.jsDate); } }).bottom(new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return y.fd(Math.min(d.high, d.low)); } }).height(new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return Math.abs(y.fd(d.high) - y.fd(d.low)); } }).strokeStyle(new JsStringFunction() { public String f(JsArgs args) { DaySummary d = args.getObject(); return d.open < d.close ? "#ae1325" : "#06982d"; } }).add(PV.Rule).bottom(new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return y.fd(Math.min(d.open, d.close)); } }).height(new JsDoubleFunction() { public double f(JsArgs args) { DaySummary d = args.getObject(); return Math.abs(y.fd(d.open) - y.fd(d.close)); } }).lineWidth(10); }
From source file:org.thechiselgroup.choosel.protovis.client.CrimeaStackedBarChartExample.java
License:Apache License
private void createVisualization(CrimeanWarData[] crimea) { final PVOrdinalScale fill = PV.colors("lightpink", "darkgray", "lightblue"); final DateTimeFormat format = DateTimeFormat.getFormat("MMM"); int w = 545;//from www.ja va 2 s .c o m int h = 280; final PVOrdinalScale x = PV.Scale.ordinal(crimea, new JsFunction<JsDate>() { @Override public JsDate f(JsArgs args) { CrimeanWarData d = args.getObject(); return JsDate.create(d.getDate().getTime()); } }).splitBanded(0, w); final PVLinearScale y = PV.Scale.linear(0, 2200).range(0, h); PVPanel vis = getPVPanel().width(w).height(h).margin(19.5).right(40); vis.add(PV.Layout.Stack()).layers(Cause.values()).values(crimea).x(new JsDoubleFunction() { public double f(JsArgs args) { CrimeanWarData d = args.getObject(); return x.fd(d.getDate()); } }).y(new JsDoubleFunction() { public double f(JsArgs args) { CrimeanWarData d = args.getObject(0); Cause t = args.getObject(1); return y.fd(t.getValue(d)); } }).layer().add(PV.Bar).antialias(false).width(x.rangeBand()).fillStyle(new JsFunction<PVColor>() { public PVColor f(JsArgs args) { Cause d = args.getObject(1); return fill.fcolor(d); } }).strokeStyle(new JsFunction<PVColor>() { public PVColor f(JsArgs args) { PVBar _this = args.getThis(); return _this.fillStyle().darker(); } }).lineWidth(1).anchor(BOTTOM).add(PV.Label).visible(new JsBooleanFunction() { public boolean f(JsArgs args) { PVLabel _this = args.getThis(); return _this.parent().index() == 0 && _this.index() % 3 == 0; } }).textBaseline(TOP).textMargin(5).text(new JsStringFunction() { public String f(JsArgs args) { CrimeanWarData d = args.getObject(); return format.format(d.getDate()); } }); vis.add(PV.Rule).data(y.ticks(5)).bottom(y).strokeStyle(new JsStringFunction() { public String f(JsArgs args) { double d = args.getDouble(); return d != 0 ? "rgba(255, 255, 255, .7)" : "black"; } }).anchor(RIGHT).add(PV.Label).textMargin(6); }