Java 类com.google.gwt.core.client.JsDate 实例源码

项目:dangchat-sdk    文件:JsMessage.java   
public native static JsMessage create(String rid,
                                      String sortKey,
                                      JsPeerInfo sender,
                                      boolean isOut,
                                      String date,
                                      JsDate fullDate,
                                      String state,
                                      boolean isOnServer,
                                      JsContent content,
                                      JsArray<JsReaction> reactions,
                                      double sortDate)/*-{
    return {
        rid: rid,
        sortKey: sortKey,
        sender: sender,
        isOut: isOut,
        date: date,
        fullDate: fullDate,
        state: state,
        isOnServer: isOnServer,
        content: content,
        reactions: reactions,
        sortDate: sortDate
    };
}-*/;
项目:dangchat-sdk    文件:JsAuthSession.java   
public static native JsAuthSession create(
        int id,
        String holder,
        int appId,
        String appTitle,
        String deviceTitle,
        JsDate authTime,
        String authLocation,
        Double latitude,
        Double longitude
)/*-{
    return {
        id: id,
        holder: holder,
        appId: appId,
        appTitle: appTitle,
        deviceTitle: deviceTitle,
        authTime: authTime,
        authLocation: authLocation,
        latitude: latitude,
        longitude: longitude
    }
}-*/;
项目:actor-platform    文件:JsMessage.java   
public native static JsMessage create(String rid,
                                      String sortKey,
                                      JsPeerInfo sender,
                                      boolean isOut,
                                      String date,
                                      JsDate fullDate,
                                      String state,
                                      boolean isOnServer,
                                      JsContent content,
                                      JsArray<JsReaction> reactions,
                                      double sortDate)/*-{
    return {
        rid: rid,
        sortKey: sortKey,
        sender: sender,
        isOut: isOut,
        date: date,
        fullDate: fullDate,
        state: state,
        isOnServer: isOnServer,
        content: content,
        reactions: reactions,
        sortDate: sortDate
    };
}-*/;
项目:actor-platform    文件:JsAuthSession.java   
public static native JsAuthSession create(
        int id,
        String holder,
        int appId,
        String appTitle,
        String deviceTitle,
        JsDate authTime,
        String authLocation,
        Double latitude,
        Double longitude
)/*-{
    return {
        id: id,
        holder: holder,
        appId: appId,
        appTitle: appTitle,
        deviceTitle: deviceTitle,
        authTime: authTime,
        authLocation: authLocation,
        latitude: latitude,
        longitude: longitude
    }
}-*/;
项目:RedQueryBuilder    文件:JsList.java   
public JsArrayMixed toJso(List<Object> args) {
    JsArrayMixed result = (JsArrayMixed) JavaScriptObject.createArray();
    for (Object o : args) {
        if (o == null) {
            result.push((JavaScriptObject) null);
        } else if (o instanceof String) {
            result.push((String) o);
        } else if (o instanceof Date) {
            result.push(JsDate.create(((Date) o).getTime()));
        } else if (o instanceof Double) {
            result.push(((Double) o).doubleValue());
        } else {
            throw new IllegalArgumentException("Don't know how to handle "
                    + o);
        }
    }
    return result;
}
项目:dangchat-sdk    文件:JsMessage.java   
@Override
public JsMessage convert(Message value) {
    JsMessenger messenger = JsMessenger.getInstance();

    String rid = value.getRid() + "";
    String sortKey = value.getSortDate() + "";

    JsPeerInfo sender = messenger.buildPeerInfo(Peer.user(value.getSenderId()));
    boolean isOut = value.getSenderId() == messenger.myUid();
    boolean isOnServer = value.isOnServer();
    String date = messenger.getFormatter().formatTime(value.getDate());
    JsDate fullDate = JsDate.create(value.getDate());

    JsContent content = JsContent.createContent(value.getContent(),
            value.getSenderId());

    JsArray<JsReaction> reactions = JsArray.createArray().cast();

    for (Reaction r : value.getReactions()) {
        JsArrayInteger uids = (JsArrayInteger) JsArrayInteger.createArray();
        boolean isOwnSet = false;
        for (Integer i : r.getUids()) {
            uids.push(i);
            if (i == messenger.myUid()) {
                isOwnSet = true;
            }
        }
        reactions.push(JsReaction.create(r.getCode(), uids, isOwnSet));
    }
    double sortDate = value.getDate() / 1000.0;
    return create(rid, sortKey, sender, isOut, date, fullDate, Enums.convert(value.getMessageState()), isOnServer, content,
            reactions, sortDate);
}
项目:dangchat-sdk    文件:JsAuthSession.java   
public static JsAuthSession create(ApiAuthSession authSession) {
    String holderStr;

    if (authSession.getAuthHolder() == ApiAuthHolder.OTHERDEVICE) {
        holderStr = "OTHER_DEVICE";
    } else if (authSession.getAuthHolder() == ApiAuthHolder.THISDEVICE) {
        holderStr = "THIS_DEVICE";
    } else {
        holderStr = "UNSUPPORTED";
    }

    return create(authSession.getId(), holderStr, authSession.getAppId(), authSession.getAppTitle(),
            authSession.getDeviceTitle(), JsDate.create(authSession.getAuthTime() * 1000), authSession.getAuthLocation(),
            authSession.getLatitude(), authSession.getLongitude());
}
项目:errai-crud    文件:DateConverter.java   
@Override
public Date toModelValue(final String widgetValue) {
  if (widgetValue == null || widgetValue.equals("")) {
    return null;
  }

  final JsDate jsDate = JsDate.create(widgetValue);
  return new Date((long) jsDate.getTime());
}
项目:errai-crud    文件:DateConverter.java   
@Override
public String toWidgetValue(final Date modelValue) {
  if (modelValue == null) {
    return "";
  } else {
    final JsDate jsDate = JsDate.create(((Long) modelValue.getTime()).doubleValue());
    return toISODate(jsDate);
  }
}
项目:gwt-material    文件:MaterialDatePicker.java   
/**
 * Set the minimum date limit.
 */
