Search in sources :

Example 1 with GagoyleDate

use of com.kyj.fx.voeditor.visual.framework.model.GagoyleDate in project Gargoyle by callakrsos.

the class DateUtil method getPeriodDays.

/**
	 * year의 month에 해당하는 일자 목록을 리턴받는다.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 2. 19.
	 * @param year
	 * @param month
	 * @return
	 */
public static List<GagoyleDate> getPeriodDays(int year, int month) {
    GregorianCalendar today = new GregorianCalendar(year, month, 0);
    int maxday = today.getActualMaximum((GregorianCalendar.DAY_OF_MONTH));
    TimeZone timeZone = today.getTimeZone();
    List<GagoyleDate> dateList = new ArrayList<>();
    for (int i = 1; i <= maxday; i++) dateList.add(new GagoyleDate(timeZone, year, month, i));
    return dateList;
}
Also used : TimeZone(java.util.TimeZone) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) GregorianCalendar(java.util.GregorianCalendar) ArrayList(java.util.ArrayList)

Example 2 with GagoyleDate

use of com.kyj.fx.voeditor.visual.framework.model.GagoyleDate in project Gargoyle by callakrsos.

the class DateUtil method getLastDateByWeek.

public static GagoyleDate getLastDateByWeek(int year, int week) {
    Calendar instance = GregorianCalendar.getInstance();
    instance.setWeekDate(year, week, Calendar.SUNDAY);
    TimeZone timeZone = instance.getTimeZone();
    return new GagoyleDate(timeZone, instance.get(GregorianCalendar.YEAR), instance.get(GregorianCalendar.MONTH), instance.get(GregorianCalendar.DAY_OF_MONTH) + 6);
}
Also used : TimeZone(java.util.TimeZone) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate)

Example 3 with GagoyleDate

use of com.kyj.fx.voeditor.visual.framework.model.GagoyleDate in project Gargoyle by callakrsos.

the class DateUtil method getFirstDateByWeek.

/**
	 * 첫번째 주차 날짜정보 리턴.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 7. 14.
	 * @param year
	 * @param week
	 * @return
	 */
public static GagoyleDate getFirstDateByWeek(int year, int week) {
    Calendar instance = GregorianCalendar.getInstance();
    instance.setWeekDate(year, week, Calendar.SUNDAY);
    TimeZone timeZone = instance.getTimeZone();
    return new GagoyleDate(timeZone, instance.get(GregorianCalendar.YEAR), instance.get(GregorianCalendar.MONTH), instance.get(GregorianCalendar.DAY_OF_MONTH));
}
Also used : TimeZone(java.util.TimeZone) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate)

Example 4 with GagoyleDate

use of com.kyj.fx.voeditor.visual.framework.model.GagoyleDate in project Gargoyle by callakrsos.

the class SVNHistoryWalkTest method historyWalkAnalysisGroupingTest.

@Test
public void historyWalkAnalysisGroupingTest() throws SVNException {
    List<GagoyleDate> periodDaysByWeek = DateUtil.getPeriodDaysByWeek();
    GagoyleDate start = periodDaysByWeek.get(0);
    GagoyleDate end = periodDaysByWeek.get(periodDaysByWeek.size() - 1);
    Calendar instance = Calendar.getInstance();
    instance.set(2016, 6, 1);
    Date time = instance.getTime();
    long startRevision = localServerManager2.getRevision(/*start.toDate()*/
    time);
    long endRevision = localServerManager2.getRevision(end.toDate());
    System.out.println("start " + start.toDateString() + " end : " + end.toDateString());
    System.out.println("startRevision " + startRevision + " endRevision : " + endRevision);
    Collection<SVNLogEntry> allLogs = localServerManager2.getAllLogs(startRevision, endRevision);
    //		allLogs.
    SimpleDateFormat format = new SimpleDateFormat(DateUtil.SYSTEM_DATEFORMAT_YYYY_MM_DD);
    TreeMap<String, Long> collect = allLogs.stream().collect(Collectors.groupingBy(v -> format.format(v.getDate()), TreeMap::new, Collectors.mapping(v -> 1, Collectors.counting())));
    //		Map<String, Long> collect = allLogs.stream()
    //				.collect(Collectors.groupingBy(v -> format.format(v.getDate()), Collectors.mapping(v -> 1, Collectors.counting())));
    System.out.println(collect);
}
Also used : ProxyInitializable(com.kyj.fx.voeditor.visual.main.initalize.ProxyInitializable) Properties(java.util.Properties) SVNException(org.tmatesoft.svn.core.SVNException) Date(java.util.Date) Collection(java.util.Collection) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test) JavaSVNManager(com.kyj.scm.manager.svn.java.JavaSVNManager) Collectors(java.util.stream.Collectors) List(java.util.List) Calendar(java.util.Calendar) TreeMap(java.util.TreeMap) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) Before(org.junit.Before) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) Test(org.junit.Test)

