01: package net.sourceforge.squirrel_sql.client.gui.db.aliasproperties;
02:
03: import net.sourceforge.squirrel_sql.client.gui.db.SQLAliasSchemaDetailProperties;
04: import net.sourceforge.squirrel_sql.fw.util.StringManager;
05: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
06:
07: class SchemaTableCboItem {
08: private static final StringManager s_stringMgr = StringManagerFactory
09: .getStringManager(SchemaTableCboItem.class);
10:
11: static final SchemaTableCboItem[] items = new SchemaTableCboItem[] {
12: new SchemaTableCboItem(
13: SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_DONT_CACHE),
14: new SchemaTableCboItem(
15: SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_AND_CACHE),
16: new SchemaTableCboItem(
17: SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_DONT_LOAD), };
18:
19: static SchemaTableCboItem getItemForID(int schemaID) {
20: switch (schemaID) {
21: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_DONT_CACHE:
22: return SchemaTableCboItem.items[0];
23: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_AND_CACHE:
24: return SchemaTableCboItem.items[1];
25: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_DONT_LOAD:
26: return SchemaTableCboItem.items[2];
27: default:
28: throw new IllegalArgumentException("Unknown schemaID "
29: + schemaID);
30: }
31: }
32:
33: private String _toString;
34:
35: private int _id;
36:
37: private SchemaTableCboItem(int _schemaID) {
38: this ._id = _schemaID;
39: switch (_schemaID) {
40: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_DONT_CACHE:
41: // i18n[SchemaTableCboItem.schemaID.loadButDontCache=Load but don't cache]
42: _toString = s_stringMgr
43: .getString("SchemaTableCboItem.schemaID.loadButDontCache");
44: break;
45: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_LOAD_AND_CACHE:
46: // i18n[SchemaTableCboItem.schemaID.loadAndCache=Load and cache]
47: _toString = s_stringMgr
48: .getString("SchemaTableCboItem.schemaID.loadAndCache");
49: break;
50: case SQLAliasSchemaDetailProperties.SCHEMA_LOADING_ID_DONT_LOAD:
51: // i18n[SchemaTableCboItem.schemaID.dontLoad=Don't load]
52: _toString = s_stringMgr
53: .getString("SchemaTableCboItem.schemaID.dontLoad");
54: break;
55: }
56: }
57:
58: public String toString() {
59: return _toString;
60: }
61:
62: public int getID() {
63: return _id;
64: }
65:
66: }
|