This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit a8d5288f1d4b48ea2f7c755f5fd351704d8e8752 Author: Eric Chatellier <chatellier@codelutin.com> Date: Mon Feb 29 13:00:15 2016 +0100 refs #1329: Use task pane to improve ui --- .../org/chorem/jtimer/ui/report/ReportView.java | 193 ++++++++------------- .../ui/report/resources/ReportView.properties | 3 +- .../ui/report/resources/ReportView_fr.properties | 1 + 3 files changed, 78 insertions(+), 119 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/ui/report/ReportView.java b/src/main/java/org/chorem/jtimer/ui/report/ReportView.java index f60d7e7..6af7051 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/ReportView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/ReportView.java @@ -22,7 +22,6 @@ package org.chorem.jtimer.ui.report; -import java.awt.BorderLayout; import java.awt.Color; import java.awt.Desktop; import java.awt.Font; @@ -42,7 +41,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -71,6 +69,8 @@ import org.jdesktop.application.Action; import org.jdesktop.application.Application; import org.jdesktop.application.FrameView; import org.jdesktop.swingx.JXDatePicker; +import org.jdesktop.swingx.JXTaskPane; +import org.jdesktop.swingx.JXTaskPaneContainer; /** * Reports UI. @@ -141,6 +141,7 @@ public class ReportView extends FrameView implements DocumentListener { // modify frame name // otherwise, get parent frame dimention getFrame().setName("reportFrame"); + getFrame().setTitle(getResourceMap().getString("reportTitle")); this.core = core; this.uncheckedTaskSet = new HashSet<>(); @@ -164,65 +165,52 @@ public class ReportView extends FrameView implements DocumentListener { */ protected JComponent getMainComponent() { - JPanel configComponent = new JPanel(new GridBagLayout()); + JPanel configComponent = new JXTaskPaneContainer(); // panel for options - JPanel panelOption = new JPanel(new GridBagLayout()); - panelOption.setBorder(BorderFactory.createTitledBorder(getResourceMap() - .getString("reportOptions"))); + JXTaskPane panelGeneral = new JXTaskPane(getResourceMap().getString("reportGeneral")); + panelGeneral.setLayout(new GridBagLayout()); + panelGeneral.setSpecial(true); // first date picker JLabel labelFrom = new JLabel(getResourceMap().getString("reportFrom")); - panelOption.add(labelFrom, new GridBagConstraints(0, 0, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(labelFrom, new GridBagConstraints(0, 0, 1, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); datePickerFrom = new JXDatePicker(); datePickerFrom.getMonthView().setDayForeground(Calendar.SUNDAY, Color.RED); datePickerFrom.setFormats(DateFormat.getDateInstance(DateFormat.FULL)); - panelOption.add(datePickerFrom, new GridBagConstraints(1, 0, 2, 1, 1, - 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(datePickerFrom, new GridBagConstraints(1, 0, 2, 1, 1, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); // second date picker JLabel labelTo = new JLabel(getResourceMap().getString("reportTo")); - panelOption.add(labelTo, new GridBagConstraints(0, 1, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(labelTo, new GridBagConstraints(0, 1, 1, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); datePickerTo = new JXDatePicker(); datePickerTo.getMonthView().setDayForeground(Calendar.SUNDAY, Color.RED); datePickerTo.setFormats(DateFormat.getDateInstance(DateFormat.FULL)); - panelOption.add(datePickerTo, new GridBagConstraints(1, 1, 2, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(datePickerTo, new GridBagConstraints(1, 1, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); // set current week by default currentWeek(); // action button to show current or previous week JButton currentWeekButton = new JButton(); - currentWeekButton.setAction(getContext().getActionMap(this).get( - "currentWeek")); - panelOption.add(currentWeekButton, new GridBagConstraints(3, 0, 1, 1, 0, - 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + currentWeekButton.setAction(getContext().getActionMap(this).get("currentWeek")); + panelGeneral.add(currentWeekButton, new GridBagConstraints(3, 0, 1, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); JButton previousWeekButton = new JButton(); - previousWeekButton.setAction(getContext().getActionMap(this).get( - "previousWeek")); - panelOption.add(previousWeekButton, new GridBagConstraints(3, 1, 1, 1, 0, - 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + previousWeekButton.setAction(getContext().getActionMap(this).get("previousWeek")); + panelGeneral.add(previousWeekButton, new GridBagConstraints(3, 1, 1, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); // Option for period grouping - radioByDay = new JRadioButton( - getResourceMap().getString("reportDaily"), true); - radioByMonth = new JRadioButton(getResourceMap().getString( - "reportMonthly")); - radioByWeek = new JRadioButton(getResourceMap().getString( - "reportWeekly")); - radioByYear = new JRadioButton(getResourceMap().getString( - "reportYearly")); - radioByProject = new JRadioButton(getResourceMap().getString( - "reportByProject")); + radioByDay = new JRadioButton(getResourceMap().getString("reportDaily"), true); + radioByMonth = new JRadioButton(getResourceMap().getString("reportMonthly")); + radioByWeek = new JRadioButton(getResourceMap().getString("reportWeekly")); + radioByYear = new JRadioButton(getResourceMap().getString("reportYearly")); + radioByProject = new JRadioButton(getResourceMap().getString("reportByProject")); ButtonGroup group = new ButtonGroup(); group.add(radioByDay); @@ -231,106 +219,86 @@ public class ReportView extends FrameView implements DocumentListener { group.add(radioByYear); group.add(radioByProject); - panelOption.add(radioByDay, new GridBagConstraints(0, 2, 2, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - panelOption.add(radioByMonth, new GridBagConstraints(2, 2, 2, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - panelOption.add(radioByWeek, new GridBagConstraints(0, 3, 2, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - panelOption.add(radioByYear, new GridBagConstraints(2, 3, 2, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - panelOption.add(radioByProject, new GridBagConstraints(0, 4, 4, 1, 0, - 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(radioByDay, new GridBagConstraints(0, 2, 2, 1, 2, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(radioByMonth, new GridBagConstraints(2, 2, 2, 1, 2, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(radioByWeek, new GridBagConstraints(0, 3, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(radioByYear, new GridBagConstraints(2, 3, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + panelGeneral.add(radioByProject, new GridBagConstraints(0, 4, 4, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); // miscellaneous + JXTaskPane panelOption = new JXTaskPane(getResourceMap().getString("reportOptions")); + panelOption.setLayout(new GridBagLayout()); + checkIncludesAnnotations = new JCheckBox(); - checkIncludesAnnotations.setAction(getContext().getActionMap(this).get( - "reportAnnotations")); - panelOption.add(checkIncludesAnnotations, new GridBagConstraints(0, 5, - 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - checkIncludesAnnotationsTime = new JCheckBox(getResourceMap().getString( - "reportAnnotationsTime")); + checkIncludesAnnotations.setAction(getContext().getActionMap(this).get("reportAnnotations")); + panelOption.add(checkIncludesAnnotations, new GridBagConstraints(0, 5, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + checkIncludesAnnotationsTime = new JCheckBox(getResourceMap().getString("reportAnnotationsTime")); checkIncludesAnnotationsTime.setEnabled(false); - panelOption.add(checkIncludesAnnotationsTime, new GridBagConstraints(2, 5, - 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - checkIncludeIntermediateTotalTime = new JCheckBox(getResourceMap().getString( - "reportIntermediateTotalTime")); - panelOption.add(checkIncludeIntermediateTotalTime, - new GridBagConstraints(0, 6, 4, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelOption.add(checkIncludesAnnotationsTime, new GridBagConstraints(2, 5, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); + checkIncludeIntermediateTotalTime = new JCheckBox(getResourceMap().getString("reportIntermediateTotalTime")); + panelOption.add(checkIncludeIntermediateTotalTime, new GridBagConstraints(0, 6, 4, 1, 1, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 1, 1, 1), 0, 0)); // panel form projects - JPanel panelProjects = new JPanel(new BorderLayout()); - panelProjects.setBorder(BorderFactory - .createTitledBorder(getResourceMap() - .getString("reportProjects"))); + JPanel panelProjects = new JXTaskPane(getResourceMap().getString("reportProjects")); + panelProjects.setLayout(new GridBagLayout()); // show hidden box - showHiddenProjectBox = new JCheckBox(getContext().getActionMap(this) - .get("showHiddenProjects")); - panelProjects.add(showHiddenProjectBox, BorderLayout.NORTH); + showHiddenProjectBox = new JCheckBox(getContext().getActionMap(this).get("showHiddenProjects")); + panelProjects.add(showHiddenProjectBox, new GridBagConstraints(0, 0, 1, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); projectsTree = new JTree(); projectsTree.setRootVisible(true); projectsTree.setEditable(true); projectsTree.setModel(new CheckBoxTreeModel(core, getResourceMap().getString("reportProjectsList") + " :")); - projectsTree.setCellEditor(new CheckBoxTreeCellEditor(core, projectsTree, - uncheckedTaskSet)); - projectsTree.setCellRenderer(new CheckBoxTreeCellRenderer(core, projectsTree, - uncheckedTaskSet)); + projectsTree.setCellEditor(new CheckBoxTreeCellEditor(core, projectsTree, uncheckedTaskSet)); + projectsTree.setCellRenderer(new CheckBoxTreeCellRenderer(core, projectsTree, uncheckedTaskSet)); JScrollPane jspTable = new JScrollPane(projectsTree); - panelProjects.add(jspTable, BorderLayout.CENTER); - - configComponent.add(panelOption, new GridBagConstraints(0, 0, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); + panelProjects.add(jspTable, new GridBagConstraints(0, 1, 1, 1, 1, 1, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 0, 0, 0), 0, 0)); - configComponent.add(panelProjects, new GridBagConstraints(0, 1, 1, 1, 1, - 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(1, 1, 1, 1), 0, 0)); + configComponent.add(panelGeneral); + configComponent.add(panelOption); + configComponent.add(panelProjects); // panel for report text JPanel panelReports = new JPanel(new GridBagLayout()); - panelReports.setBorder(BorderFactory.createTitledBorder(getResourceMap() - .getString("reportContent"))); reportArea = new JTextArea(); reportArea.setFont(new Font("Courier", Font.PLAIN, 12)); reportArea.getDocument().addDocumentListener(this); JScrollPane jspReport = new JScrollPane(reportArea); panelReports.add(jspReport, new GridBagConstraints(0, 0, 3, 1, 1, 1, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(1, 1, 1, 1), 0, 0)); + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); // buttons JButton generateButton = new JButton(); - generateButton.setAction(getContext().getActionMap(this).get( - "generateReport")); - panelReports.add(generateButton, new GridBagConstraints(0, 1, 1, 1, 1, - 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(1, 1, 1, 1), 0, 0)); + generateButton.setAction(getContext().getActionMap(this).get("generateReport")); + panelReports.add(generateButton, new GridBagConstraints(0, 1, 1, 1, 1, 0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); JButton sendMailButton = new JButton(); - sendMailButton.setAction(getContext().getActionMap(this) - .get("sendMail")); - panelReports.add(sendMailButton, new GridBagConstraints(1, 1, 1, 1, 1, - 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(1, 1, 1, 1), 0, 0)); + sendMailButton.setAction(getContext().getActionMap(this).get("sendMail")); + panelReports.add(sendMailButton, new GridBagConstraints(1, 1, 1, 1, 1, 0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); JButton closeButton = new JButton(); closeButton.setAction(getContext().getActionMap(this).get("closeView")); panelReports.add(closeButton, new GridBagConstraints(2, 1, 1, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(1, 1, 1, 1), 0, 0)); - + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); + + // color fix on linux ? + configComponent.setBackground(panelReports.getBackground()); + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, configComponent, panelReports); splitPane.setOneTouchExpandable(true); return splitPane; @@ -434,11 +402,9 @@ public class ReportView extends FrameView implements DocumentListener { .getData().getProjectsList(), uncheckedTaskSet); // make report - String report = reportGenerator.getReportText(reportType, - selectedProjects, datePickerFrom.getDate(), datePickerTo - .getDate(), checkIncludesAnnotations.isSelected(), - checkIncludesAnnotationsTime.isSelected(), - checkIncludeIntermediateTotalTime.isSelected()); + String report = reportGenerator.getReportText(reportType, selectedProjects, datePickerFrom.getDate(), + datePickerTo.getDate(), checkIncludesAnnotations.isSelected(), + checkIncludesAnnotationsTime.isSelected(), checkIncludeIntermediateTotalTime.isSelected()); if (report != null && !report.isEmpty()) { reportArea.setText(report); @@ -583,25 +549,16 @@ public class ReportView extends FrameView implements DocumentListener { firePropertyChange("sendMailEnabled", oldValue, canSendMail); } - /* - * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent) - */ @Override public void changedUpdate(DocumentEvent e) { documentChanged(); } - /* - * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent) - */ @Override public void insertUpdate(DocumentEvent e) { documentChanged(); } - /* - * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent) - */ @Override public void removeUpdate(DocumentEvent e) { documentChanged(); diff --git a/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView.properties b/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView.properties index f007249..e2656a8 100644 --- a/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView.properties +++ b/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView.properties @@ -2,7 +2,7 @@ # #%L # jTimer # %% -# Copyright (C) 2007 - 2012 CodeLutin, Chatellier Eric +# Copyright (C) 2007 - 2016 CodeLutin, Chatellier Eric # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -21,6 +21,7 @@ ### # Report i18n reportTitle=${Application.title} - Report +reportGeneral=General reportOptions=Options reportFrom=From : reportTo=To : diff --git a/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView_fr.properties b/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView_fr.properties index 0287873..20885e5 100644 --- a/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView_fr.properties +++ b/src/main/resources/org/chorem/jtimer/ui/report/resources/ReportView_fr.properties @@ -21,6 +21,7 @@ ### # Report i18n reportTitle=${Application.title} - Rapport +reportGeneral=G\u00E9neral reportOptions=Options reportFrom=De : reportTo=\u00C0 : -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.