public void setDateMin(Date dateMin) {
    this.dateMin = dateMin;

    if (isAttached() && dateMin != null) {
        getPicker().set("min", JsDate.create((double) dateMin.getTime()));
    }
}
项目:gwt-material    文件:MaterialDatePicker.java   
/**
 * Set the maximum date limit.
 */
public void setDateMax(Date dateMax) {
    this.dateMax = dateMax;

    if (isAttached() && dateMax != null) {
        getPicker().set("max", JsDate.create((double) dateMax.getTime()));
    }
}
项目:gwt-material    文件:MaterialDatePicker.java   
/**
 * Set the pickers date.
 */
public void setPickerDate(JsDate date, Element picker) {
    try {
        $(picker).pickadate("picker").set("select", date, () -> {
            DOM.createFieldSet().setPropertyObject("muted", true);
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:gwt-material    文件:MaterialDatePicker.java   
/**
 * Get the pickers date.
 */
protected Date getPickerDate() {
    try {
        JsDate pickerDate = getPicker().get("select").obj;
        return new Date((long) pickerDate.getTime());
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
项目:gwt-material    文件:MaterialDatePicker.java   
@Override
public void setValue(Date value, boolean fireEvents) {
    if (value == null) {
        clear();
        return;
    }
    this.date = value;
    if (isAttached()) {
        suppressChangeEvent = !fireEvents;
        setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput);
        suppressChangeEvent = false;
        label.addStyleName(CssName.ACTIVE);
    }
    super.setValue(value, fireEvents);
}
项目:actor-platform    文件:JsMessage.java   
@Override
public JsMessage convert(Message value) {
    JsMessenger messenger = JsMessenger.getInstance();

    String rid = value.getRid() + "";
    String sortKey = value.getSortDate() + "";

    JsPeerInfo sender = messenger.buildPeerInfo(Peer.user(value.getSenderId()));
    boolean isOut = value.getSenderId() == messenger.myUid();
    boolean isOnServer = value.isOnServer();
    String date = messenger.getFormatter().formatTime(value.getDate());
    JsDate fullDate = JsDate.create(value.getDate());

    JsContent content = JsContent.createContent(value.getContent(),
            value.getSenderId());

    JsArray<JsReaction> reactions = JsArray.createArray().cast();

    for (Reaction r : value.getReactions()) {
        JsArrayInteger uids = (JsArrayInteger) JsArrayInteger.createArray();
        boolean isOwnSet = false;
        for (Integer i : r.getUids()) {
            uids.push(i);
            if (i == messenger.myUid()) {
                isOwnSet = true;
            }
        }
        reactions.push(JsReaction.create(r.getCode(), uids, isOwnSet));
    }
    double sortDate = value.getDate() / 1000.0;
    return create(rid, sortKey, sender, isOut, date, fullDate, Enums.convert(value.getMessageState()), isOnServer, content,
            reactions, sortDate);
}
项目:actor-platform    文件:JsAuthSession.java   
public static JsAuthSession create(ApiAuthSession authSession) {
    String holderStr;

    if (authSession.getAuthHolder() == ApiAuthHolder.OTHERDEVICE) {
        holderStr = "OTHER_DEVICE";
    } else if (authSession.getAuthHolder() == ApiAuthHolder.THISDEVICE) {
        holderStr = "THIS_DEVICE";
    } else {
        holderStr = "UNSUPPORTED";
    }

    return create(authSession.getId(), holderStr, authSession.getAppId(), authSession.getAppTitle(),
            authSession.getDeviceTitle(), JsDate.create(authSession.getAuthTime() * 1000), authSession.getAuthLocation(),
            authSession.getLatitude(), authSession.getLongitude());
}
项目:gwt-material-demo    文件:PickersView.java   
@UiHandler("btnDpValue")
void onDpValue(ClickEvent e) {
    //dpValue.setValue(new Date());
    dpValue.setValue(new Date(), false);
    Long l = new Date().getTime();
    l = l - 2592000000L;      //1 Months in Milliseconds = 2592000000
    Date dd = new Date();
    dd.setTime(l);
    dpValue.setPickerDate(JsDate.create(dd.getTime()), dpValue.getDateInput().getElement());
}
项目:africhat-platform-0.1    文件:JsMessage.java   
public native static JsMessage create(String rid, String sortKey, JsPeerInfo sender, boolean isOut, String date, JsDate fullDate, String state, boolean isOnServer, JsContent content)/*-{
    return {
        rid: rid,
        sortKey: sortKey,
        sender: sender,
        isOut: isOut,
        date: date,
        fullDate: fullDate,
        state: state,
        isOnServer: isOnServer,
        content: content
    };
}-*/;
项目:sigmah    文件:Values.java   
/**
 * Convert the given java date to a javascript one.
 * 
 * @param date
 *          Date to convert (can be <code>null</code>).
 * @return A corresponding javascript date object.
 */
public static JsDate toJsDate(final Date date) {
    if (date != null) {
        return JsDate.create(date.getTime());
    } else {
        return null;
    }
}
项目:sigmah    文件:Values.java   
/**
 * Convert the given javascript date to a java one.
 * 
 * @param date
 *          Date to convert (can be <code>null</code>).
 * @return A corresponding java date object.
 */
public static Date toDate(final JsDate date) {
    if (date != null) {
        return new Date((long) date.getTime());
    } else {
        return null;
    }
}
项目:rva    文件:DataControllerBase.java   
protected Date getValueDate(JavaScriptObject jsDataTable, int columnIndex, int rowIndex) {
    JsDate jsDate = getValueDateNative(jsDataTable, columnIndex, rowIndex);
    if (jsDate != null) {
        return new Date((long) jsDate.getTime());
    }
    else {
        return null;
    }
}
项目:rva    文件:DataControllerBase.java   
protected native JsDate getValueDateNative(JavaScriptObject jsDataTable, int columnIndex, int rowIndex) /*-{
        try {
            var date = jsDataTable.getValue(columnIndex, rowIndex); 

//          if (!isNaN(date.getTime())) {
                return new Date(date.getTime() - (date.getTimezoneOffset() * 60 * 1000));
//          }
//          else 
//              return null;
        }
        catch (e) {
            return null;
        }
    }-*/;
项目:RedQueryBuilder    文件:GwtTestBasics.java   
public void testJsList() throws Throwable {
    JsDate dateIn = JsDate.create();
    dateIn.setUTCFullYear(1914);
    dateIn.setUTCMonth(4);
    dateIn.setUTCDate(15);
    dateIn.setUTCHours(22);
    dateIn.setUTCMinutes(13);

    JsArrayMixed mixed = (JsArrayMixed) JsArrayMixed.createArray();
    mixed.push(dateIn);
    mixed.push(new Double(123.12d));
    mixed.push("123");
    mixed.push("false");

    List<Object> list = JsList.get().toList(mixed);
    Date dateOut = (Date) list.get(0);
    Date dateOutUtc = new Date(dateOut.getTime() + 60 * 1000 * dateOut.getTimezoneOffset());
    assertEquals(14, dateOutUtc.getYear());
    assertEquals(4, dateOutUtc.getMonth());
    assertEquals(15, dateOutUtc.getDate());
    assertEquals(22, dateOutUtc.getHours());
    assertEquals(13, dateOutUtc.getMinutes());

    assertEquals(new Double(123.12d), list.get(1));
    assertEquals("123", list.get(2));
    assertEquals("false", list.get(3));
}
项目:gwt-d3    文件:DataLoader.java   
public static void loadData(final AsyncCallback<Array<Data>> callback) {
    D3.csv("demo-data/readme.csv", new DsvObjectAccessor<Data>() {
        final TimeFormat format = D3.time().format("%b %Y");

        @Override
        public Data apply(final DsvRow d, final int index) {
            Value value = d.get("symbol");
            if ("S&P 500".equals(value.asString())) {
                String symbol = d.get("symbol").asString();
                JsDate date = format.parse(d.get("date").asString());
                double price = d.get("price").asDouble();
                return new Data(symbol, date, price);
            } else {
                return null;
            }
        }
    }, new DsvCallback<Data>() {
        @Override
        public void get(final JavaScriptObject error, final DsvRows<Data> values) {
            if (error != null) {
                XmlHttpRequest xhrError = error.cast();
                String message = xhrError.status() + " (" + xhrError.statusText() + ")";
                callback.onFailure(new RuntimeException(message));
            }
            else {
                callback.onSuccess(values);
            }
        }
    });
}
项目:gwt-d3    文件:TestTimeFormat.java   
private void parse() {
    TimeFormat format = D3.time().format("%b %Y");
    JsDate date = format.parse("Feb 2000");

    assertEquals(2000, date.getFullYear());
    assertEquals(1, date.getMonth());
    assertEquals(1, date.getDate());
    assertEquals(0, date.getHours());
    assertEquals(0, date.getMinutes());
    assertEquals(0, date.getSeconds());
    assertEquals(0, date.getMilliseconds());
}
项目:gwt-d3    文件:TestTimeIntervals.java   
private double parseDate(String dateString) {
    double d = JsDate.parse(dateString);
    if (Double.isNaN(d)) {
        throw new IllegalArgumentException("Invalid date : " + dateString);
    }
    return d;
}
项目:touch4j    文件:DatePickerChangeHandler.java   
private void fireOnEventAndCatch(DatePickerField datePicker, JsDate date, Object eOpts,
                UncaughtExceptionHandler handler) {
    try {
        onChange(datePicker, date, eOpts);
    } catch (Throwable e) {
        handler.onUncaughtException(e);
    }
}
项目:errai-crud    文件:DateConverter.java   
private static native String toISODate(final JsDate date) /*-{
  return date.toISOString().substring(0, 10);
}-*/;
项目:gwtc3    文件:Webapp.java   
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    Data data = Data.create();
    data.setX("x");
    data.setColumns(//
            array(//
                    numberArray("x", (ts += 1000), (ts += 1000), (ts += 1000), (ts += 1000), (ts += 1000), (ts += 1000)),//
                    integerArray("data1", (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000)),//
                    integerArray("data2", (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000))//
            )//
    );
    Map names = Map.create();
    names.put("data1", "data1 Name");
    names.put("data2", "data2 Name");

    data.setNames(names);

    Tick tick = Tick.create();
    tick.setFormat("%H:%M:%S");

    XorY x = XorY.create();
    x.setType(XorY.Type.TIMESERIES);
    x.setTick(tick);

    Axis axis = Axis.create();
    axis.setX(x);

    Subchart subchart = Subchart.create();
    subchart.setShow(true);

    Zoom zoom = Zoom.create();
    zoom.setEnabled(true);

    Format format = Format.create();
    format.setTitle(new ObjectHandler<JsDate>() {
        @Override
        public String handle(JsDate element) {
            Date date = cast(element);
            return dateTimeFormat.format(date);
        }
    });

    Map<Formatter> formatters = Map.create();
    formatters.put("data1", D3.format(","));
    formatters.put("data2", D3.format("$"));
    format.setValue(formatters);

    Tooltip tooltip = Tooltip.create();
    tooltip.setFormat(format);

    Generate generate = new Builder()//
            .withAxis(axis)//
            .withData(data)//
            .withSubchart(subchart)//
            .withZoom(zoom)//
            .withTooltip(tooltip)//
            .build();

    dir(generate);
    final Chart chart = C3.generate(//
            generate//
    );

    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
        @Override
        public boolean execute() {
            FlowData flowData = FlowData.create();
            flowData.setRows(array(//
                    stringArray("x", "data1", "data2"),//
                    integerArray((ts += 1000), (int)(Math.random() * 1000), (int)(Math.random() * 1000))//
            ));

            dir(flowData);
            chart.flow(flowData);

            return true;
        }
    }, 4000);
}
项目:africhat-platform-0.1    文件:JsMessage.java   
@Override
public JsMessage convert(Message value) {
    JsMessenger messenger = JsMessenger.getInstance();

    String rid = value.getRid() + "";
    String sortKey = value.getSortDate() + "";

    JsPeerInfo sender = messenger.buildPeerInfo(Peer.user(value.getSenderId()));
    boolean isOut = value.getSenderId() == messenger.myUid();
    boolean isOnServer = value.isOnServer();
    String date = messenger.getFormatter().formatTime(value.getDate());
    JsDate fullDate = JsDate.create(value.getDate());

    JsContent content;
    if (value.getContent() instanceof TextContent) {
        TextContent textContent = (TextContent) value.getContent();

        String text = ((TextContent) value.getContent()).getText();

        String markdownText = null;
        if (textContent.getTextMessageEx() instanceof ApiTextExMarkdown) {
            markdownText = ((ApiTextExMarkdown) textContent.getTextMessageEx()).getMarkdown();
        }

        content = JsContentText.create(text, markdownText);
    } else if (value.getContent() instanceof ServiceContent) {
        content = JsContentService.create(messenger.getFormatter().formatFullServiceMessage(value.getSenderId(), (ServiceContent) value.getContent()));
    } else if (value.getContent() instanceof DocumentContent) {
        DocumentContent doc = (DocumentContent) value.getContent();

        String fileName = doc.getName();
        String fileExtension = doc.getExt();
        String fileSize = messenger.getFormatter().formatFileSize(doc.getSource().getSize());
        String fileUrl = null;

        if (doc.getSource() instanceof FileRemoteSource) {
            fileUrl = messenger.getFileUrl(((FileRemoteSource) doc.getSource()).getFileReference());
        }

        boolean isUploading = doc.getSource() instanceof FileLocalSource;

        String thumb = null;
        if (doc.getFastThumb() != null) {
            String thumbBase64 = Base64Utils.toBase64(doc.getFastThumb().getImage());
            thumb = "data:image/jpg;base64," + thumbBase64;
        }

        if (value.getContent() instanceof PhotoContent && thumb != null) {
            PhotoContent photoContent = (PhotoContent) value.getContent();
            content = JsContentPhoto.create(
                    fileName, fileExtension, fileSize,
                    photoContent.getW(), photoContent.getH(), thumb,
                    fileUrl, isUploading);
        } else {
            content = JsContentDocument.create(fileName, fileExtension, fileSize,
                    thumb, fileUrl, isUploading);
        }

    } else {
        content = JsContentUnsupported.create();
    }

    return create(rid, sortKey, sender, isOut, date, fullDate, Enums.convert(value.getMessageState()), isOnServer, content);
}
项目:ahome-touch    文件:DateChangeEvent.java   
public DateChangeEvent(DatePickerField source, JsDate newDate, JsDate oldDate) {
    super();
    this.source = source;
    this.newDate = newDate;
    this.oldDate = oldDate;
}
项目:ahome-touch    文件:DateChangeEvent.java   
public JsDate getNewDate() {
    return newDate;
}
项目:ahome-touch    文件:DateChangeEvent.java   
public JsDate getOldDate() {
    return oldDate;
}