瀏覽代碼

Fixes issue 3439: topic history appears to eat cpu for breakfast, lunch and dinner

Fixes issue 3438: topic history labels lose meta data

Change-Id: I1cc75e88252373ca7c7621806ef8f9a4f53bb6fd
Reviewed-on: http://gerrit.dmdirc.com/351
Reviewed-by: Chris Smith <chris@dmdirc.com>
Tested-by: Chris Smith <chris@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 年之前
父節點
當前提交
368351486e
共有 1 個檔案被更改,包括 44 行新增7 行删除
  1. 44
    7
      src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicLabel.java

+ 44
- 7
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicLabel.java 查看文件

@@ -87,12 +87,14 @@ public class TopicLabel extends JPanel {
87 87
         StyleConstants.setFontFamily(as, pane.getFont().getFamily());
88 88
         StyleConstants.setFontSize(as, pane.getFont().getSize());
89 89
         if (getBackground() == null) {
90
-            StyleConstants.setBackground(as, UIManager.getColor("Table.background"));
90
+            StyleConstants.setBackground(as, UIManager.getColor(
91
+                    "Table.background"));
91 92
         } else {
92 93
             StyleConstants.setBackground(as, getBackground());
93 94
         }
94 95
         if (getForeground() == null) {
95
-            StyleConstants.setForeground(as, UIManager.getColor("Table.foreground"));
96
+            StyleConstants.setForeground(as, UIManager.getColor(
97
+                    "Table.foreground"));
96 98
         } else {
97 99
             StyleConstants.setForeground(as, getForeground());
98 100
         }
@@ -104,7 +106,7 @@ public class TopicLabel extends JPanel {
104 106
     private void init() {
105 107
         initTopicField();
106 108
         removeAll();
107
-        setLayout(new MigLayout("fillx, ins 0, debug", "[]0[]", "[]0[]"));
109
+        setLayout(new MigLayout("fill, ins 0, debug", "[]0[]", "[]0[]"));
108 110
 
109 111
         if (!topic.getTopic().isEmpty()) {
110 112
             Styliser.addStyledString((StyledDocument) pane.getDocument(),
@@ -119,13 +121,15 @@ public class TopicLabel extends JPanel {
119 121
         } else {
120 122
             label = new OldTextLabel("Topic set by " + topic.getClient());
121 123
         }
122
-        add(label, "wmax 450, growy, pushy, wrap, gapleft 5, pad 0");
124
+        add(label, "wmax 450, grow, push, wrap, gapleft 5, pad 0");
123 125
 
124 126
         label = new OldTextLabel("on " + new Date(topic.getTime() * 1000).
125 127
                 toString());
126
-        add(label, "wmax 450, growy, pushy, wrap, gapleft 5, pad 0");
128
+        add(label, "wmax 450, grow, push, wrap, gapleft 5, pad 0");
127 129
 
128 130
         add(new JSeparator(), "newline, span, growx, pushx");
131
+
132
+        super.validate();
129 133
     }
130 134
 
131 135
     /**
@@ -141,7 +145,7 @@ public class TopicLabel extends JPanel {
141 145
     @Override
142 146
     public void setBackground(final Color bg) {
143 147
         super.setBackground(bg);
144
-        if (topic != null) {
148
+        if (topic != null && !bg.equals(getBackground())) {
145 149
             init();
146 150
         }
147 151
     }
@@ -150,8 +154,41 @@ public class TopicLabel extends JPanel {
150 154
     @Override
151 155
     public void setForeground(final Color fg) {
152 156
         super.setForeground(fg);
153
-        if (topic != null) {
157
+        if (topic != null && !fg.equals(getForeground())) {
154 158
             init();
155 159
         }
156 160
     }
161
+
162
+    /** {@inheritDoc} */
163
+    @Override
164
+    public void invalidate() {
165
+    }
166
+
167
+    /** {@inheritDoc} */
168
+    @Override
169
+    public void revalidate() {
170
+    }
171
+
172
+    /** {@inheritDoc} */
173
+    @Override
174
+    public void repaint() {
175
+    }
176
+
177
+    /** {@inheritDoc} */
178
+    @Override
179
+    public void firePropertyChange(String propertyName, Object oldValue,
180
+            Object newValue) {
181
+    }
182
+
183
+    /** {@inheritDoc} */
184
+    @Override
185
+    public void firePropertyChange(String propertyName, boolean oldValue,
186
+            boolean newValue) {
187
+    }
188
+
189
+    /** {@inheritDoc} */
190
+    @Override
191
+    public void firePropertyChange(String propertyName, int oldValue,
192
+            int newValue) {
193
+    }
157 194
 }

Loading…
取消
儲存