public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,\r
boolean hasFocus, int row, int column) {\r
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);\r
- if (value == null) {\r
- return this;\r
- }\r
- setText(value.toString());\r
+ setText(value == null ? "" : value.toString());\r
if (isSelected) {\r
setForeground(table.getSelectionForeground());\r
}\r
@Override\r
public Component getListCellRendererComponent(JList list, Object value, int index,\r
boolean isSelected, boolean cellHasFocus) {\r
- setText(value.toString());\r
+ setText(value == null ? "" : value.toString());\r
if (isSelected) {\r
setBackground(list.getSelectionBackground());\r
setForeground(list.getSelectionForeground());\r
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,\r
boolean hasFocus, int row, int column) {\r
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);\r
- setValue(value, isSelected);\r
+ setValue(value == null ? "" : value, isSelected);\r
return this;\r
}\r
\r
@Override\r
public Component getListCellRendererComponent(JList list, Object value, int index,\r
boolean isSelected, boolean cellHasFocus) {\r
- setValue(value, isSelected);\r
+ setValue(value == null ? "" : value, isSelected);\r
if (isSelected) {\r
setBackground(list.getSelectionBackground());\r
setForeground(list.getSelectionForeground());\r
selectedBranch = branchSelector.getSelectedItem().toString();\r
}\r
updateBranches();\r
- if (selectedBranch != null) {\r
+ if (StringUtils.isEmpty(selectedBranch)) {\r
+ // do not select branch\r
+ branchSelector.setSelectedIndex(-1);\r
+ } else {\r
if (branchChoices.getIndexOf(selectedBranch) > -1) {\r
+ // select branch\r
branchChoices.setSelectedItem(selectedBranch);\r
+ } else {\r
+ // branch does not exist, do not select branch\r
+ branchSelector.setSelectedIndex(-1);\r
}\r
}\r
}\r
\r
branchChoices = new DefaultComboBoxModel();\r
branchSelector = new JComboBox(branchChoices);\r
- branchSelector.setRenderer(new BranchRenderer());\r
+ branchSelector.setRenderer(new BranchRenderer()); \r
\r
searchTypeSelector = new JComboBox(Constants.SearchType.values());\r
searchTypeSelector.setSelectedItem(Constants.SearchType.COMMIT);\r
}\r
});\r
\r
- JPanel northControls = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 0));\r
- northControls.add(new JLabel(Translation.get("gb.repository")));\r
- northControls.add(repositorySelector);\r
- northControls.add(new JLabel(Translation.get("gb.branch")));\r
- northControls.add(branchSelector);\r
- northControls.add(new JLabel(Translation.get("gb.type")));\r
- northControls.add(searchTypeSelector);\r
- northControls.add(new JLabel(Translation.get("gb.maxHits")));\r
- northControls.add(maxHitsSelector);\r
- northControls.add(searchFragment);\r
- northControls.add(search);\r
- northControls.add(prev);\r
- northControls.add(next);\r
+ JPanel queryPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 0));\r
+ queryPanel.add(new JLabel(Translation.get("gb.repository")));\r
+ queryPanel.add(repositorySelector);\r
+ queryPanel.add(new JLabel(Translation.get("gb.branch")));\r
+ queryPanel.add(branchSelector);\r
+ queryPanel.add(new JLabel(Translation.get("gb.type")));\r
+ queryPanel.add(searchTypeSelector);\r
+ queryPanel.add(new JLabel(Translation.get("gb.maxHits")));\r
+ queryPanel.add(maxHitsSelector);\r
+\r
+ JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 0));\r
+ actionsPanel.add(search);\r
+ actionsPanel.add(prev);\r
+ actionsPanel.add(next);\r
+\r
+ JPanel northControls = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));\r
+ northControls.add(queryPanel, BorderLayout.WEST);\r
+ northControls.add(searchFragment, BorderLayout.CENTER);\r
+ northControls.add(actionsPanel, BorderLayout.EAST);\r
+ \r
\r
JPanel northPanel = new JPanel(new BorderLayout(0, Utils.MARGIN));\r
northPanel.add(header, BorderLayout.NORTH);\r