Package com.common.vistacalendar

Examples of com.common.vistacalendar.DateExt


        setBackground(CalendarSettings.BACKGROUNDCOLOR);
        Dimension d = new Dimension(180, 120);
        setPreferredSize(d);
        setMaximumSize(d);
        setMinimumSize(d);
        currentDate = new DateExt();
        currentSelectedDate = currentDate.clone();
        currentDate.setFirstDayOfWeek(settings.getStartDay());
        addMouseListener(new MouseAdapter() {

            @Override
View Full Code Here


        setDateMark(currentDate);
        repaint();
    }

    public void setDateMark(DateExt date) {
        DateExt temp = date.clone();
        temp.setDay(1);
        int startDateOfWeek = settings.getStartDay();
        int monthStartDateOfWeek = DateUtils.dayOfWeekToCurrent(temp.getDayOfWeek(), startDateOfWeek);
        actualMonthStartCell = monthStartDateOfWeek + CELLCOLUMNS - 1;
        if (monthStartDateOfWeek == 1) {
            actualMonthStartCell = CELLCOLUMNS * 2;
        }

View Full Code Here

        int cellHeight = height / CELLROWS;
        graph.setColor(CalendarSettings.BACKGROUNDCOLOR);
        graph.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
        int startDateOfWeek = settings.getStartDay();
        DateExt temp = currentDate.clone();
        temp.setDay(1);
        int monthStartDateOfWeek = DateUtils.dayOfWeekToCurrent(temp.getDayOfWeek(), startDateOfWeek);
        actualMonthStartCell = monthStartDateOfWeek + CELLCOLUMNS - 1;
        int x = monthStartDateOfWeek;
        int y = 1;
        if (monthStartDateOfWeek == 1) {
            y++;
            actualMonthStartCell = CELLCOLUMNS * 2;
        }
        int daysInMonth = currentDate.getDaysInMonth();
        actualMonthEndCell = actualMonthStartCell + daysInMonth;
        if(mouseDownSelection!=null){
            int selectedIndex=getIndexOfCell(mouseDownSelection.x, mouseDownSelection.y);
            if(selectedIndex>actualMonthEndCell || selectedIndex<actualMonthStartCell){
                mouseDownSelection=null;
            }
        }
        drawHeader(graph);
        graph.setColor(colorSeparatorLine);
        graph.fillRect(5, cellHeight - 2, width - 10, 2);
        for (int dayCounter = 1; dayCounter <= daysInMonth; dayCounter++) {
            boolean selected = false;
            if (temp.getDate().equals(currentSelectedDate.getDate())) {
                selected = true;
            }
            drawDay(graph, temp, null, x, y, true, selected);
            x++;
            if (x > 7) {
                x = 1;
                y++;
            }
            temp.addDay(1);
        }
        drawPreviousMonth(graph);
        drawNextMonth(graph);
    }
View Full Code Here

        drawPreviousMonth(graph);
        drawNextMonth(graph);
    }

    private void drawPreviousMonth(Graphics2D graph) {
        DateExt prevDate = currentDate.clone();
        prevDate.addMonth(-1);
        prevDate.setDay(prevDate.getDaysInMonth());//set last day in month. ie 28FEB or 31MARCH
        int limit = CELLCOLUMNS;
        for (int i = actualMonthStartCell - 1; i >= limit; i--) {
            Point p = getCellFromIndex(i);
            drawDay(graph, prevDate, null, (int) p.getX() + 1, (int) p.getY(), false, false);
            prevDate.addDay(-1);
        }
    }
View Full Code Here

            prevDate.addDay(-1);
        }
    }

    private void drawNextMonth(Graphics2D graph) {
        DateExt nextDate = currentDate.clone();
        nextDate.addMonth(1);
        nextDate.setDay(1);
        int lastCell = CELLCOLUMNS * CELLROWS;
        for (int i = actualMonthEndCell; i < lastCell; i++) {
            Point p = getCellFromIndex(i);
            drawDay(graph, nextDate, null, (int) p.getX() + 1, (int) p.getY(), false, false);
            nextDate.addDay(1);
        }
    }
View Full Code Here

        }
        int day = getDayFromCell(mouseDownSelection.x, mouseDownSelection.y);
        if (day == -1) {
            return null;
        }
        DateExt date = currentDate.clone();
        date.setDay(day);
        return date;
    }
View Full Code Here

   
    private void fireAction() {
        if (action == null) {
            return;
        }
        DateExt date = getSelectedDate();
        action.dateSelected(date);
    }
View Full Code Here

            }
            timer = new Timer(1000, new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    DateExt date = getDate();
                    date.addSecond(1);
                    setDate(date);
                    repaint();
                }
            });
            timer.setRepeats(true);
View Full Code Here

            @Override
            public void stateChanged(ChangeEvent e) {
                if (disableActions == true) {
                    return;
                }
                DateExt date = new DateExt((Date) timeSpinner.getValue());
                hour = date.getHour();
                minute = date.getMinute();
                seconds = date.getSeconds();
                repaint();
                enableAutoGo(false);
            }
        });
    }
View Full Code Here

        timeSpinner.setValue(date.getDate());
        disableActions = false;
    }

    public DateExt getDate() {
        return new DateExt().setHour(hour).setMinute(minute).setSeconds(seconds).setMilliseconds(0);
    }
View Full Code Here

TOP

Related Classes of com.common.vistacalendar.DateExt

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.