01: package org.airtodo.gui.dialog_table;
02:
03: import java.awt.Dialog;
04: import java.awt.Window;
05: import java.sql.SQLException;
06: import java.util.Map;
07: import java.util.Vector;
08:
09: import org.air.framework.core.Utils;
10: import org.air.framework.db.DbUtilsCommon;
11: import org.air.framework.gui.dialogs.grid.AbstractGridDialog;
12: import org.air.framework.gui.dialogs.grid.IAddDeleteGridDialog;
13: import org.air.framework.gui.dialogs.grid.IOpenGridDialog;
14: import org.air.framework.gui.dialogs.input.AbstractDeleteDialog;
15: import org.air.framework.i18n.NlsRecords;
16: import org.airtodo.db.DbUtils;
17: import org.airtodo.gui.dialog_delete.AttachmentDeleteDialog;
18: import org.airtodo.gui.dialog_open.ModuleOpenDialog;
19: import org.airtodo.headers.Module;
20: import org.airtodo.records.Modules;
21:
22: public class ModuleGridNonSelectableDialog extends AbstractGridDialog
23: implements IAddDeleteGridDialog, IOpenGridDialog {
24: private long projectId;
25:
26: //
27: // C O N S T R U C T O R
28: //
29: public ModuleGridNonSelectableDialog() {
30: super ();
31: }
32:
33: //
34: // C O N S T R U C T O R
35: //
36: public ModuleGridNonSelectableDialog(Dialog owner) {
37: super (owner, new Module());
38: }
39:
40: //
41: // C O N S T R U C T O R
42: //
43: public ModuleGridNonSelectableDialog(Dialog owner, String title) {
44: super (owner, new Module());
45: setTitle(title + " - "
46: + NlsRecords.getTextPluralImenitelniy(Modules.class));
47: }
48:
49: //
50: // C O N S T R U C T O R
51: //
52: public ModuleGridNonSelectableDialog(Dialog owner, Long id) {
53: super (owner, new Module(), id);
54: }
55:
56: @Override
57: public Vector<Map> getDataVector() throws SQLException {
58: return DbUtils.selectModulesByProjectId(projectId);
59: }
60:
61: public AbstractDeleteDialog getDeleteDialog(AbstractGridDialog owner) {
62: return new AttachmentDeleteDialog(owner);
63: }
64:
65: public Window getOpenDialog(
66: AbstractGridDialog abstractAddDeleteOpenDialog) {
67: return new ModuleOpenDialog(abstractAddDeleteOpenDialog);
68: }
69:
70: @Override
71: public String getDialogTitle() {
72: return NlsRecords.getTextPluralImenitelniy(Modules.class);
73: }
74:
75: public int insert(Map map) throws SQLException {
76: map.put(Utils.getColumnIdentifier(Modules.PROJECT_ID),
77: projectId);
78: return DbUtilsCommon.insert(map, Modules.class);
79: }
80:
81: public void setProjectId(long projectId) {
82: this.projectId = projectId;
83: }
84: }
|