1 package com.bonevich.erj.ui.editor;
2
3 import com.bonevich.erj.model.*;
4 import com.bonevich.erj.ui.*;
5
6 import java.util.*;
7 import java.awt.*;
8 import java.awt.event.*;
9 import javax.swing.*;
10
11 /*** A model editor for <code>Schema</code>.
12 *
13 * @see Schema
14 * @see ModelEditor
15 */
16 public final class SchemaEditor extends ModelEditor
17 {
18 //////////////////////////////////////////////////////////
19 // Constants
20 public static final int MODE_EDIT_SCHEMA = 0;
21 public static final int MODE_EDIT_RELATIONS = 1;
22 public static final int MODE_EDIT_DOMAINS = 2;
23
24 public static final String NAME_EDIT_SCHEMA = "Edit Schema";
25 public static final String NAME_EDIT_RELATIONS = "Edit Relations";
26 public static final String NAME_EDIT_DOMAINS = "Edit Domains";
27
28 public static final String TIP_EDIT_SCHEMA = "Edit the properties of the schema";
29 public static final String TIP_EDIT_RELATIONS = "Add, remove, and edit relations for the schema";
30 public static final String TIP_EDIT_DOMAINS = "Add, remove, and edit domains for the schema";
31
32 public static final String REL_ADD = "Add";
33 public static final String REL_EDIT = "Edit";
34 public static final String REL_DELETE = "Delete";
35
36
37 //////////////////////////////////////////////////////////
38 // Attributes
39 private JPanel _relPane;
40 private JPanel _domainPane;
41 private JTable _relTable;
42 //private AttributeTableModel _model;
43
44 private JButton _addButton;
45 private JButton _editButton;
46 private JButton _delButton;
47
48 //////////////////////////////////////////////////////////
49 // Constructors
50 public SchemaEditor(JTabbedPane parent, Schema schema)
51 {
52 super(parent,schema);
53 addActionListeners();
54 }
55
56 //////////////////////////////////////////////////////////
57 // Operations
58 protected void initTabs()
59 {
60 // we want the default tab
61 setDefaultLabel(NAME_EDIT_SCHEMA);
62 setDefaultTip(TIP_EDIT_SCHEMA);
63 setDefaultIndex(MODE_EDIT_SCHEMA);
64 super.initTabs();
65 }
66
67 public boolean validate()
68 {
69 return true;
70 }
71
72 public void updateModel()
73 {
74 Schema s = (Schema) getOwner();
75 s.setName(_nameText.getText());
76 s.setIdentifier(_identifierText.getText());
77 s.setDescription(_descText.getText());
78 }
79
80 public void updateEditor()
81 {
82 Schema s = (Schema) getOwner();
83 _nameText.setText(s.getName());
84 _identifierText.setText(s.getIdentifier());
85 _descText.setText(s.getDescription());
86 }
87
88 private void addActionListeners()
89 {
90 }
91
92 } /* end class SchemaEditor */
This page was automatically generated by Maven