git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ListModel: JList constructors were bad
[fanfix.git]
/
ui
/
BreadCrumbsBar.java
diff --git
a/ui/BreadCrumbsBar.java
b/ui/BreadCrumbsBar.java
index 0aea666aafb79da226422679ab508c05fc15d64a..a0e205c9d2152c6c8d0404a42217bdb42e420748 100644
(file)
--- a/
ui/BreadCrumbsBar.java
+++ b/
ui/BreadCrumbsBar.java
@@
-3,7
+3,6
@@
package be.nikiroo.utils.ui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
@@
-13,7
+12,6
@@
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
-import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JToggleButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JToggleButton;
@@
-23,25
+21,28
@@
import javax.swing.event.PopupMenuListener;
public class BreadCrumbsBar<T> extends ListenerPanel {
private class BreadCrumb extends JPanel {
public class BreadCrumbsBar<T> extends ListenerPanel {
private class BreadCrumb extends JPanel {
- private JButton button;
+ private J
Toggle
Button button;
private JToggleButton down;
public BreadCrumb(final DataNode<T> node) {
this.setLayout(new BorderLayout());
private JToggleButton down;
public BreadCrumb(final DataNode<T> node) {
this.setLayout(new BorderLayout());
- button = new JButton(node.toString());
if (!node.isRoot()) {
if (!node.isRoot()) {
- // TODO: allow clicking on root? option?
+ button = new JToggleButton(node.toString());
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- setSelectedNode(node);
+ button.setSelected(false);
+ if (!node.isRoot()) {
+ // TODO: allow clicking on root? option?
+ setSelectedNode(node);
+ }
}
});
}
});
+
+ this.add(button, BorderLayout.CENTER);
}
}
- this.add(button, BorderLayout.CENTER);
-
if (!node.getChildren().isEmpty()) {
// TODO (see things with icons included in viewer)
down = new JToggleButton(">");
if (!node.getChildren().isEmpty()) {
// TODO (see things with icons included in viewer)
down = new JToggleButton(">");
@@
-49,7
+50,6
@@
public class BreadCrumbsBar<T> extends ListenerPanel {
for (final DataNode<T> child : node.getChildren()) {
popup.add(new AbstractAction(child.toString()) {
for (final DataNode<T> child : node.getChildren()) {
popup.add(new AbstractAction(child.toString()) {
-
private static final long serialVersionUID = 1L;
@Override
private static final long serialVersionUID = 1L;
@Override
@@
-60,7
+60,6
@@
public class BreadCrumbsBar<T> extends ListenerPanel {
}
down.addActionListener(new ActionListener() {
}
down.addActionListener(new ActionListener() {
-
@Override
public void actionPerformed(ActionEvent ev) {
if (down.isSelected()) {
@Override
public void actionPerformed(ActionEvent ev) {
if (down.isSelected()) {
@@
-152,7
+151,7
@@
public class BreadCrumbsBar<T> extends ListenerPanel {
if (vertical) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
} else {
if (vertical) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
} else {
- this.setLayout(new
FlowLayout(Flow
Layout.LEADING));
+ this.setLayout(new
WrapLayout(Wrap
Layout.LEADING));
}
for (BreadCrumb crumb : crumbs) {
}
for (BreadCrumb crumb : crumbs) {