Last change
on this file since 1 was 1, checked in by Wouter Pasman, 6 years ago |
Initial import : Genius 9.0.0
|
File size:
1.2 KB
|
Line | |
---|
1 | package genius.gui.domainrepository;
|
---|
2 |
|
---|
3 | import javax.swing.tree.DefaultMutableTreeNode;
|
---|
4 |
|
---|
5 | import genius.core.exceptions.Warning;
|
---|
6 | import genius.core.repository.DomainRepItem;
|
---|
7 | import genius.core.repository.ProfileRepItem;
|
---|
8 | import genius.core.repository.RepItem;
|
---|
9 |
|
---|
10 | public class MyTreeNode extends DefaultMutableTreeNode {
|
---|
11 |
|
---|
12 | private static final long serialVersionUID = -4929729243877782033L;
|
---|
13 | RepItem repository_item;
|
---|
14 |
|
---|
15 | public MyTreeNode(RepItem item)
|
---|
16 | {
|
---|
17 | super(item);
|
---|
18 | repository_item=item;
|
---|
19 | }
|
---|
20 |
|
---|
21 | public String toString() {
|
---|
22 | if (repository_item==null) return "";
|
---|
23 | if (repository_item instanceof DomainRepItem)
|
---|
24 | return shortfilename(((DomainRepItem)repository_item).getURL().getFile());
|
---|
25 | if (repository_item instanceof ProfileRepItem)
|
---|
26 | return shortfilename( ((ProfileRepItem)repository_item).getURL().getFile());
|
---|
27 | new Warning("encountered item "+repository_item+" of type "+repository_item.getClass());
|
---|
28 | return "ERR";
|
---|
29 | }
|
---|
30 | /** returns only the filename given a full path with separating '/' */
|
---|
31 | public String shortfilename(String filename) {
|
---|
32 | int lastslash=filename.lastIndexOf('/');
|
---|
33 | if (lastslash==-1) return filename;
|
---|
34 | return filename.substring(lastslash+1);
|
---|
35 | }
|
---|
36 |
|
---|
37 | public RepItem getRepositoryItem() { return repository_item; }
|
---|
38 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.