OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 74 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 74 Rev 153
Line 9... Line 9...
9
import javax.swing.JOptionPane;
9
import javax.swing.JOptionPane;
10
 
10
 
11
import org.openconcerto.erp.config.ComptaPropsConfiguration;
11
import org.openconcerto.erp.config.ComptaPropsConfiguration;
12
import org.openconcerto.erp.config.Log;
12
import org.openconcerto.erp.config.Log;
13
import org.openconcerto.modules.extensionbuilder.Extension;
13
import org.openconcerto.modules.extensionbuilder.Extension;
-
 
14
import org.openconcerto.modules.extensionbuilder.ExtensionGroupSQLComponent;
14
import org.openconcerto.modules.extensionbuilder.component.ComponentDescritor;
15
import org.openconcerto.modules.extensionbuilder.component.ComponentDescritor;
15
import org.openconcerto.modules.extensionbuilder.menu.mainmenu.MenuDescriptor;
16
import org.openconcerto.modules.extensionbuilder.list.ListDescriptor;
16
import org.openconcerto.sql.element.GroupSQLComponent;
17
import org.openconcerto.sql.element.GroupSQLComponent;
17
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.sql.element.SQLElement;
19
import org.openconcerto.sql.element.SQLElement;
19
import org.openconcerto.sql.model.DBRoot;
20
import org.openconcerto.sql.model.DBRoot;
20
import org.openconcerto.sql.model.SQLTable;
21
import org.openconcerto.sql.model.SQLTable;
-
 
22
import org.openconcerto.sql.request.ListSQLRequest;
-
 
23
import org.openconcerto.sql.request.RowItemDesc;
-
 
24
import org.openconcerto.sql.view.list.SQLTableModelSource;
-
 
25
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
21
 
26
 
22
public class TableDescritor {
27
public class TableDescritor {
23
    private String name;
28
    private String name;
24
    private List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>();
29
    private List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>();
25
 
30
 
Line 40... Line 45...
40
                protected List<String> getListFields() {
45
                protected List<String> getListFields() {
41
                    return new ArrayList<String>(0);
46
                    return new ArrayList<String>(0);
42
                }
47
                }
43
 
48
 
44
                @Override
49
                @Override
-
 
50
                protected SQLTableModelSourceOnline instantiateTableSourceOnline(ListSQLRequest req) {
-
 
51
                    ListDescriptor listDesc = null;
-
 
52
                    for (ListDescriptor listDescriptor : ext.getCreateListList()) {
-
 
53
                        if (listDescriptor.getMainTable().equals(getTable().getName())) {
-
 
54
                            listDesc = listDescriptor;
-
 
55
                            break;
-
 
56
                        }
-
 
57
                    }
-
 
58
                    if (listDesc != null) {
-
 
59
                        return ext.createSource(this, req, listDesc);
-
 
60
                    } else {
-
 
61
                        return super.instantiateTableSourceOnline(req);
-
 
62
                    }
-
 
63
 
-
 
64
                }
-
 
65
 
-
 
66
                @Override
45
                protected SQLComponent createComponent() {
67
                protected SQLComponent createComponent() {
46
 
68
 
47
                    for (final ComponentDescritor cDescriptor : ext.getCreateComponentList()) {
69
                    for (final ComponentDescritor cDescriptor : ext.getCreateComponentList()) {
48
                        if (cDescriptor.getTable().equals(table.getTable().getName())) {
70
                        if (cDescriptor.getTable().equals(table.getTable().getName())) {
49
 
-
 
50
                            final GroupSQLComponent gComponent = new GroupSQLComponent(this, cDescriptor.getGroup());
71
                            return new ExtensionGroupSQLComponent(this, cDescriptor.getGroup());
51
                            return gComponent;
-
 
52
 
-
 
53
                        }
72
                        }
54
                    }
73
                    }
55
                    JOptionPane.showMessageDialog(new JFrame(), "Unable to create default creation component for table " + name);
74
                    JOptionPane.showMessageDialog(new JFrame(), "Unable to create default creation component for table " + name);
56
                    return null;
75
                    return null;
57
                }
76
                }