com.google.gwt.core.client.JsDate Java Examples

The following examples show how to use com.google.gwt.core.client.JsDate. 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: JsMessage.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
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
    };
}-*/;
 
Example #2
Source File: JsAuthSession.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
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
    }
}-*/;
 
Example #3
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * 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()));
    }
}
 
Example #4
Source File: Event.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getEnd() /*-{
    var theInstance = this;
    if (theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.Event::event.end) {
        return theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.Event::event.end.toDate();
    }
    return null;
}-*/;
 
Example #5
Source File: Event.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getStart() /*-{
    var theInstance = this;
    if (theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.Event::event.start) {
        return theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.Event::event.start.toDate();
    }
    return null;

}-*/;
 
Example #6
Source File: View.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getIntervalEnd() /*-{
    var theInstance = this;
    var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.intervalEnd;
    if (returnVal) {
        return returnVal.toDate();
    }
    return null;
}-*/;
 
Example #7
Source File: View.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getIntervalStart() /*-{
    var theInstance = this;
    var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.intervalStart;
    if (returnVal) {
        return returnVal.toDate();
    }
    return null;
}-*/;
 
Example #8
Source File: View.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getEnd() /*-{
    var theInstance = this;
    var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.end;
    if (returnVal) {
        return returnVal.toDate();
    }
    return null;
}-*/;
 
Example #9
Source File: View.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
public native JsDate getStart() /*-{
    var theInstance = this;
    var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.start;
    if (returnVal) {
        return returnVal.toDate();
    }
    return null;
}-*/;
 
Example #10
Source File: PickersView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #11
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * 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()));
    }
}
 
Example #12
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example #13
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #14
Source File: MaterialDatePicker.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(Date value, boolean fireEvents) {
    this.date = value;
    if (value == null) {
        clear();
    } else {
        if (isAttached()) {
            suppressChangeEvent = !fireEvents;
            setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput);
            suppressChangeEvent = false;
            label.addStyleName(CssName.ACTIVE);
        }
    }
    super.setValue(value, fireEvents);
}
 
Example #15
Source File: JsMessage.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example #16
Source File: JsAuthSession.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
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());
}
 
Example #17
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSame(JsDate date);
 
Example #18
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isBefore(JsDate date, String s);
 
Example #19
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSame(JsDate date, String s);
 
Example #20
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isAfter(JsDate date);
 
Example #21
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isAfter(JsDate date, String s);
 
Example #22
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSameOrBefore(JsDate date);
 
Example #23
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSameOrBefore(JsDate date, String s);
 
Example #24
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSameOrAfter(JsDate date);
 
Example #25
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isSameOrAfter(JsDate date, String s);
 
Example #26
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isBetween(JsDate date1, JsDate date2);
 
Example #27
Source File: Moment.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@JsMethod
public native boolean isBetween(JsDate date1, JsDate date2, String s);
 
Example #28
Source File: FullCalendar.java    From gwtbootstrap3-extras with Apache License 2.0 4 votes vote down vote up
public void goToDate(final Date d) {
    if (d != null) {
        JsDate date = JsDate.create((double) d.getTime());
        goToDate(getElement().getId(), date);
    }
}
 
Example #29
Source File: FullCalendar.java    From gwtbootstrap3-extras with Apache License 2.0 4 votes vote down vote up
private native void goToDate(String id, JsDate date) /*-{
    $wnd.jQuery('#' + id).fullCalendar('gotoDate',date);
}-*/;
 
Example #30
Source File: FullCalendar.java    From gwtbootstrap3-extras with Apache License 2.0 4 votes vote down vote up
public Date getDate() {
    final JsDate jsDate = getDate(getElement().getId());
    final long time = (long) jsDate.getTime();
    return new Date(time);
}