Example 5 with GagoyleDate

use of com.kyj.fx.voeditor.visual.framework.model.GagoyleDate in project Gargoyle by callakrsos.

the class ScmCommitComposite method scmHistoryWalk.

private void scmHistoryWalk() throws SVNException {
    List<GagoyleDate> periodDaysByWeek = DateUtil.getPeriodDaysByWeek(supplier.getWeekSize());
    Collection<SVNLogEntry> allLogs = supplier.getAllLogs();
    //		supplier.createStream(allLogs);
    TreeMap<String, Long> dayOfMonths = allLogs.stream().collect(Collectors.groupingBy(v -> FxSVNHistoryDataSupplier.YYYYMMDD_EEE_PATTERN.format(v.getDate()), () -> new TreeMap<>(), Collectors.counting()));
    Map<String, Long> dayOfWeeks = new LinkedHashMap<>();
    //초기값 세팅. [중요한건 정렬순서를 유지해아하므로. 초기값을 넣어준것.]
    for (GagoyleDate d : DateUtil.getPeriodDaysByWeek()) {
        String eee = FxSVNHistoryDataSupplier.EEE_PATTERN.format(d.toDate());
        dayOfWeeks.put(eee, new Long(0));
    }
    //실제값 add
    dayOfWeeks.putAll(allLogs.stream().collect(Collectors.groupingBy(v -> FxSVNHistoryDataSupplier.EEE_PATTERN.format(v.getDate()), Collectors.counting())));
    {
        BarChart<String, Long> barChartDayOfMonth = getBarChartDayOfMonth();
        ObservableList<Data<String, Long>> convert = convert(FxSVNHistoryDataSupplier.YYYYMMDD_EEE_PATTERN, periodDaysByWeek, dayOfMonths, true);
        Series<String, Long> series = new Series<>(SERIES_LABEL, convert);
        barChartDayOfMonth.getData().add(series);
    }
    {
        LineChart<String, Long> lineChartDayOfWeek = getLineChartDayOfWeek();
        ObservableList<Data<String, Long>> convert = convert(FxSVNHistoryDataSupplier.EEE_PATTERN, DateUtil.getPeriodDaysByWeek(), dayOfWeeks, false);
        Series<String, Long> series = new Series<>(SERIES_LABEL, convert);
        lineChartDayOfWeek.getData().add(series);
    }
}
Also used : MouseButton(javafx.scene.input.MouseButton) ListView(javafx.scene.control.ListView) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) MouseEvent(javafx.scene.input.MouseEvent) LoggerFactory(org.slf4j.LoggerFactory) Series(javafx.scene.chart.XYChart.Series) SimpleDateFormat(java.text.SimpleDateFormat) XYChart(javafx.scene.chart.XYChart) LinkedHashMap(java.util.LinkedHashMap) LineChart(javafx.scene.chart.LineChart) ContextMenu(javafx.scene.control.ContextMenu) Map(java.util.Map) FxCollectors(com.kyj.fx.voeditor.visual.util.FxCollectors) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) SVNException(org.tmatesoft.svn.core.SVNException) Data(javafx.scene.chart.XYChart.Data) Collection(java.util.Collection) Node(javafx.scene.Node) Set(java.util.Set) MasterSlaveChartComposite(com.kyj.fx.voeditor.visual.component.MasterSlaveChartComposite) BarChart(javafx.scene.chart.BarChart) Collectors(java.util.stream.Collectors) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) TreeMap(java.util.TreeMap) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ValueUtil(kyj.Fx.dao.wizard.core.util.ValueUtil) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) TreeMap(java.util.TreeMap) LinkedHashMap(java.util.LinkedHashMap) Series(javafx.scene.chart.XYChart.Series) ObservableList(javafx.collections.ObservableList) BarChart(javafx.scene.chart.BarChart) LineChart(javafx.scene.chart.LineChart)

Aggregations

GagoyleDate (com.kyj.fx.voeditor.visual.framework.model.GagoyleDate)7 Calendar (java.util.Calendar)4 GregorianCalendar (java.util.GregorianCalendar)4 TimeZone (java.util.TimeZone)3 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)3 DateUtil (com.kyj.fx.voeditor.visual.util.DateUtil)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 Collectors (java.util.stream.Collectors)2 Test (org.junit.Test)2 SVNException (org.tmatesoft.svn.core.SVNException)2 MasterSlaveChartComposite (com.kyj.fx.voeditor.visual.component.MasterSlaveChartComposite)1 ProxyInitializable (com.kyj.fx.voeditor.visual.main.initalize.ProxyInitializable)1 FxCollectors (com.kyj.fx.voeditor.visual.util.FxCollectors)1 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)1 JavaSVNManager (com.kyj.scm.manager.svn.java.JavaSVNManager)1 Date (java.util.Date)1