Link Here
|
56 |
import java.util.ArrayList; |
56 |
import java.util.ArrayList; |
57 |
import java.util.logging.Level; |
57 |
import java.util.logging.Level; |
58 |
import javax.swing.AbstractAction; |
58 |
import javax.swing.AbstractAction; |
|
|
59 |
import javax.swing.JComponent; |
59 |
import javax.swing.JMenu; |
60 |
import javax.swing.JMenu; |
60 |
import javax.swing.JMenuItem; |
61 |
import javax.swing.JMenuItem; |
61 |
import javax.swing.JPanel; |
62 |
import javax.swing.JPanel; |
Link Here
|
194 |
assertEquals("Still No removals in MenuBar", 0, remove); |
195 |
assertEquals("Still No removals in MenuBar", 0, remove); |
195 |
assertEquals("Still Two additions in MenuBar", 2, add); |
196 |
assertEquals("Still Two additions in MenuBar", 2, add); |
196 |
} |
197 |
} |
|
|
198 |
|
199 |
|
200 |
public void testClientPropertiesMayBePropagated() throws Exception { |
201 |
mb.addContainerListener(this); |
202 |
assertEquals("No children now", 0, mb.getComponentCount()); |
203 |
|
204 |
class Atom implements FileSystem.AtomicAction { |
205 |
FileObject m1, m2; |
206 |
|
207 |
public void run() throws IOException { |
208 |
m1 = FileUtil.createFolder(df.getPrimaryFile(), "m1"); |
209 |
m1.setAttribute("property-prefix", "ahoj."); |
210 |
m1.setAttribute("ahoj.jardo", "Hi!"); |
211 |
m2 = FileUtil.createFolder(df.getPrimaryFile(), "m2"); |
212 |
m2.setAttribute("property-prefix", "buk-"); |
213 |
m2.setAttribute("buk-muk", "Hello!"); |
214 |
} |
215 |
} |
216 |
Atom atom = new Atom(); |
217 |
df.getPrimaryFile().getFileSystem().runAtomicAction(atom); |
218 |
mb.waitFinished(); |
219 |
|
220 |
assertEquals("Two children there", 2, mb.getComponentCount()); |
221 |
final JMenuItem c0 = (JMenuItem) mb.getComponent(0); |
222 |
assertEquals("Programatic names deduced from the folder", "m1", c0.getName()); |
223 |
final JMenuItem c1 = (JMenuItem) mb.getComponent(1); |
224 |
assertEquals("Programatic names deduced from the folder", "m2", c1.getName()); |
225 |
|
226 |
assertEquals("Hi!", c0.getClientProperty("jardo")); |
227 |
assertEquals("Hello!", c1.getClientProperty("muk")); |
228 |
} |
197 |
|
229 |
|
198 |
static void simulateExpansionOfMenu(JMenu m1) { |
230 |
static void simulateExpansionOfMenu(JMenu m1) { |
199 |
// simulate expansion in the menu |
231 |
// simulate expansion in the menu |