diff options
Diffstat (limited to 'src/cppcheckplus/shortcut/MyShortcutPanel.java')
-rw-r--r-- | src/cppcheckplus/shortcut/MyShortcutPanel.java | 194 |
1 files changed, 92 insertions, 102 deletions
diff --git a/src/cppcheckplus/shortcut/MyShortcutPanel.java b/src/cppcheckplus/shortcut/MyShortcutPanel.java index 5d97b08..c1e6a72 100644 --- a/src/cppcheckplus/shortcut/MyShortcutPanel.java +++ b/src/cppcheckplus/shortcut/MyShortcutPanel.java | |||
@@ -1,6 +1,9 @@ | |||
1 | |||
2 | package cppcheckplus.shortcut; | 1 | package cppcheckplus.shortcut; |
3 | 2 | ||
3 | import cppcheckplus.control.MyContorlUtil; | ||
4 | import cppcheckplus.control.MyHeader; | ||
5 | import cppcheckplus.control.MyList; | ||
6 | import cppcheckplus.control.MyListSplitListener; | ||
4 | import java.awt.BorderLayout; | 7 | import java.awt.BorderLayout; |
5 | import java.awt.Component; | 8 | import java.awt.Component; |
6 | import java.awt.Cursor; | 9 | import java.awt.Cursor; |
@@ -10,105 +13,92 @@ import java.awt.Insets; | |||
10 | import javax.swing.JPanel; | 13 | import javax.swing.JPanel; |
11 | import javax.swing.border.Border; | 14 | import javax.swing.border.Border; |
12 | 15 | ||
13 | import cppcheckplus.control.MyContorlUtil; | 16 | public class MyShortcutPanel extends JPanel { |
14 | import cppcheckplus.control.MyHeader; | 17 | public MyTree mytree; |
15 | import cppcheckplus.control.MyList; | 18 | private MyList list; |
16 | import cppcheckplus.control.MyListSplitListener; | 19 | private JPanel split; |
17 | import cppcheckplus.outlookpanel.MyOutlookList; | 20 | private MyHeader header; |
18 | import cppcheckplus.outlookpanel.MyOutlookPanelListItem; | 21 | private MyListSplitListener splitListener; |
19 | 22 | ||
20 | public class MyShortcutPanel extends JPanel{ | 23 | public MyShortcutPanel() { |
21 | private MyList list; | 24 | super(); |
22 | private JPanel split; | 25 | //list = new MyList(); |
23 | private MyHeader header; | 26 | split = new JPanel(new BorderLayout()); |
24 | private MyListSplitListener splitListener; | 27 | |
25 | public MyTree mytree; | 28 | header = new MyHeader() { |
26 | public MyShortcutPanel() | 29 | |
27 | { | 30 | public void setShrink(boolean shrinked) { |
28 | super(); | 31 | super.setShrink(shrinked); |
29 | //list = new MyList(); | 32 | if (shrinked) { |
30 | split = new JPanel(new BorderLayout()); | 33 | split.setCursor(Cursor.getDefaultCursor()); |
31 | 34 | } else { | |
32 | header = new MyHeader() { | 35 | split.setCursor(Cursor.getPredefinedCursor(10)); |
33 | 36 | } | |
34 | public void setShrink(boolean shrinked) | 37 | } |
35 | { | 38 | }; |
36 | super.setShrink(shrinked); | 39 | splitListener = new MyListSplitListener(header); |
37 | if (shrinked) | 40 | mytree = new MyTree(); |
38 | split.setCursor(Cursor.getDefaultCursor()); | 41 | init(); |
39 | else | 42 | } |
40 | split.setCursor(Cursor.getPredefinedCursor(10)); | 43 | |
41 | } | 44 | public void setData(MyShortcutItem[] items, |
42 | }; | 45 | MyShortcutItemClickListenter listenter) { |
43 | splitListener = new MyListSplitListener(header); | 46 | //list.setListData(items); |
44 | mytree = new MyTree(); | 47 | list.setListenter(listenter); |
45 | init(); | 48 | } |
46 | } | 49 | |
47 | public void setData(MyShortcutItem[] items,MyShortcutItemClickListenter listenter) | 50 | private void init() { |
48 | { | 51 | setLayout(new BorderLayout()); |
49 | //list.setListData(items); | 52 | JPanel rightInsetPane = new JPanel(); |
50 | list.setListenter(listenter); | 53 | rightInsetPane.setPreferredSize(new Dimension(2, 0)); |
51 | } | 54 | rightInsetPane.setBackground(MyContorlUtil.LIST_BACKGROUND); |
52 | private void init() | 55 | add(rightInsetPane, "East"); |
53 | { | 56 | add(header, "North"); |
54 | setLayout(new BorderLayout()); | 57 | |
55 | JPanel rightInsetPane = new JPanel(); | 58 | split.setBorder(new Border() { |
56 | rightInsetPane.setPreferredSize(new Dimension(2, 0)); | 59 | public void paintBorder(Component c, Graphics g, int x, int y, |
57 | rightInsetPane.setBackground(MyContorlUtil.LIST_BACKGROUND); | 60 | int width, int height) { |
58 | add(rightInsetPane, "East"); | 61 | g.setColor(MyContorlUtil.LIST_SPLIT_COLOR); |
59 | add(header, "North"); | 62 | g.drawLine(x, y, x, y + height); |
60 | 63 | } | |
61 | split.setBorder(new Border() { | 64 | |
62 | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) | 65 | public Insets getBorderInsets(Component c) { |
63 | { | 66 | return new Insets(0, 1, 0, 0); |
64 | g.setColor(MyContorlUtil.LIST_SPLIT_COLOR); | 67 | } |
65 | g.drawLine(x, y, x, y + height); | 68 | |
66 | } | 69 | public boolean isBorderOpaque() { |
67 | 70 | return true; | |
68 | public Insets getBorderInsets(Component c) | 71 | } |
69 | { | 72 | |
70 | return new Insets(0, 1, 0, 0); | 73 | }); |
71 | } | 74 | split.setOpaque(true); |
72 | 75 | split.setPreferredSize(new Dimension(4, 0)); | |
73 | public boolean isBorderOpaque() | 76 | split.setBackground(MyContorlUtil.LIST_BACKGROUND); |
74 | { | 77 | split.setCursor(Cursor.getPredefinedCursor(10)); |
75 | return true; | 78 | split.addMouseListener(splitListener); |
76 | } | 79 | split.addMouseMotionListener(splitListener); |
77 | 80 | add(split, "West"); | |
78 | }); | 81 | add(mytree, "Center"); |
79 | split.setOpaque(true); | 82 | //add(list, "Center"); |
80 | split.setPreferredSize(new Dimension(4, 0)); | 83 | } |
81 | split.setBackground(MyContorlUtil.LIST_BACKGROUND); | 84 | |
82 | split.setCursor(Cursor.getPredefinedCursor(10)); | 85 | public MyList getList() { |
83 | split.addMouseListener(splitListener); | 86 | return list; |
84 | split.addMouseMotionListener(splitListener); | 87 | } |
85 | add(split, "West"); | 88 | |
86 | add(mytree, "Center"); | 89 | public String getTitle() { |
87 | //add(list, "Center"); | 90 | return header.getTitle(); |
88 | } | 91 | } |
89 | 92 | ||
90 | public MyList getList() | 93 | public void setTitle(String title) { |
91 | { | 94 | header.setTitle(title); |
92 | return list; | 95 | } |
93 | } | 96 | |
94 | 97 | public void setShrink(boolean shrinked) { | |
95 | public void setTitle(String title) | 98 | header.setShrink(shrinked); |
96 | { | 99 | } |
97 | header.setTitle(title); | 100 | |
98 | } | 101 | public boolean isShrinked() { |
99 | 102 | return header.isShrinked(); | |
100 | public String getTitle() | 103 | } |
101 | { | ||
102 | return header.getTitle(); | ||
103 | } | ||
104 | |||
105 | public void setShrink(boolean shrinked) | ||
106 | { | ||
107 | header.setShrink(shrinked); | ||
108 | } | ||
109 | |||
110 | public boolean isShrinked() | ||
111 | { | ||
112 | return header.isShrinked(); | ||
113 | } | ||
114 | } | 104 | } |