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 b1e2dc8737649638e407b90854b1a9342abad1ac Author: Eric Chatellier <chatellier@codelutin.com> Date: Fri Mar 4 10:50:54 2016 +0100 refs #880: Reduce idle dialog size --- .../org/chorem/jtimer/ui/tasks/IdleDialog.java | 63 +++++++++++++--------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java b/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java index 49258b6..e8a867b 100644 --- a/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java +++ b/src/main/java/org/chorem/jtimer/ui/tasks/IdleDialog.java @@ -25,6 +25,7 @@ package org.chorem.jtimer.ui.tasks; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; +import java.awt.GridLayout; import java.awt.Insets; import java.util.Timer; @@ -187,65 +188,77 @@ public class IdleDialog extends JDialog { // label JLabel idleIcon = new JLabel(resourceMap.getIcon("idleIcon")); - mainComponent.add(idleIcon, new GridBagConstraints(0, 0, 1, 6, 0, 1, + mainComponent.add(idleIcon, new GridBagConstraints(0, 0, 1, 3, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 5, 10, 10), 0, 0)); // label JLabel idleLabel = new JLabel(resourceMap.getString("idleMessage", JTimer.config.getIdleTime() / (60))); - mainComponent.add(idleLabel, new GridBagConstraints(1, 0, 4, 1, 0, 0, + mainComponent.add(idleLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 3), 0, 0)); taskNameLabel = new JLabel(" "); - mainComponent.add(taskNameLabel, new GridBagConstraints(1, 1, 4, 1, 0, 0, + mainComponent.add(taskNameLabel, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 3, 5), 0, 0)); idleDurationLabel = new JLabel(" "); - mainComponent.add(idleDurationLabel, new GridBagConstraints(1, 2, 4, 1, 0, 0, + mainComponent.add(idleDurationLabel, new GridBagConstraints(1, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 3, 5), 0, 0)); // separator - mainComponent.add(new JSeparator(), new GridBagConstraints(1, 3, 4, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 5), 0, 0)); + mainComponent.add(new JSeparator(), new GridBagConstraints(0, 3, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0)); // label JLabel idleRestart = new JLabel(resourceMap.getString("idleRestart")); - mainComponent.add(idleRestart, new GridBagConstraints(1, 4, 4, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 0, 5), 0, 0)); + mainComponent.add(idleRestart, new GridBagConstraints(0, 4, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0)); + + // buttons + JPanel optionPanel = getOptionPanel(); + mainComponent.add(optionPanel, new GridBagConstraints(0, 5, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 5, 5, 5), 0, 0)); + + // tasks tree + assignPanel = getAssignPanel(); + mainComponent.add(assignPanel, new GridBagConstraints(0, 6, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 5, 5, 0), 0, 0)); + + return mainComponent; + } + + /** + * Build option panel with a GridLayout for all button to get same size. + * + * @return option panel + */ + protected JPanel getOptionPanel() { + JPanel optionPanel = new JPanel(new GridLayout(0, 4, 2, 0)); JButton revertButton = new JButton(); revertButton.setAction(application.getContext().getActionMap(this).get("chooseRevertOption")); revertButton.setHorizontalTextPosition(SwingConstants.CENTER); revertButton.setVerticalTextPosition(SwingConstants.BOTTOM); - mainComponent.add(revertButton, new GridBagConstraints(1, 5, 1, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 5, 5), 0, 0)); + optionPanel.add(revertButton); JButton continueButton = new JButton(); continueButton.setAction(application.getContext().getActionMap(this).get("chooseContinueOption")); continueButton.setHorizontalTextPosition(SwingConstants.CENTER); continueButton.setVerticalTextPosition(SwingConstants.BOTTOM); - mainComponent.add(continueButton, new GridBagConstraints(2, 5, 1, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 5, 5), 0, 0)); + optionPanel.add(continueButton); JButton resumeButton = new JButton(); resumeButton.setAction(application.getContext().getActionMap(this).get("chooseResumeOption")); resumeButton.setHorizontalTextPosition(SwingConstants.CENTER); resumeButton.setVerticalTextPosition(SwingConstants.BOTTOM); - mainComponent.add(resumeButton, new GridBagConstraints(3, 5, 1, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 5, 5), 0, 0)); + optionPanel.add(resumeButton); assignButton = new JToggleButton(); assignButton.setAction(application.getContext().getActionMap(this).get("chooseAssignOption")); assignButton.setHorizontalTextPosition(SwingConstants.CENTER); assignButton.setVerticalTextPosition(SwingConstants.BOTTOM); - mainComponent.add(assignButton, new GridBagConstraints(4, 5, 1, 1, 1, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 5, 5), 0, 0)); + optionPanel.add(assignButton); - assignPanel = getAssignPanel(); - assignPanel.setVisible(false); - mainComponent.add(assignPanel, new GridBagConstraints(1, 6, 4, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 5, 0), 0, 0)); - - return mainComponent; + return optionPanel; } /** @@ -258,7 +271,7 @@ public class IdleDialog extends JDialog { // separator panel.add(new JSeparator(), new GridBagConstraints(0, 0, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 5, 5), 0, 0)); + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 5), 0, 0)); // label JLabel labelIdle = new JLabel(); @@ -283,7 +296,7 @@ public class IdleDialog extends JDialog { setSelectedTask(assignSelectedTask != null); }); panel.add(new JScrollPane(projectsTree), new GridBagConstraints(0, 2, 1, 1, 1, 1, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 3, 5), 0, 0)); // ok JButton assignValidButton = new JButton(); @@ -367,6 +380,8 @@ public class IdleDialog extends JDialog { * Reset some part of the UI. */ protected void reset() { + projectsTree.putClientProperty("JTree.lineStyle", + JTimer.config.isShowTreeLines() ? "Angled" : "None"); assignButton.setSelected(false); assignPanel.setVisible(assignButton.isSelected()); this.pack(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.