Package com.google.gwt.i18n.client

Examples of com.google.gwt.i18n.client.DateTimeFormat$PatternPart


     *
     */
    public Date parseDate(String dateString, String formatString,
            boolean lenient) throws IllegalArgumentException {
        /* DateTimeFormat uses the browser's locale */
        DateTimeFormat format = DateTimeFormat.getFormat(formatString);

        /*
         * Parse month names separately when locale for the DateTimeService is
         * not the same as the browser locale
         */
        dateString = parseMonthName(dateString, formatString);

        Date date;

        if (lenient) {
            date = format.parse(dateString);
        } else {
            date = format.parseStrict(dateString);
        }

        // Some version of Firefox sets the timestamp to 0 if parsing fails.
        if (date != null && date.getTime() == 0) {
            throw new IllegalArgumentException("Parsing of '" + dateString
View Full Code Here


                // Draw the year line
                canvas.moveTo(x, 0);
                canvas.lineTo(x, canvas.getHeight());

                // Add a label
                DateTimeFormat formatter = DateTimeFormat.getFormat("yyyy");
                Label lbl = new Label(formatter.format(year));
                lbl.setStyleName(CLASSNAME_SCALELABEL);
                horizontalScalePanel.add(lbl);
                horizontalScalePanel.setWidgetPosition(lbl, (int)x+14+5, canvas.getHeight()-lbl.getOffsetHeight()+4);

                year = new Date(year.getYear()+1, 0, 1);
View Full Code Here

         *
         * @see java.lang.Object#toString()
         */
        @Override
        public String toString(){
            DateTimeFormat formatter = DateTimeFormat.getShortDateFormat();
            Date f = new Date(from);
            Date t = new Date(to);
            return "Datarange: "+formatter.format(f)+" - "+formatter.format(t)+", points="+points.size()+",max="+maximum.getValue()+", min="+minimum.getValue();
        }
View Full Code Here

     *     The date
     */
    public void setFromDateTextField(Date date){
        intervalStartDate = date;

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, y");
        dateFrom.setText(formatter.format(date));
    }
View Full Code Here

     *     The date
     */
    public void setToDateTextField(Date date){
        intervalEndDate = date;

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, y");
        dateTo.setText(formatter.format(date));
    }
View Full Code Here

        if (event.getRelativeElement() == dateTo.getElement()) {

            dateTo.setStyleName(CLASSNAME_DATEFIELDEDIT);

            DateTimeFormat formatter = DateTimeFormat.getFormat("dd/MM/yyyy");

            dateTo.setText(formatter.format(intervalEndDate));
            dateTo.selectAll();

        } else if (event.getRelativeElement() == dateFrom.getElement()) {
            dateFrom.setStyleName(CLASSNAME_DATEFIELDEDIT);

            DateTimeFormat formatter = DateTimeFormat.getFormat("dd/MM/yyyy");

            dateFrom.setText(formatter.format(intervalStartDate));
            dateFrom.selectAll();
        }
    }
View Full Code Here

        // Start date text field selected
        if (event.getRelativeElement() == dateTo.getElement()) {

            dateTo.setStyleName(CLASSNAME_DATEFIELD);

            DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy");

            Date end = format.parse(dateTo.getText());

            DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, y");

            if (end.compareTo(getEndDate()) <= 0
                    && end.compareTo(intervalStartDate) > 0) {
                dateTo.setText(formatter.format(end));
                intervalEndDate = end;

                setBrowserRange(intervalStartDate, intervalEndDate);
                setDisplayRange(intervalStartDate, intervalEndDate, true);
            } else {
                dateTo.setText(formatter.format(intervalEndDate));
            }

            // End date textfield selected
        } else if (event.getRelativeElement() == dateFrom.getElement()) {

            dateFrom.setStyleName(CLASSNAME_DATEFIELD);

            DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy");
            Date start = format.parse(dateFrom.getText());

            DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, y");

            if (start.compareTo(getStartDate()) >= 0
                    && start.compareTo(intervalEndDate) < 0) {
                dateFrom.setText(formatter.format(start));

                intervalStartDate = start;

                setBrowserRange(intervalStartDate, intervalEndDate);
                setDisplayRange(intervalStartDate, intervalEndDate, true);
            } else {
                dateFrom.setText(formatter.format(intervalStartDate));
            }
        }
    }
View Full Code Here

            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d y");
        DateTimeFormat formatter2 = DateTimeFormat.getFormat("hh:mm a");

        if (monday.before(currentEndDate)) {
            while (monday.before(currentEndDate)) {
                Label lbl = new Label();
                lbl.setStyleName(CLASSNAME_SCALEDATE);
                lbl.setWidth(width + "px");

                if (monday.getHours() == 0) {
                    lbl.setText(formatter.format(monday));
                } else {
                    lbl.setText(formatter2.format(monday));
                }

                timeFromStart = monday.getTime() - currentStartDate.getTime();
                float x = timeFromStart * xUnit + paddingLeft;

                if (gridColor != null) {
                    canvas.moveTo(x, 0);
                    canvas.lineTo(x, canvas.getHeight());
                }

                displayComponentPanel.add(lbl, (int) x, displayComponentPanel
                        .getOffsetHeight() - 15);
                horizontalScaleComponents.add(lbl);

                monday = new Date(monday.getTime() + 2 * HOUR);
            }
        } else {
            while (monday.after(currentStartDate)) {
                Label lbl = new Label();
                lbl.setStyleName(CLASSNAME_SCALEDATE);
                lbl.setWidth(width + "px");

                if (monday.getHours() == 0) {
                    lbl.setText(formatter.format(monday));
                } else {
                    lbl.setText(formatter2.format(monday));
                }

                timeFromStart = monday.getTime() - currentStartDate.getTime();
                float x = timeFromStart * xUnit + paddingLeft;

View Full Code Here

            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d y");
        DateTimeFormat formatter2 = DateTimeFormat.getFormat("hh:mm a");

        if (monday.before(currentEndDate)) {
            while (monday.before(currentEndDate)) {
                Label lbl = new Label();
                lbl.setStyleName(CLASSNAME_SCALEDATE);
                lbl.setWidth(width + "px");

                if (monday.getHours() == 0) {
                    lbl.setText(formatter.format(monday));
                } else {
                    lbl.setText(formatter2.format(monday));
                }

                timeFromStart = monday.getTime() - currentStartDate.getTime();
                float x = timeFromStart * xUnit + paddingLeft;

                if (gridColor != null) {
                    canvas.moveTo(x, 0);
                    canvas.lineTo(x, canvas.getHeight());
                }

                displayComponentPanel.add(lbl, (int) x, displayComponentPanel
                        .getOffsetHeight() - 15);
                horizontalScaleComponents.add(lbl);

                monday = new Date(monday.getTime() + 6 * HOUR);
            }
        } else {
            while (monday.after(currentStartDate)) {
                Label lbl = new Label();
                lbl.setStyleName(CLASSNAME_SCALEDATE);
                lbl.setWidth(width + "px");

                if (monday.getHours() == 0) {
                    lbl.setText(formatter.format(monday));
                } else {
                    lbl.setText(formatter2.format(monday));
                }

                timeFromStart = monday.getTime() - currentStartDate.getTime();
                float x = timeFromStart * xUnit + paddingLeft;

View Full Code Here

            canvas.setStrokeStyle(gridColor);
            canvas.setLineWidth(0.8);
            canvas.beginPath();
        }

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d y");
        while (monday.before(currentEndDate)) {
            Label lbl = new Label();
            lbl.setWidth(width + "px");
            lbl.setText(formatter.format(monday));
            lbl.setStyleName(CLASSNAME_SCALEDATE);

            timeFromStart = monday.getTime() - currentStartDate.getTime();
            float x = timeFromStart * xUnit + paddingLeft;

View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.DateTimeFormat$PatternPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.