|
@@ -5,8 +5,7 @@ |
5 |
5 |
|
import org.litesoft.commonfoundation.stringmatching.*; |
6 |
6 |
|
import org.litesoft.commonfoundation.typeutils.*; |
7 |
7 |
|
|
8 |
|
- |
public class EBIconService implements IconService |
9 |
|
- |
{ |
|
8 |
+ |
public class EBIconService implements IconService { |
10 |
9 |
|
private static final Definition NO_FACTORY_DEFINITION = |
11 |
10 |
|
new DefinitionImpl( "common/images/windowbar/NoFactory.gif", // |
12 |
11 |
|
"common/images/windowbar/NoFactory24.gif", // |
|
@@ -19,26 +18,19 @@ |
19 |
18 |
|
|
20 |
19 |
|
private EBISDefPlus[] mDefinitions; |
21 |
20 |
|
|
22 |
|
- |
public void setDefinitions( EBIconServiceDefinition[] pDefinitions ) |
23 |
|
- |
{ |
24 |
|
- |
if ( pDefinitions == null ) |
25 |
|
- |
{ |
|
21 |
+ |
public void setDefinitions( EBIconServiceDefinition[] pDefinitions ) { |
|
22 |
+ |
if ( pDefinitions == null ) { |
26 |
23 |
|
mDefinitions = EBISDefPlus.EMPTY_ARRAY; |
27 |
|
- |
} |
28 |
|
- |
else |
29 |
|
- |
{ |
|
24 |
+ |
} else { |
30 |
25 |
|
mDefinitions = new EBISDefPlus[pDefinitions.length]; |
31 |
|
- |
for ( int i = 0; i < mDefinitions.length; i++ ) |
32 |
|
- |
{ |
|
26 |
+ |
for ( int i = 0; i < mDefinitions.length; i++ ) { |
33 |
27 |
|
mDefinitions[i] = new EBISDefPlus( pDefinitions[i] ); |
34 |
28 |
|
} |
35 |
29 |
|
} |
36 |
30 |
|
} |
37 |
31 |
|
|
38 |
|
- |
public DefinitionPlus getDefinition( String pFloaterFactoryRef, String pCurrentFloaterTitle ) |
39 |
|
- |
{ |
40 |
|
- |
if ( null == (pFloaterFactoryRef = Strings.noEmpty( pFloaterFactoryRef )) ) |
41 |
|
- |
{ |
|
32 |
+ |
public DefinitionPlus getDefinition( String pFloaterFactoryRef, String pCurrentFloaterTitle ) { |
|
33 |
+ |
if ( null == (pFloaterFactoryRef = Strings.noEmpty( pFloaterFactoryRef )) ) { |
42 |
34 |
|
return new DefinitionPlus( false, null, NO_FACTORY_DEFINITION ); |
43 |
35 |
|
} |
44 |
36 |
|
pCurrentFloaterTitle = Strings.deNull( pCurrentFloaterTitle ).trim(); |
|
@@ -46,13 +38,10 @@ |
46 |
38 |
|
return new DefinitionPlus( true, Strings.noEmpty( pCurrentFloaterTitle ), zRV ); |
47 |
39 |
|
} |
48 |
40 |
|
|
49 |
|
- |
private Definition getIconDefinition( String pFloaterFactoryRef, String pCurrentFloaterTitle ) |
50 |
|
- |
{ |
51 |
|
- |
for ( int i = 0; i < mDefinitions.length; i++ ) |
52 |
|
- |
{ |
|
41 |
+ |
private Definition getIconDefinition( String pFloaterFactoryRef, String pCurrentFloaterTitle ) { |
|
42 |
+ |
for ( int i = 0; i < mDefinitions.length; i++ ) { |
53 |
43 |
|
EBISDefPlus zDefinition = mDefinitions[i]; |
54 |
|
- |
if ( zDefinition.matches( pFloaterFactoryRef, pCurrentFloaterTitle ) ) |
55 |
|
- |
{ |
|
44 |
+ |
if ( zDefinition.matches( pFloaterFactoryRef, pCurrentFloaterTitle ) ) { |
56 |
45 |
|
return zDefinition.getDefinition(); |
57 |
46 |
|
} |
58 |
47 |
|
} |
|
@@ -60,22 +49,19 @@ |
60 |
49 |
|
return NOT_FOUND_DEFINITION; |
61 |
50 |
|
} |
62 |
51 |
|
|
63 |
|
- |
public static class EBISDefPlus |
64 |
|
- |
{ |
|
52 |
+ |
public static class EBISDefPlus { |
65 |
53 |
|
public static final EBISDefPlus[] EMPTY_ARRAY = new EBISDefPlus[0]; |
66 |
54 |
|
|
67 |
55 |
|
private EBIconServiceDefinition mDefinition; |
68 |
56 |
|
private StringMatcher mFactoryRefMatcher, mTitleMatcher; |
69 |
57 |
|
|
70 |
|
- |
public EBISDefPlus( EBIconServiceDefinition pDefinition ) |
71 |
|
- |
{ |
|
58 |
+ |
public EBISDefPlus( EBIconServiceDefinition pDefinition ) { |
72 |
59 |
|
mDefinition = pDefinition; |
73 |
60 |
|
mFactoryRefMatcher = createMatcher( pDefinition.getFloaterFactoryRefPattern() ); |
74 |
61 |
|
mTitleMatcher = createMatcher( pDefinition.getFloaterTitlePattern() ); |
75 |
62 |
|
} |
76 |
63 |
|
|
77 |
|
- |
private StringMatcher createMatcher( String pPattern ) |
78 |
|
- |
{ |
|
64 |
+ |
private StringMatcher createMatcher( String pPattern ) { |
79 |
65 |
|
pPattern = pPattern.trim(); |
80 |
66 |
|
StringMatcher zMatcher = |
81 |
67 |
|
StringMatcherFactory.createEquals( Strings.parseChar( pPattern, '*' ) ); |
|
@@ -86,13 +72,11 @@ |
86 |
72 |
|
StringMatcher.ALL; |
87 |
73 |
|
} |
88 |
74 |
|
|
89 |
|
- |
public EBIconServiceDefinition getDefinition() |
90 |
|
- |
{ |
|
75 |
+ |
public EBIconServiceDefinition getDefinition() { |
91 |
76 |
|
return mDefinition; |
92 |
77 |
|
} |
93 |
78 |
|
|
94 |
|
- |
public boolean matches( String pFloaterFactoryRef, String pCurrentFloaterTitle ) |
95 |
|
- |
{ |
|
79 |
+ |
public boolean matches( String pFloaterFactoryRef, String pCurrentFloaterTitle ) { |
96 |
80 |
|
return mFactoryRefMatcher.matches( pFloaterFactoryRef ) && |
97 |
81 |
|
mTitleMatcher.matches( pCurrentFloaterTitle ); |
98 |
82 |
|
} |