|
@@ -1,48 +1,48 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.aokeyhole.swing.mains.mementobeans; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.aokeyhole.objects.factories.*; |
5 |
|
- |
import org.litesoft.aokeyhole.objects.factories.mementobean.*; |
6 |
|
- |
import org.litesoft.aokeyhole.persist.*; |
7 |
|
- |
import org.litesoft.aokeyhole.swing.*; |
8 |
|
- |
import org.litesoft.aokeyhole.toolkit.*; |
9 |
|
- |
|
10 |
|
- |
import java.io.*; |
11 |
|
- |
import java.util.*; |
12 |
|
- |
|
13 |
|
- |
public abstract class AbstractMementoBeanSwingMain extends AbstractSwingMain { |
14 |
|
- |
private static PropertyMetaDataDefinitionAccessor DEFINITIONS = MementoBeanPropertyMetaDataDefinitionAccessor.INSTANCE; |
15 |
|
- |
|
16 |
|
- |
public static final SubSystemFactory SSF = new SubSystemFactoryImpl( DEFINITIONS, IdentifierValidatorStrictCamel.INSTANCE, // |
17 |
|
- |
new ObjectFactoryImpl( DEFINITIONS, IdentifierValidatorStrictCamel.INSTANCE, // |
18 |
|
- |
new AttributeFactoryImpl( DEFINITIONS, // |
19 |
|
- |
IdentifierValidatorStrictCamel |
20 |
|
- |
.INSTANCE ) ) ); |
21 |
|
- |
|
22 |
|
- |
protected AbstractMementoBeanSwingMain( String[] pNameDirectoryPackageTriples, boolean pReadOnly ) |
23 |
|
- |
throws IOException { |
24 |
|
- |
super( SSF, new SwingEditViewPanelFactory(), pReadOnly, createPersistables( pNameDirectoryPackageTriples ) ); |
25 |
|
- |
} |
26 |
|
- |
|
27 |
|
- |
private static SubSystemPersister[] createPersistables( String[] pNameDirectoryPackageTriples ) |
28 |
|
- |
throws IOException { |
29 |
|
- |
if ( pNameDirectoryPackageTriples.length == 0 ) { |
30 |
|
- |
throw new IllegalArgumentException( "No named directory package triple(s) provided on the command line!" ); |
31 |
|
- |
} |
32 |
|
- |
List<SubSystemPersister> rv = new ArrayList<SubSystemPersister>(); |
33 |
|
- |
for ( int i = 0; i < pNameDirectoryPackageTriples.length; ) { |
34 |
|
- |
String zName = get( pNameDirectoryPackageTriples, i++ ); |
35 |
|
- |
String zDirectory = get( pNameDirectoryPackageTriples, i++ ); |
36 |
|
- |
String zPackage = get( pNameDirectoryPackageTriples, i++ ); |
37 |
|
- |
rv.add( new DirectoryPackageSubSystemPersister( zName, zDirectory, zPackage ) ); |
38 |
|
- |
} |
39 |
|
- |
return rv.toArray( new SubSystemPersister[rv.size()] ); |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
private static String get( String[] pNameDirectoryPackageTriples, int pIndex ) { |
43 |
|
- |
if ( pIndex < pNameDirectoryPackageTriples.length ) { |
44 |
|
- |
return pNameDirectoryPackageTriples[pIndex]; |
45 |
|
- |
} |
46 |
|
- |
throw new IllegalArgumentException( "Name directory package triple(s) not tripled on the command line!" ); |
47 |
|
- |
} |
48 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.aokeyhole.swing.mains.mementobeans; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.aokeyhole.objects.factories.*; |
|
5 |
+ |
import org.litesoft.aokeyhole.objects.factories.mementobean.*; |
|
6 |
+ |
import org.litesoft.aokeyhole.persist.*; |
|
7 |
+ |
import org.litesoft.aokeyhole.swing.*; |
|
8 |
+ |
import org.litesoft.aokeyhole.toolkit.*; |
|
9 |
+ |
|
|
10 |
+ |
import java.io.*; |
|
11 |
+ |
import java.util.*; |
|
12 |
+ |
|
|
13 |
+ |
public abstract class AbstractMementoBeanSwingMain extends AbstractSwingMain { |
|
14 |
+ |
private static PropertyMetaDataDefinitionAccessor DEFINITIONS = MementoBeanPropertyMetaDataDefinitionAccessor.INSTANCE; |
|
15 |
+ |
|
|
16 |
+ |
public static final SubSystemFactory SSF = new SubSystemFactoryImpl( DEFINITIONS, IdentifierValidatorStrictCamel.INSTANCE, // |
|
17 |
+ |
new ObjectFactoryImpl( DEFINITIONS, IdentifierValidatorStrictCamel.INSTANCE, // |
|
18 |
+ |
new AttributeFactoryImpl( DEFINITIONS, // |
|
19 |
+ |
IdentifierValidatorStrictCamel |
|
20 |
+ |
.INSTANCE ) ) ); |
|
21 |
+ |
|
|
22 |
+ |
protected AbstractMementoBeanSwingMain( String[] pNameDirectoryPackageTriples, boolean pReadOnly ) |
|
23 |
+ |
throws IOException { |
|
24 |
+ |
super( SSF, new SwingEditViewPanelFactory(), pReadOnly, createPersistables( pNameDirectoryPackageTriples ) ); |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
private static SubSystemPersister[] createPersistables( String[] pNameDirectoryPackageTriples ) |
|
28 |
+ |
throws IOException { |
|
29 |
+ |
if ( pNameDirectoryPackageTriples.length == 0 ) { |
|
30 |
+ |
throw new IllegalArgumentException( "No named directory package triple(s) provided on the command line!" ); |
|
31 |
+ |
} |
|
32 |
+ |
List<SubSystemPersister> rv = new ArrayList<SubSystemPersister>(); |
|
33 |
+ |
for ( int i = 0; i < pNameDirectoryPackageTriples.length; ) { |
|
34 |
+ |
String zName = get( pNameDirectoryPackageTriples, i++ ); |
|
35 |
+ |
String zDirectory = get( pNameDirectoryPackageTriples, i++ ); |
|
36 |
+ |
String zPackage = get( pNameDirectoryPackageTriples, i++ ); |
|
37 |
+ |
rv.add( new DirectoryPackageSubSystemPersister( zName, zDirectory, zPackage ) ); |
|
38 |
+ |
} |
|
39 |
+ |
return rv.toArray( new SubSystemPersister[rv.size()] ); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
private static String get( String[] pNameDirectoryPackageTriples, int pIndex ) { |
|
43 |
+ |
if ( pIndex < pNameDirectoryPackageTriples.length ) { |
|
44 |
+ |
return pNameDirectoryPackageTriples[pIndex]; |
|
45 |
+ |
} |
|
46 |
+ |
throw new IllegalArgumentException( "Name directory package triple(s) not tripled on the command line!" ); |
|
47 |
+ |
} |
|
48 |
+ |
} |