Revision 9518
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.lib/org.gvsig.online.lib.api/src/main/java/org/gvsig/online/lib/api/workingcopy/OnlineEntity.java | ||
---|---|---|
73 | 73 |
|
74 | 74 |
public int getTileSize(); |
75 | 75 |
|
76 |
public String getCategory(); |
|
77 |
|
|
78 |
public List<String> getCategoriesAsList(); |
|
76 | 79 |
|
77 |
public boolean isOutdated();
|
|
80 |
public Tags getCategoryTags(String category);
|
|
78 | 81 |
|
82 |
public String getFirstCategory(); |
|
83 |
|
|
79 | 84 |
} |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.lib/org.gvsig.online.lib.impl/src/main/java/org/gvsig/online/lib/impl/workspace/tables/EntitiesTable.java | ||
---|---|---|
25 | 25 |
import org.gvsig.tools.dispose.DisposeUtils; |
26 | 26 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
27 | 27 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
28 |
import org.gvsig.online.lib.impl.OnlineCategories; |
|
29 |
import org.gvsig.tools.dynobject.Tags; |
|
28 | 30 |
|
29 | 31 |
/** |
30 | 32 |
* |
... | ... | |
45 | 47 |
private static final String FEATURETYPE = "ENT_FEATURETYPE"; |
46 | 48 |
private static final String LABEL = "ENT_LABEL"; |
47 | 49 |
private static final String DATA_MODELS = "ENT_DATA_MODELS"; |
50 |
private static final String CATEGORY = "ENT_CATEGORY"; |
|
48 | 51 |
private static final String ENT_PROJECTION = "ENT_PROJECTION"; |
49 | 52 |
private static final String ENT_CUSTOMDATA = "ENT_CUSTOMDATA"; |
50 | 53 |
private static final String ENT_TILESIZE = "ENT_TILESIZE"; |
... | ... | |
52 | 55 |
public static class EntityRow extends AbstractRow implements OnlineEntityEditable { |
53 | 56 |
|
54 | 57 |
private FeatureType featureType; |
58 |
private OnlineCategories categories; |
|
55 | 59 |
|
56 | 60 |
public EntityRow(OnlineWorkingcopy workspace) { |
57 | 61 |
super(workspace, TABLE_NAME, COD_ENTITY); |
... | ... | |
93 | 97 |
} |
94 | 98 |
|
95 | 99 |
@Override |
100 |
public String getCategory() { |
|
101 |
return this.getString(CATEGORY); |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
public OnlineCategories getCategoriesAsList() { |
|
106 |
if( this.categories == null ) { |
|
107 |
this.categories = new OnlineCategories(getCategory()); |
|
108 |
} |
|
109 |
return this.categories; |
|
110 |
} |
|
111 |
|
|
112 |
@Override |
|
113 |
public Tags getCategoryTags(String category) { |
|
114 |
OnlineCategories l = getCategoriesAsList(); |
|
115 |
if( l==null ) { |
|
116 |
return Tags.EMPTY_TAGS; |
|
117 |
} |
|
118 |
return l.getTags(category); |
|
119 |
} |
|
120 |
|
|
121 |
@Override |
|
122 |
public String getFirstCategory() { |
|
123 |
OnlineCategories l = getCategoriesAsList(); |
|
124 |
if( CollectionUtils.isEmpty(l) ) { |
|
125 |
return null; |
|
126 |
} |
|
127 |
return l.get(0); |
|
128 |
} |
|
129 |
|
|
130 |
@Override |
|
96 | 131 |
public String getFirstDataModel() { |
97 | 132 |
List<String> l = getDataModelsAsList(); |
98 | 133 |
if( CollectionUtils.isEmpty(l) ) { |
... | ... | |
323 | 358 |
return state; |
324 | 359 |
} |
325 | 360 |
|
326 |
@Override |
|
327 |
public boolean isOutdated() { |
|
361 |
private boolean isOutdated() { |
|
328 | 362 |
return false; |
329 | 363 |
// final String repositoryRevisionCode = this.getRepositoryRevisionCode(); |
330 | 364 |
// if(StringUtils.isBlank(repositoryRevisionCode)){ |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.lib/org.gvsig.online.lib.impl/src/main/java/org/gvsig/online/lib/impl/OnlineCategories.java | ||
---|---|---|
1 |
package org.gvsig.online.lib.impl; |
|
2 |
|
|
3 |
import java.util.AbstractList; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collections; |
|
6 |
import java.util.List; |
|
7 |
import org.apache.commons.lang3.ArrayUtils; |
|
8 |
import org.apache.commons.lang3.StringUtils; |
|
9 |
import org.gvsig.tools.dynobject.Tagged; |
|
10 |
import org.gvsig.tools.dynobject.Tags; |
|
11 |
import org.gvsig.tools.dynobject.impl.DefaultTags; |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
* @author jjdelcerro |
|
16 |
*/ |
|
17 |
public class OnlineCategories extends AbstractList<String> implements List<String> { |
|
18 |
|
|
19 |
private final String categories_s; |
|
20 |
private List<Category> categories; |
|
21 |
|
|
22 |
private static class Category implements Tagged { |
|
23 |
|
|
24 |
private final String category_s; |
|
25 |
private String name; |
|
26 |
private DefaultTags tags; |
|
27 |
|
|
28 |
public Category(String category) { |
|
29 |
this.category_s = category; |
|
30 |
this.parse(); |
|
31 |
} |
|
32 |
|
|
33 |
private void parse() { |
|
34 |
this.tags = new DefaultTags(); |
|
35 |
this.name = "unknown"; |
|
36 |
|
|
37 |
String[] ss = StringUtils.split(this.category_s, ";"); |
|
38 |
if( ArrayUtils.isEmpty(ss) ) { |
|
39 |
return; |
|
40 |
} |
|
41 |
this.name = StringUtils.strip(ss[0]); |
|
42 |
for (int i = 1; i < ss.length; i++) { |
|
43 |
String s1 = ss[i]; |
|
44 |
if( StringUtils.isBlank(s1) ) { |
|
45 |
continue; |
|
46 |
} |
|
47 |
int n = s1.indexOf("="); |
|
48 |
if( n<0 ) { |
|
49 |
this.tags.set(StringUtils.strip(s1), null); |
|
50 |
} else { |
|
51 |
String tagname = StringUtils.strip(StringUtils.substring(s1, 0, n)); |
|
52 |
String tagvalue = StringUtils.stripToNull(StringUtils.substring(s1, n+1)); |
|
53 |
this.tags.set(tagname, tagvalue); |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
public String getName() { |
|
59 |
return this.name; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public Tags getTags() { |
|
64 |
return this.tags; |
|
65 |
} |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
public OnlineCategories(String categories) { |
|
70 |
this.categories_s = categories; |
|
71 |
this.categories = null; |
|
72 |
} |
|
73 |
|
|
74 |
private List<Category> getCategories() { |
|
75 |
if( this.categories == null ) { |
|
76 |
if( StringUtils.isBlank(this.categories_s) ) { |
|
77 |
this.categories = Collections.EMPTY_LIST; |
|
78 |
} else { |
|
79 |
try{ |
|
80 |
List<Category> r = new ArrayList<>(); |
|
81 |
String[] ss = StringUtils.split(this.categories_s, ","); |
|
82 |
for (String s1 : ss) { |
|
83 |
if (StringUtils.isBlank(s1)) { |
|
84 |
continue; |
|
85 |
} |
|
86 |
Category category = new Category(s1); |
|
87 |
r.add(category); |
|
88 |
} |
|
89 |
this.categories = r; |
|
90 |
} catch (Exception ex) { |
|
91 |
this.categories = Collections.EMPTY_LIST; |
|
92 |
} |
|
93 |
} |
|
94 |
} |
|
95 |
return this.categories; |
|
96 |
} |
|
97 |
|
|
98 |
@Override |
|
99 |
public String get(int index) { |
|
100 |
return this.getCategories().get(index).getName(); |
|
101 |
} |
|
102 |
|
|
103 |
@Override |
|
104 |
public int size() { |
|
105 |
return this.getCategories().size(); |
|
106 |
} |
|
107 |
|
|
108 |
public Tags getTags(String name) { |
|
109 |
for (Category category : this.getCategories()) { |
|
110 |
if( StringUtils.equalsIgnoreCase(name, category.getName()) ) { |
|
111 |
return category.getTags(); |
|
112 |
} |
|
113 |
} |
|
114 |
return Tags.EMPTY_TAGS; |
|
115 |
} |
|
116 |
} |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.impl/src/main/java/org/gvsig/online/swing/impl/OnlineEntitySelectorControllerJTree.java | ||
---|---|---|
526 | 526 |
} |
527 | 527 |
} |
528 | 528 |
|
529 |
// @Override
|
|
530 |
// public String getCategory(OnlineEntity entity) {
|
|
531 |
// String category = this.categoryOfCheckedEntity.get(entity.getEntityCode());
|
|
532 |
// if( StringUtils.isBlank(category) ) {
|
|
533 |
// category = entity.getFirstCategory();
|
|
534 |
// }
|
|
535 |
// return category;
|
|
536 |
// }
|
|
529 |
@Override |
|
530 |
public String getCategory(OnlineEntity entity) { |
|
531 |
String category = this.categoryOfCheckedEntity.get(entity.getEntityCode()); |
|
532 |
if( StringUtils.isBlank(category) ) { |
|
533 |
category = entity.getFirstCategory(); |
|
534 |
} |
|
535 |
return category; |
|
536 |
} |
|
537 | 537 |
|
538 | 538 |
@Override |
539 | 539 |
public List<OnlineEntity> getCheckedEntities() { |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.impl/src/main/java/org/gvsig/online/swing/impl/OnlineEntitySelectorControllerJComboBox.java | ||
---|---|---|
443 | 443 |
this.labelEntityFormatter = formatter; |
444 | 444 |
} |
445 | 445 |
|
446 |
// @Override
|
|
447 |
// public String getCategory(OnlineEntity entity) {
|
|
448 |
// String category = entity.getFirstCategory();
|
|
449 |
// return category;
|
|
450 |
// }
|
|
446 |
@Override |
|
447 |
public String getCategory(OnlineEntity entity) { |
|
448 |
String category = entity.getFirstCategory(); |
|
449 |
return category; |
|
450 |
} |
|
451 | 451 |
|
452 | 452 |
@Override |
453 | 453 |
public void collapseAll() { |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.impl/src/main/java/org/gvsig/online/swing/impl/OnlineEntitySelectorControllerJList.java | ||
---|---|---|
656 | 656 |
this.labelEntityFormatter = formatter; |
657 | 657 |
} |
658 | 658 |
|
659 |
// @Override
|
|
660 |
// public String getCategory(OnlineEntity entity) {
|
|
661 |
// String category = entity.getFirstCategory();
|
|
662 |
// return category;
|
|
663 |
// }
|
|
659 |
@Override |
|
660 |
public String getCategory(OnlineEntity entity) { |
|
661 |
String category = entity.getFirstCategory(); |
|
662 |
return category; |
|
663 |
} |
|
664 | 664 |
|
665 | 665 |
@Override |
666 | 666 |
public void collapseAll() { |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.impl/src/main/java/org/gvsig/online/swing/impl/OnlineSwingManagerImpl.java | ||
---|---|---|
103 | 103 |
return picker; |
104 | 104 |
} |
105 | 105 |
|
106 |
@Override |
|
107 |
public PickerController<OnlineWorkingcopy> createPickerWorkspaceController(JComboBox combo, JButton btnInitWorkspace) { |
|
108 |
OnlineWorkingcopyPickerControllerImpl picker = new OnlineWorkingcopyPickerControllerImpl(combo, btnInitWorkspace); |
|
109 |
return picker; |
|
110 |
} |
|
111 |
|
|
106 | 112 |
public static ImageIcon loadImage(String imageName) { |
107 | 113 |
String name = FilenameUtils.getBaseName(imageName); |
108 | 114 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getDefault(); |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.api/src/main/java/org/gvsig/online/swing/api/OnlineEntitySelectorController.java | ||
---|---|---|
94 | 94 |
|
95 | 95 |
public void setLabelEntityFormatter(Function<OnlineEntity,String> formatter); |
96 | 96 |
|
97 |
// public String getCategory(OnlineEntity category);
|
|
97 |
public String getCategory(OnlineEntity category); |
|
98 | 98 |
|
99 | 99 |
public void collapseAll(); |
100 | 100 |
|
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.swing/org.gvsig.online.swing.api/src/main/java/org/gvsig/online/swing/api/OnlineSwingManager.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
public PickerController<OnlineWorkingcopy> createPickerWorkspaceController(JComboBox combo); |
54 | 54 |
|
55 |
public PickerController<OnlineWorkingcopy> createPickerWorkspaceController(JComboBox combo, JButton btnInitWorkspace); |
|
56 |
|
|
55 | 57 |
public void setDefaultServices(OnlineSwingServices services); |
56 | 58 |
|
57 | 59 |
public OnlineSwingServices getDefaultServices(); |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.app/org.gvsig.online.app.mainplugin/src/main/java/org/gvsig/online/app/mainplugin/OnlineExtension.java | ||
---|---|---|
34 | 34 |
import org.gvsig.andami.plugins.Extension; |
35 | 35 |
import org.gvsig.app.ApplicationLocator; |
36 | 36 |
import org.gvsig.app.ApplicationManager; |
37 |
import org.gvsig.app.extension.AddLayer; |
|
37 | 38 |
import org.gvsig.app.project.ProjectManager.ProjectEvent; |
38 | 39 |
import static org.gvsig.app.project.ProjectNotification.AFTER_LOAD_FROM_FILE; |
39 | 40 |
import static org.gvsig.app.project.ProjectNotification.BEFORE_SAVE_TO_FILE; |
40 | 41 |
import org.gvsig.fmap.dal.EditingNotificationManager; |
41 | 42 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
42 | 43 |
import org.gvsig.online.app.mainplugin.OnlineDialogsHelper.OnlineDialogInfo; |
44 |
import org.gvsig.online.app.mainplugin.addlayer.WizardOnlineTabular; |
|
45 |
import org.gvsig.online.app.mainplugin.addlayer.WizardOnlineVectorial; |
|
43 | 46 |
import org.gvsig.online.lib.api.OnlineLocator; |
44 | 47 |
import org.gvsig.online.lib.api.OnlineManager; |
45 | 48 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
... | ... | |
124 | 127 |
100 |
125 | 128 |
); |
126 | 129 |
|
127 |
// ApplicationLocator.getManager().registerAddTableWizard(
|
|
128 |
// "Online",
|
|
129 |
// "Online",
|
|
130 |
// WizardOnlineTabular.class
|
|
131 |
// );
|
|
132 |
// AddLayer.addWizard(WizardOnlineVectorial.class);
|
|
130 |
ApplicationLocator.getManager().registerAddTableWizard( |
|
131 |
"Online", |
|
132 |
"Online", |
|
133 |
WizardOnlineTabular.class |
|
134 |
); |
|
135 |
AddLayer.addWizard(WizardOnlineVectorial.class); |
|
133 | 136 |
|
134 | 137 |
application.getProjectManager().addProjectListener((EventListener e) -> { |
135 | 138 |
if( e instanceof ProjectEvent ) { |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.app/org.gvsig.online.app.mainplugin/src/main/java/org/gvsig/online/app/mainplugin/addlayer/AbstractWizardOnline.java | ||
---|---|---|
1 |
package org.gvsig.online.app.mainplugin.addlayer; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Component; |
|
5 |
import java.awt.Cursor; |
|
6 |
import java.awt.event.ActionEvent; |
|
7 |
import java.net.URL; |
|
8 |
import java.util.ArrayList; |
|
9 |
import java.util.Collection; |
|
10 |
import java.util.HashMap; |
|
11 |
import java.util.List; |
|
12 |
import java.util.Map; |
|
13 |
import java.util.function.Function; |
|
14 |
import java.util.function.Predicate; |
|
15 |
import javax.swing.ImageIcon; |
|
16 |
import javax.swing.JButton; |
|
17 |
import javax.swing.JCheckBox; |
|
18 |
import javax.swing.JComboBox; |
|
19 |
import javax.swing.JComponent; |
|
20 |
import javax.swing.JLabel; |
|
21 |
import javax.swing.JList; |
|
22 |
import javax.swing.JOptionPane; |
|
23 |
import javax.swing.JTextField; |
|
24 |
import javax.swing.SwingUtilities; |
|
25 |
import javax.swing.UIManager; |
|
26 |
import javax.swing.event.ChangeEvent; |
|
27 |
import org.apache.commons.io.FilenameUtils; |
|
28 |
import org.apache.commons.lang3.StringUtils; |
|
29 |
import org.gvsig.app.gui.WizardPanel; |
|
30 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
|
31 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
|
32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
33 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
34 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
35 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
36 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
37 |
import org.gvsig.geodb.TableInfo; |
|
38 |
import org.gvsig.geodb.TableInfoController; |
|
39 |
import static org.gvsig.online.lib.api.OnlineManager.ERR_OK; |
|
40 |
import org.gvsig.online.lib.api.workingcopy.OnlineEntity; |
|
41 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
|
42 |
import org.gvsig.online.swing.api.OnlineEntitySelectorController; |
|
43 |
import static org.gvsig.online.swing.api.OnlineEntitySelectorController.ACTION_BEGIN_PROCESSING_ID; |
|
44 |
import static org.gvsig.online.swing.api.OnlineEntitySelectorController.ACTION_CHECK_ID; |
|
45 |
import static org.gvsig.online.swing.api.OnlineEntitySelectorController.ACTION_END_PROCESSING_ID; |
|
46 |
import static org.gvsig.online.swing.api.OnlineEntitySelectorController.ACTION_RELOAD_ID; |
|
47 |
import static org.gvsig.online.swing.api.OnlineEntitySelectorController.ACTION_SELECT_ID; |
|
48 |
import org.gvsig.online.swing.api.OnlineJInitWorkingcopy; |
|
49 |
import org.gvsig.online.swing.api.OnlineSwingLocator; |
|
50 |
import org.gvsig.online.swing.api.OnlineSwingManager; |
|
51 |
import org.gvsig.online.swing.api.OnlineSwingServices; |
|
52 |
import org.gvsig.tools.ToolsLocator; |
|
53 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
54 |
import org.gvsig.tools.i18n.I18nManager; |
|
55 |
import org.gvsig.tools.locator.LocatorException; |
|
56 |
import org.gvsig.tools.swing.api.InitComponentsListener; |
|
57 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
58 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
|
59 |
import org.gvsig.tools.swing.api.ToolsSwingUtils; |
|
60 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
61 |
import org.gvsig.tools.swing.api.task.TaskStatusController; |
|
62 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
|
63 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
64 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
65 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
66 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
67 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
68 |
import org.slf4j.Logger; |
|
69 |
import org.slf4j.LoggerFactory; |
|
70 |
|
|
71 |
/** |
|
72 |
* |
|
73 |
* @author jjdelcerro |
|
74 |
*/ |
|
75 |
@SuppressWarnings("UseSpecificCatch") |
|
76 |
public abstract class AbstractWizardOnline extends WizardPanel { |
|
77 |
|
|
78 |
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractWizardOnline.class); |
|
79 |
|
|
80 |
protected WizardOnlineViewExtended view; |
|
81 |
private PickerController<OnlineWorkingcopy> workspacePicker; |
|
82 |
protected Map<String, TableInfo> tablesInfo = null; |
|
83 |
private boolean processing; |
|
84 |
private TaskStatusController taskStatusController; |
|
85 |
private TableInfoController tableInfoController; |
|
86 |
private OnlineEntitySelectorController entitySelector; |
|
87 |
|
|
88 |
private class OnlineTableInfoController extends TableInfoController { |
|
89 |
|
|
90 |
public OnlineTableInfoController(JButton btnDeselectAllColumns, JButton btnSelectAllColumns, JList lstColumns, JTextField txtName, JComboBox cboIdField, JComboBox cboGeometryField, JTextField txtProjection, JButton btnProjection, JTextField txtFilter, JButton btnFilter, JButton btnFilterBookmarks, JButton btnFilterHistory, JButton btnAdvancedProperties, JLabel lblReadOnlyNotification, JComponent pnlCfgActions, JButton btnChangeViewProjection, JCheckBox visible) { |
|
91 |
super(btnDeselectAllColumns, btnSelectAllColumns, lstColumns, txtName, cboIdField, cboGeometryField, txtProjection, btnProjection, txtFilter, btnFilter, btnFilterBookmarks, btnFilterHistory, btnAdvancedProperties, lblReadOnlyNotification, pnlCfgActions, btnChangeViewProjection, visible); |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public void put(TableInfo tableInfo) { |
|
96 |
if( tableInfo!=null ) { |
|
97 |
Boolean v = tableInfo.getVisible(); |
|
98 |
if( v == null ) { |
|
99 |
OnlineEntity entity = ((OnlineTableInfo)tableInfo).getEntity(); |
|
100 |
if( entity!=null ) { |
|
101 |
String category = getCategory(entity); |
|
102 |
boolean defaultVisibility = entity.getCategoryTags(category).getBoolean("visibility",true); |
|
103 |
tableInfo.setVisible(defaultVisibility); |
|
104 |
} |
|
105 |
} |
|
106 |
} |
|
107 |
super.put(tableInfo); |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
protected void updateLabel(StringBuilder builder) throws LocatorException { |
|
112 |
super.updateLabel(builder); |
|
113 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
114 |
OnlineTableInfo info = (OnlineTableInfo) this.getTableInfo(); |
|
115 |
if( info.needConnectToModel() ) { |
|
116 |
builder.append(" - <b>"); |
|
117 |
builder.append(i18n.getTranslation("_Connect_to_model_required")); |
|
118 |
builder.append(" ("); |
|
119 |
builder.append(info.getEntity().getDataModels()); |
|
120 |
builder.append(")</b>"); |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
} |
|
125 |
|
|
126 |
public AbstractWizardOnline() { |
|
127 |
createComponents(); |
|
128 |
} |
|
129 |
|
|
130 |
private static void waitCursor(Component component, Runnable action) { |
|
131 |
Cursor saved_cursor = component.getCursor(); |
|
132 |
try { |
|
133 |
component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
|
134 |
action.run(); |
|
135 |
} finally { |
|
136 |
component.setCursor(saved_cursor); |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
private void createComponents() { |
|
141 |
|
|
142 |
ToolsSwingUtils.addInitComponentsListener(this, new InitComponentsListener() { |
|
143 |
@Override |
|
144 |
public void doDisposeComponents() { |
|
145 |
disposeComponents(); |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public void doInitComponents() { |
|
150 |
initComponents(); |
|
151 |
} |
|
152 |
}); |
|
153 |
|
|
154 |
this.view = new WizardOnlineViewExtended(); |
|
155 |
|
|
156 |
this.tableInfoController = new OnlineTableInfoController( |
|
157 |
this.view.btnDeselectAllColumns, |
|
158 |
this.view.btnSelectAllColumns, |
|
159 |
this.view.lstColumns, |
|
160 |
this.view.txtName, |
|
161 |
this.view.cboIdField, |
|
162 |
this.view.cboGeometryField, |
|
163 |
this.view.txtProjection, |
|
164 |
this.view.btnProjection, |
|
165 |
this.view.txtFilter, |
|
166 |
this.view.btnFilter, |
|
167 |
this.view.btnFilterBookmarks, |
|
168 |
this.view.btnFilterHistory, |
|
169 |
this.view.btnAdvancedProperties, |
|
170 |
this.view.lblReadOnlyNotification, |
|
171 |
null, |
|
172 |
this.view.btnChangeViewProjection, |
|
173 |
this.view.chkVisible |
|
174 |
); |
|
175 |
} |
|
176 |
|
|
177 |
private void disposeComponents() { |
|
178 |
DisposeUtils.disposeQuietly(entitySelector); |
|
179 |
} |
|
180 |
|
|
181 |
private void initComponents() { |
|
182 |
if(this.entitySelector != null) { |
|
183 |
return; |
|
184 |
} |
|
185 |
DataSwingManager dataSwingManager = DALSwingLocator.getDataSwingManager(); |
|
186 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
187 |
ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
|
188 |
OnlineSwingManager swingManager = OnlineSwingLocator.getOnlineSwingManager(); |
|
189 |
|
|
190 |
this.entitySelector = swingManager.createEntitySelectorController( |
|
191 |
this.view.treeTables, |
|
192 |
this.view.txtTablesFilter, |
|
193 |
this.view.btnTablesFilter); |
|
194 |
|
|
195 |
Predicate<OnlineEntity> entitySelectorFilter = OnlineEntitySelectorController.ALL_ENTITIES; |
|
196 |
|
|
197 |
if(this.requireGeometry()){ |
|
198 |
entitySelectorFilter = (OnlineEntity t) -> (StringUtils.isNotBlank(t.getGeometryFieldName())); |
|
199 |
} |
|
200 |
|
|
201 |
this.entitySelector.setFilter(entitySelectorFilter); |
|
202 |
this.entitySelector.setViewFilter(entitySelectorFilter); |
|
203 |
this.entitySelector.setLabelEntityFormatter(this.getLabelEntityFormatter()); |
|
204 |
|
|
205 |
this.entitySelector.setChecksEnabled(true); |
|
206 |
|
|
207 |
TaskStatusSwingManager taskStatusManager = ToolsSwingLocator.getTaskStatusSwingManager(); |
|
208 |
|
|
209 |
this.taskStatusController = taskStatusManager.createTaskStatusController( |
|
210 |
this.view.lblStatusTitle, |
|
211 |
this.view.lblStatusMessages, |
|
212 |
this.view.pbStatus |
|
213 |
); |
|
214 |
this.taskStatusController.setShowCancelButton(false); |
|
215 |
this.taskStatusController.setShowRemoveTaskButton(false); |
|
216 |
this.taskStatusController.bind(ToolsLocator.getTaskStatusManager()); |
|
217 |
|
|
218 |
toolsSwingManager.translate(this.view.lblColumns); |
|
219 |
toolsSwingManager.translate(this.view.lblWorkspace); |
|
220 |
toolsSwingManager.translate(this.view.lblFilter); |
|
221 |
toolsSwingManager.translate(this.view.lblGeometryField); |
|
222 |
toolsSwingManager.translate(this.view.lblIdField); |
|
223 |
toolsSwingManager.translate(this.view.lblName); |
|
224 |
toolsSwingManager.translate(this.view.lblProjection); |
|
225 |
toolsSwingManager.translate(this.view.lblTable); |
|
226 |
toolsSwingManager.translate(this.view.cboWorkspaces); |
|
227 |
toolsSwingManager.translate(this.view.btnAddWorkspace); |
|
228 |
toolsSwingManager.translate(this.view.btnCheckout); |
|
229 |
toolsSwingManager.translate(this.view.btnInitWorkspace); |
|
230 |
toolsSwingManager.translate(this.view.chkMaintainStructureInToC); |
|
231 |
toolsSwingManager.translate(this.view.btnTablesCheckAll); |
|
232 |
toolsSwingManager.translate(this.view.btnTablesUncheckAll); |
|
233 |
toolsSwingManager.translate(this.view.btnTablesCollapseAll); |
|
234 |
toolsSwingManager.translate(this.view.btnTablesExpandAll); |
|
235 |
toolsSwingManager.translate(this.view.chkCheckScale); |
|
236 |
toolsSwingManager.translate(this.view.chkAddToCWhenLoadingAll); |
|
237 |
toolsSwingManager.translate(this.view.tabTableInfo); |
|
238 |
toolsSwingManager.translate(this.view.lblVisible); |
|
239 |
toolsSwingManager.translate(this.view.btnConnectToModel); |
|
240 |
|
|
241 |
this.view.btnInitWorkspace.setText(toHTML(this.view.btnInitWorkspace.getText())); |
|
242 |
|
|
243 |
toolsSwingManager.addClearButton(this.view.txtName); |
|
244 |
toolsSwingManager.setDefaultPopupMenu(this.view.txtName); |
|
245 |
|
|
246 |
this.view.btnInitWorkspace.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
247 |
this.view.btnAddWorkspace.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
248 |
|
|
249 |
this.workspacePicker = swingManager.createPickerWorkspaceController( |
|
250 |
this.view.cboWorkspaces, |
|
251 |
this.view.btnAddWorkspace |
|
252 |
); |
|
253 |
|
|
254 |
this.workspacePicker.addChangeListener((ChangeEvent e) -> { |
|
255 |
waitCursor(this, () -> { |
|
256 |
doChangeWorkspace(); |
|
257 |
doUpdateComponents(); |
|
258 |
}); |
|
259 |
}); |
|
260 |
|
|
261 |
this.entitySelector.addActionListener((ActionEvent e) -> { |
|
262 |
switch(e.getID()){ |
|
263 |
case ACTION_RELOAD_ID: |
|
264 |
doReloadTablesInfo(); |
|
265 |
break; |
|
266 |
case ACTION_BEGIN_PROCESSING_ID: |
|
267 |
case ACTION_END_PROCESSING_ID: |
|
268 |
doUpdateComponents(); |
|
269 |
break; |
|
270 |
case ACTION_SELECT_ID: |
|
271 |
doChangeTableSelected(); |
|
272 |
break; |
|
273 |
case ACTION_CHECK_ID: |
|
274 |
doChangeTableChecked(); |
|
275 |
doUpdateComponents(); |
|
276 |
break; |
|
277 |
|
|
278 |
} |
|
279 |
}); |
|
280 |
this.view.btnTablesCheckAll.addActionListener((ActionEvent e) -> { |
|
281 |
// this.entitySelector.checkAll(); |
|
282 |
waitCursor(this, () -> { |
|
283 |
List<String> entityCodes = new ArrayList<>(); |
|
284 |
Collection<OnlineEntity> entities = entitySelector.getEntities(); |
|
285 |
for (OnlineEntity entity : entities) { |
|
286 |
entityCodes.add(entity.getEntityCode()); |
|
287 |
} |
|
288 |
entitySelector.setCheck(entityCodes, true); |
|
289 |
}); |
|
290 |
}); |
|
291 |
|
|
292 |
this.view.btnTablesUncheckAll.addActionListener((ActionEvent e) -> { |
|
293 |
this.entitySelector.clearChecks(); |
|
294 |
}); |
|
295 |
|
|
296 |
this.view.btnTablesCollapseAll.addActionListener((ActionEvent e) -> { |
|
297 |
this.entitySelector.collapseAll(); |
|
298 |
}); |
|
299 |
|
|
300 |
this.view.btnTablesExpandAll.addActionListener((ActionEvent e) -> { |
|
301 |
this.entitySelector.expandAll(); |
|
302 |
}); |
|
303 |
|
|
304 |
this.view.btnInitWorkspace.addActionListener((ActionEvent e) -> { |
|
305 |
doShowInitWorkspace(); |
|
306 |
}); |
|
307 |
|
|
308 |
this.view.btnCheckout.addActionListener((ActionEvent e) -> { |
|
309 |
doCheckout(); |
|
310 |
}); |
|
311 |
|
|
312 |
// this.view.btnConnectToModel.addActionListener((ActionEvent e) -> { |
|
313 |
// doConnectToModel(); |
|
314 |
// }); |
|
315 |
|
|
316 |
this.view.btnChangeViewProjection.setVisible(this.requireGeometry()); |
|
317 |
|
|
318 |
this.view.btnInitWorkspace.setBackground(UIManager.getColor("Panel.background")); |
|
319 |
// this.view.txtRepositoryInfo.setBackground(UIManager.getColor("Panel.background")); |
|
320 |
|
|
321 |
this.clearTables(); |
|
322 |
|
|
323 |
this.view.chkMaintainStructureInToC.setVisible(false); |
|
324 |
this.view.chkMaintainStructureInToC.setSelected(true); |
|
325 |
|
|
326 |
this.view.chkCheckScale.setSelected(true); |
|
327 |
|
|
328 |
this.view.chkAddToCWhenLoadingAll.setSelected(true); |
|
329 |
|
|
330 |
this.setLayout(new BorderLayout()); |
|
331 |
this.add(this.view, BorderLayout.CENTER); |
|
332 |
|
|
333 |
ToolsSwingUtils.ensureRowsCols(this, 22, 90, 25, 100); |
|
334 |
doUpdateComponents(); |
|
335 |
} |
|
336 |
|
|
337 |
protected abstract boolean requireGeometry(); |
|
338 |
|
|
339 |
protected boolean maintainStructureInToC() { |
|
340 |
return this.view.chkMaintainStructureInToC.isSelected(); |
|
341 |
} |
|
342 |
|
|
343 |
protected void setVisibleMaintainStructureInToC(boolean visible) { |
|
344 |
this.view.chkMaintainStructureInToC.setVisible(visible); |
|
345 |
} |
|
346 |
|
|
347 |
protected Collection<TableInfo> getTablesInformation() { |
|
348 |
this.updateTableInfoFromUI(); |
|
349 |
if( this.tablesInfo == null ) { |
|
350 |
this.tablesInfo = new HashMap<>(); |
|
351 |
} |
|
352 |
return this.tablesInfo.values(); |
|
353 |
} |
|
354 |
|
|
355 |
private void clearTables() { |
|
356 |
this.entitySelector.clear(); |
|
357 |
this.tableInfoController.clear(); |
|
358 |
} |
|
359 |
|
|
360 |
private void doChangeWorkspace() { |
|
361 |
if (notInSwingThreadInvokeLater(this::doChangeWorkspace)) { |
|
362 |
return; |
|
363 |
} |
|
364 |
|
|
365 |
OnlineWorkingcopy workspace = workspacePicker.get(); |
|
366 |
|
|
367 |
this.entitySelector.setWorkspace(workspace); |
|
368 |
// if (workspace == null) { |
|
369 |
// this.view.txtRepositoryInfo.setText(""); |
|
370 |
// return; |
|
371 |
// } |
|
372 |
// |
|
373 |
// this.view.txtRepositoryInfo.setText(workspace.getRepository().getLabel()); |
|
374 |
} |
|
375 |
|
|
376 |
private TableInfo getTableInfo(OnlineEntity entity){ |
|
377 |
Collection<TableInfo> tablesInformation = getTablesInformation(); |
|
378 |
for (TableInfo tableInfo : tablesInformation) { |
|
379 |
OnlineEntity tableInfoEntity = (OnlineEntity) tableInfo.getProperty("entity"); |
|
380 |
if(tableInfoEntity!=null && StringUtils.equals(tableInfoEntity.getEntityCode(), entity.getEntityCode())){ |
|
381 |
return tableInfo; |
|
382 |
} |
|
383 |
} |
|
384 |
return null; |
|
385 |
} |
|
386 |
|
|
387 |
private void doChangeTableSelected() { |
|
388 |
if( notInSwingThreadInvokeLater(() -> {doChangeTableSelected();}) ) { |
|
389 |
return; |
|
390 |
} |
|
391 |
|
|
392 |
OnlineEntity selected = this.entitySelector.getSelectedEntity(); |
|
393 |
if(selected == null){ |
|
394 |
this.tableInfoController.put(null); |
|
395 |
return; |
|
396 |
} |
|
397 |
TableInfo tableInfo = getTableInfo(selected); |
|
398 |
if (tableInfo != null) { |
|
399 |
this.updateTableInfoFromUI(); |
|
400 |
this.tableInfoController.put(tableInfo); |
|
401 |
this.tableInfoController.setEnabled(true); |
|
402 |
} else { |
|
403 |
this.tableInfoController.clear(); |
|
404 |
this.tableInfoController.setEnabled(false); |
|
405 |
} |
|
406 |
|
|
407 |
showMessage(""); |
|
408 |
doUpdateComponents(); |
|
409 |
} |
|
410 |
|
|
411 |
private void doChangeTableChecked() { |
|
412 |
List<OnlineEntity> checkedEntities = this.entitySelector.getCheckedEntities(); |
|
413 |
List<String> entityCodes = new ArrayList<>(); |
|
414 |
for (OnlineEntity checkedEntity : checkedEntities) { |
|
415 |
if( checkedEntity!=null && !(checkedEntity instanceof OnlineEntity)){ |
|
416 |
entityCodes.add(checkedEntity.getEntityCode()); |
|
417 |
} |
|
418 |
} |
|
419 |
this.entitySelector.setCheck(entityCodes, false); |
|
420 |
|
|
421 |
Collection<TableInfo> tablesInformation = getTablesInformation(); |
|
422 |
for (TableInfo tableInfo : tablesInformation) { |
|
423 |
OnlineEntity tableInfoEntity = (OnlineEntity) tableInfo.getProperty("entity"); |
|
424 |
tableInfo.setSelected(checkedEntities.contains(tableInfoEntity)); |
|
425 |
} |
|
426 |
this.checkFinishable(); |
|
427 |
} |
|
428 |
|
|
429 |
|
|
430 |
private void updateTableInfoFromUI() { |
|
431 |
String previousId = this.tableInfoController.getId(); |
|
432 |
if (previousId == null) { |
|
433 |
return; |
|
434 |
} |
|
435 |
|
|
436 |
if (this.tablesInfo != null && !this.tablesInfo.isEmpty()) { |
|
437 |
TableInfo previousInfo = this.tablesInfo.get(previousId); |
|
438 |
if (previousInfo != null) { |
|
439 |
this.tableInfoController.fetch(previousInfo); |
|
440 |
} |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
@Override |
|
445 |
public void initWizard() { |
|
446 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
447 |
setTabName(i18n.getTranslation("_Online")); |
|
448 |
} |
|
449 |
|
|
450 |
@Override |
|
451 |
public boolean areSettingsValid() { |
|
452 |
if(processing){ |
|
453 |
return false; |
|
454 |
} |
|
455 |
boolean hasInvalidValues = false; |
|
456 |
boolean hasSelectedTables = false; |
|
457 |
for (TableInfo tableInfo : this.getTablesInformation() ) { |
|
458 |
if (tableInfo.isSelected()) { |
|
459 |
hasSelectedTables = true; |
|
460 |
if (!tableInfo.hasValidValues()) { |
|
461 |
hasInvalidValues = true; |
|
462 |
} |
|
463 |
} |
|
464 |
} |
|
465 |
return hasSelectedTables && !hasInvalidValues; |
|
466 |
} |
|
467 |
|
|
468 |
@Override |
|
469 |
public DataStoreParameters[] getParameters() { |
|
470 |
int sz = 0; |
|
471 |
for (TableInfo tableInfo : this.getTablesInformation() ) { |
|
472 |
if( tableInfo.isSelected() ) { |
|
473 |
sz++; |
|
474 |
} |
|
475 |
} |
|
476 |
if( sz == 0 ) { |
|
477 |
return null; |
|
478 |
} |
|
479 |
DataStoreParameters[] dbParameters = new DataStoreParameters[sz]; |
|
480 |
int n = 0; |
|
481 |
for (TableInfo tableInfo : this.getTablesInformation() ) { |
|
482 |
if( tableInfo.isSelected() ) { |
|
483 |
dbParameters[n++] = tableInfo.getParameters(); |
|
484 |
} |
|
485 |
} |
|
486 |
return dbParameters; |
|
487 |
} |
|
488 |
|
|
489 |
@Override |
|
490 |
public void execute() { |
|
491 |
executeWizard(); |
|
492 |
} |
|
493 |
|
|
494 |
@Override |
|
495 |
public void close() { |
|
496 |
|
|
497 |
} |
|
498 |
|
|
499 |
protected void checkFinishable() { |
|
500 |
boolean finishable = areSettingsValid(); |
|
501 |
callStateChanged(finishable); |
|
502 |
} |
|
503 |
|
|
504 |
private void doUpdateComponents() { |
|
505 |
OnlineEntity entity = this.entitySelector.getSelectedEntity(); |
|
506 |
|
|
507 |
boolean theProcessing = this.processing || this.entitySelector.isProcessing(); |
|
508 |
|
|
509 |
OnlineWorkingcopy ws = getWorkspace(); |
|
510 |
if(entity == null){ |
|
511 |
this.view.btnCheckout.setEnabled(false); |
|
512 |
this.tableInfoController.setEnabled(false); |
|
513 |
} else if(entity instanceof OnlineEntity){ |
|
514 |
this.view.btnCheckout.setEnabled(false); |
|
515 |
this.tableInfoController.setEditable(!theProcessing && ws != null); |
|
516 |
this.tableInfoController.setEnabled(ws != null); |
|
517 |
} else { //Entidad de repositorio |
|
518 |
this.view.btnCheckout.setEnabled(!theProcessing && ws != null); |
|
519 |
this.tableInfoController.setEnabled(false); |
|
520 |
} |
|
521 |
|
|
522 |
this.entitySelector.setEnabled(!theProcessing && ws != null); |
|
523 |
this.view.btnTablesCheckAll.setEnabled(this.entitySelector.isEnabled()); |
|
524 |
this.view.btnTablesUncheckAll.setEnabled(this.entitySelector.isEnabled()); |
|
525 |
this.view.btnTablesCollapseAll.setEnabled(this.entitySelector.isEnabled()); |
|
526 |
this.view.btnTablesExpandAll.setEnabled(this.entitySelector.isEnabled()); |
|
527 |
this.workspacePicker.setEnabled(!theProcessing); |
|
528 |
this.view.btnInitWorkspace.setEnabled(!theProcessing); |
|
529 |
// this.view.txtRepositoryInfo.setEnabled(!theProcessing && ws != null); |
|
530 |
this.setVisibleStatus(theProcessing); |
|
531 |
this.checkFinishable(); |
|
532 |
} |
|
533 |
|
|
534 |
private void doShowInitWorkspace() { |
|
535 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
536 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
537 |
OnlineSwingManager swingManager = OnlineSwingLocator.getOnlineSwingManager(); |
|
538 |
|
|
539 |
final OnlineJInitWorkingcopy panelInitWorkspace = swingManager.createInitWorkspacePanel(); |
|
540 |
final Dialog dialogInitWorkspace = winManager.createDialog( |
|
541 |
panelInitWorkspace.asJComponent(), |
|
542 |
i18nManager.getTranslation("_Online_Initialize_workingcopy"), |
|
543 |
i18nManager.getTranslation("_Online_Initialize_workingcopy"), |
|
544 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
545 |
); |
|
546 |
|
|
547 |
panelInitWorkspace.setDialog(dialogInitWorkspace); |
|
548 |
dialogInitWorkspace.setButtonLabel( |
|
549 |
WindowManager_v2.BUTTON_OK, |
|
550 |
i18nManager.getTranslation("_VCS_Initialize_workingcopy") |
|
551 |
); |
|
552 |
dialogInitWorkspace.addActionListener((ActionEvent e) -> { |
|
553 |
switch (dialogInitWorkspace.getAction()) { |
|
554 |
case WindowManager_v2.BUTTON_OK: |
|
555 |
int r = panelInitWorkspace.actionPerformed(); |
|
556 |
if (r != 0) { |
|
557 |
String message = "_Cant_initialize_workingcopy_{0}"; |
|
558 |
|
|
559 |
StringBuilder compoundMessage = new StringBuilder(); |
|
560 |
String[] messageArgs = new String[]{panelInitWorkspace.getWorkspaceName()}; |
|
561 |
|
|
562 |
compoundMessage.append(i18nManager.getTranslation( |
|
563 |
message, |
|
564 |
messageArgs |
|
565 |
)); |
|
566 |
|
|
567 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
568 |
dialogsManager.messageDialog( |
|
569 |
compoundMessage.toString(), |
|
570 |
i18nManager.getTranslation("_VCS_Initialize_workingcopy"), |
|
571 |
JOptionPane.WARNING_MESSAGE |
|
572 |
); |
|
573 |
} |
|
574 |
|
|
575 |
break; |
|
576 |
|
|
577 |
} |
|
578 |
}); |
|
579 |
dialogInitWorkspace.show(WindowManager.MODE.DIALOG); |
|
580 |
} |
|
581 |
|
|
582 |
public OnlineWorkingcopy getWorkspace() { |
|
583 |
return this.workspacePicker.get(); |
|
584 |
} |
|
585 |
|
|
586 |
private void doReloadTablesInfo() { |
|
587 |
if (notInSwingThreadInvokeLater(() -> { doReloadTablesInfo(); })) { |
|
588 |
return; |
|
589 |
} |
|
590 |
|
|
591 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
592 |
|
|
593 |
try { |
|
594 |
Collection<OnlineEntity> entities = this.entitySelector.getEntities(); |
|
595 |
for (OnlineEntity entity : entities) { |
|
596 |
if (entity instanceof OnlineEntity) { |
|
597 |
JDBCStoreParameters parameters = getWorkspace().getExplorer().get(entity.getEntityName()); |
|
598 |
TableInfo tableInfo = new OnlineTableInfo(entity, parameters, this.requireGeometry(), false); |
|
599 |
if(StringUtils.isNotBlank(entity.getLabel()) ) { |
|
600 |
tableInfo.setDocumentName(entity.getLabel()); |
|
601 |
} |
|
602 |
tableInfo.setProperty("entity", entity); |
|
603 |
this.tablesInfo.put(tableInfo.getId(), tableInfo); |
|
604 |
} |
|
605 |
} |
|
606 |
|
|
607 |
} catch (Exception e) { |
|
608 |
LOGGER.warn("_Cant_update_layers_list", e); |
|
609 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
610 |
dialogs.messageDialog( |
|
611 |
i18n.getTranslation("_Cant_update_layers_list") + "\n" + e.getMessage(), |
|
612 |
i18n.getTranslation("_Add_layer"), |
|
613 |
JOptionPane.WARNING_MESSAGE |
|
614 |
); |
|
615 |
} |
|
616 |
} |
|
617 |
|
|
618 |
private void doCheckout() { |
|
619 |
OnlineWorkingcopy workspace = getWorkspace(); |
|
620 |
if (workspace == null) { |
|
621 |
return; |
|
622 |
} |
|
623 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
624 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
625 |
OnlineEntity rEntity = this.entitySelector.getSelectedEntity(); |
|
626 |
if(rEntity== null || rEntity instanceof OnlineEntity){ |
|
627 |
return; |
|
628 |
} |
|
629 |
final String entityName = rEntity.getEntityName(); |
|
630 |
Thread task = new Thread(() -> { |
|
631 |
try { |
|
632 |
processing = true; |
|
633 |
doUpdateComponents(); |
|
634 |
|
|
635 |
showMessage(i18n.getTranslation("_Checking_out")); |
|
636 |
int res = workspace.download( |
|
637 |
entityName, |
|
638 |
null, |
|
639 |
this.getTaskStatusController().getSimpleTaskStatus() |
|
640 |
); |
|
641 |
if (res != ERR_OK) { |
|
642 |
LOGGER.warn("_Cant_checkout_table"); |
|
643 |
dialogs.messageDialog( |
|
644 |
i18n.getTranslation("_Cant_checkout_table") + "\n" + workspace.getErrorMessage(res), |
|
645 |
i18n.getTranslation("_Add_table"), |
|
646 |
JOptionPane.WARNING_MESSAGE |
|
647 |
); |
|
648 |
return; |
|
649 |
} |
|
650 |
downloadAndRegisterResources(entityName); |
|
651 |
showMessage(i18n.getTranslation("_Checkout_finished")); |
|
652 |
JDBCStoreParameters parameters = getWorkspace().getExplorer().get(entityName); |
|
653 |
TableInfo tableInfo = new OnlineTableInfo(workspace.getWorkspaceEntity(entityName), parameters, this.requireGeometry(), false); |
|
654 |
this.tablesInfo.put(tableInfo.getId(), tableInfo); |
|
655 |
doPostCheckout(entityName); |
|
656 |
} catch (Exception e) { |
|
657 |
LOGGER.warn("_Cant_add_table"); |
|
658 |
dialogs.messageDialog( |
|
659 |
i18n.getTranslation("_Cant_add_table") + "\n" + e.getMessage(), |
|
660 |
i18n.getTranslation("_Add_table"), |
|
661 |
JOptionPane.WARNING_MESSAGE |
|
662 |
); |
|
663 |
} finally { |
|
664 |
processing = false; |
|
665 |
doUpdateComponents(); |
|
666 |
} |
|
667 |
}, "OnlineAddTableCheckout"); |
|
668 |
processing = true; |
|
669 |
doUpdateComponents(); |
|
670 |
task.start(); |
|
671 |
} |
|
672 |
|
|
673 |
private void doPostCheckout(String entityName) { |
|
674 |
if (notInSwingThreadInvokeLater(() -> { doPostCheckout(entityName); })) { |
|
675 |
return; |
|
676 |
} |
|
677 |
OnlineWorkingcopy workspace = getWorkspace(); |
|
678 |
if (workspace == null) { |
|
679 |
return; |
|
680 |
} |
|
681 |
|
|
682 |
doChangeWorkspace(); |
|
683 |
this.entitySelector.setSelectedEntity(workspace.getWorkspaceEntity(entityName)); |
|
684 |
doChangeTableSelected(); |
|
685 |
} |
|
686 |
|
|
687 |
private void showMessage(String message) { |
|
688 |
if( notInSwingThreadInvokeLater(() -> {showMessage(message);}) ) { |
|
689 |
return; |
|
690 |
} |
|
691 |
this.view.lblStatusMessages.setText(message); |
|
692 |
} |
|
693 |
|
|
694 |
public boolean isProcessing() { |
|
695 |
return processing; |
|
696 |
} |
|
697 |
|
|
698 |
public void setVisibleStatus(boolean visible) { |
|
699 |
if( notInSwingThreadInvokeLater(() -> {setVisibleStatus(visible);}) ) { |
|
700 |
return; |
|
701 |
} |
|
702 |
this.view.lblStatusTitle.setVisible(visible); |
|
703 |
this.view.pbStatus.setVisible(visible); |
|
704 |
this.view.lblStatusMessages.setVisible(true); |
|
705 |
} |
|
706 |
|
|
707 |
public TaskStatusController getTaskStatusController() { |
|
708 |
return this.taskStatusController; |
|
709 |
} |
|
710 |
|
|
711 |
public static boolean notInSwingThreadInvokeLater(Runnable x) { |
|
712 |
if( SwingUtilities.isEventDispatchThread() ) { |
|
713 |
return false; |
|
714 |
} |
|
715 |
SwingUtilities.invokeLater(x); |
|
716 |
return true; |
|
717 |
} |
|
718 |
|
|
719 |
protected static class WizardOnlineViewExtended extends AbstractWizardOnlineView { |
|
720 |
|
|
721 |
@Override |
|
722 |
public ImageIcon loadImage(String imageName) { |
|
723 |
String name = FilenameUtils.getBaseName(imageName); |
|
724 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getDefault(); |
|
725 |
if (theme.exists(name)) { |
|
726 |
return theme.get(name); |
|
727 |
} |
|
728 |
URL url = WizardOnlineViewExtended.class.getResource("images/" + name + ".png"); |
|
729 |
if (url == null) { |
|
730 |
return null; |
|
731 |
} |
|
732 |
return new ImageIcon(url); |
|
733 |
} |
|
734 |
} |
|
735 |
|
|
736 |
private String toHTML(String s) { |
|
737 |
s = StringUtils.replace(s, "\n", "<br>"); |
|
738 |
s = StringUtils.replace(s, "<html>", ""); |
|
739 |
s = StringUtils.replace(s, "</html>", ""); |
|
740 |
s = "<html>"+s+"</html>"; |
|
741 |
return s; |
|
742 |
} |
|
743 |
|
|
744 |
protected void downloadAndRegisterResources(String tableName) { |
|
745 |
OnlineWorkingcopy workspace = getWorkspace(); |
|
746 |
OnlineEntity entity = workspace.getWorkspaceEntityByName(tableName); |
|
747 |
if(entity == null){ |
|
748 |
return; |
|
749 |
} |
|
750 |
OnlineEntity lEntity = workspace.getEntity(entity.getEntityCode()); |
|
751 |
// String resources = lEntity.getResources(); |
|
752 |
// if (StringUtils.isNotBlank(resources)) { |
|
753 |
// try { |
|
754 |
// if (!workspace.existsInWorkspace(workspace.getWorkspaceEntity(resources))) { |
|
755 |
// workspace.checkout( |
|
756 |
// resources, |
|
757 |
// null |
|
758 |
// ); |
|
759 |
// } |
|
760 |
// } catch (Exception e) { |
|
761 |
// LOGGER.warn("Can't checkout resources table '" + resources + "'", e); |
|
762 |
// } |
|
763 |
// workspace.getExplorer().setCustomResources(entity.getEntityName(), resources,true); |
|
764 |
// } |
|
765 |
|
|
766 |
} |
|
767 |
|
|
768 |
@Override |
|
769 |
public void setMapContext(MapContext mapContext) { |
|
770 |
super.setMapContext(mapContext); |
|
771 |
this.tableInfoController.setMapContext(mapContext); |
|
772 |
} |
|
773 |
|
|
774 |
protected Function<OnlineEntity,String> getLabelEntityFormatter() { |
|
775 |
return null; |
|
776 |
|
|
777 |
} |
|
778 |
|
|
779 |
protected boolean getCheckScale() { |
|
780 |
return this.view.chkCheckScale.isSelected(); |
|
781 |
} |
|
782 |
|
|
783 |
protected boolean getAddToCWhenLoadingAll() { |
|
784 |
return this.view.chkAddToCWhenLoadingAll.isSelected(); |
|
785 |
} |
|
786 |
|
|
787 |
protected String getCategory(OnlineEntity entity) { |
|
788 |
return this.entitySelector.getCategory(entity); |
|
789 |
} |
|
790 |
|
|
791 |
protected void registerDataModelRepository(OnlineWorkingcopy workspace, String dataModelName) { |
|
792 |
OnlineSwingManager swingManager = OnlineSwingLocator.getOnlineSwingManager(); |
|
793 |
OnlineSwingServices services = swingManager.getDefaultServices(); |
|
794 |
|
|
795 |
workspace.registerDataModelRepository(dataModelName); |
|
796 |
services.connectedToModel(workspace, dataModelName); |
|
797 |
} |
|
798 |
|
|
799 |
// private void doConnectToModel() { |
|
800 |
// OnlineWorkingcopy workspace = getWorkspace(); |
|
801 |
// if (workspace == null) { |
|
802 |
// return; |
|
803 |
// } |
|
804 |
// I18nManager i18n = ToolsLocator.getI18nManager(); |
|
805 |
//// ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
806 |
// WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
807 |
// OnlineSwingManager swingManager = OnlineSwingLocator.getOnlineSwingManager(); |
|
808 |
// |
|
809 |
// String modelName = null; |
|
810 |
// OnlineEntity entity = this.entitySelector.getSelectedEntity(); |
|
811 |
// if(entity != null ){ |
|
812 |
// modelName = entity.getFirstDataModel(); |
|
813 |
// } |
|
814 |
// OnlineJCheckoutDataModel panel = swingManager.createCheckoutDataModelPanel(workspace, modelName); |
|
815 |
// Dialog theDialog = winManager.createDialog( |
|
816 |
// panel.asJComponent(), |
|
817 |
// i18n.getTranslation("_VCS_Connect_to_datamodel"), |
|
818 |
// null, |
|
819 |
// WindowManager_v2.BUTTONS_OK_CANCEL |
|
820 |
// ); |
|
821 |
// panel.setDialog(theDialog); |
|
822 |
// theDialog.addActionListener((ActionEvent e) -> { |
|
823 |
// if( theDialog.getAction() == WindowManager_v2.BUTTON_OK) { |
|
824 |
// panel.connectToModel(); |
|
825 |
// } |
|
826 |
// }); |
|
827 |
// theDialog.show(WindowManager.MODE.DIALOG); |
|
828 |
// } |
|
829 |
|
|
830 |
} |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.app/org.gvsig.online.app.mainplugin/src/main/java/org/gvsig/online/app/mainplugin/addlayer/WizardOnlineVectorial.java | ||
---|---|---|
1 |
package org.gvsig.online.app.mainplugin.addlayer; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Comparator; |
|
5 |
import java.util.List; |
|
6 |
import java.util.function.Function; |
|
7 |
import javax.swing.JOptionPane; |
|
8 |
import org.apache.commons.lang.StringUtils; |
|
9 |
import org.cresques.cts.IProjection; |
|
10 |
import org.gvsig.fmap.dal.DALLocator; |
|
11 |
import org.gvsig.fmap.dal.DataManager; |
|
12 |
import org.gvsig.fmap.dal.StoresRepository; |
|
13 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
14 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
|
15 |
import org.gvsig.fmap.geom.Geometry; |
|
16 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
17 |
import org.gvsig.fmap.mapcontext.BaseCreateLayerParameters; |
|
18 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
19 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
20 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
21 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
22 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
23 |
import org.gvsig.geodb.TableInfo; |
|
24 |
import static org.gvsig.geodb.vectorialdb.visibility.LayerScaleVisibilityUtils.checkForVisibilityScale; |
|
25 |
import org.gvsig.online.lib.api.workingcopy.OnlineEntity; |
|
26 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.i18n.I18nManager; |
|
29 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
30 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
31 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
*/ |
|
37 |
@SuppressWarnings("UseSpecificCatch") |
|
38 |
public class WizardOnlineVectorial extends AbstractWizardOnline { |
|
39 |
|
|
40 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
41 |
public WizardOnlineVectorial() { |
|
42 |
super(); |
|
43 |
this.setVisibleMaintainStructureInToC(true); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected boolean requireGeometry() { |
|
48 |
return true; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public Object executeWizard() { |
|
53 |
DataManager man = DALLocator.getDataManager(); |
|
54 |
MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
|
55 |
|
|
56 |
MapControl mapControl = this.getMapCtrl(); |
|
57 |
MapContext mapContext = mapControl.getMapContext(); |
|
58 |
|
|
59 |
OnlineWorkingcopy workspace = this.getWorkspace(); |
|
60 |
boolean checkScale = this.getCheckScale(); |
|
61 |
|
|
62 |
for (TableInfo tableInfo : getTablesInformation()) { |
|
63 |
if (!tableInfo.isSelected()) { |
|
64 |
continue; |
|
65 |
} |
|
66 |
if( ((OnlineTableInfo)tableInfo).needConnectToModel() ) { |
|
67 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
68 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
69 |
int n = dialogs.confirmDialog( |
|
70 |
i18n.getTranslation("_Some_of_the_selected_tables_require_connection_to_a_data_model") + |
|
71 |
"\n" + |
|
72 |
i18n.getTranslation("_It_is_recommended_that_you_connect_to_the_data_model_before_loading_the_tables") + |
|
73 |
"\n" + |
|
74 |
i18n.getTranslation("_Do_you_want_to_add_the_selected_tables_anyway"), |
|
75 |
i18n.getTranslation("_AddLayer"), |
|
76 |
JOptionPane.YES_NO_OPTION, |
|
77 |
JOptionPane.QUESTION_MESSAGE, |
|
78 |
"_Some_of_the_selected_tables_require_connection_to_a_data_model" |
|
79 |
); |
|
80 |
if( n != JOptionPane.YES_OPTION ) { |
|
81 |
return null; |
|
82 |
} |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
Thread th = new Thread(() -> { |
|
87 |
SimpleTaskStatus taskstatus = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("Loading layers"); |
|
88 |
taskstatus.setIndeterminate(); |
|
89 |
taskstatus.setAutoremove(true); |
|
90 |
taskstatus.add(); |
|
91 |
try { |
|
92 |
List<OnlineTableInfo> tablesInformation = new ArrayList<>(); |
|
93 |
for (TableInfo tableInfo : getTablesInformation()) { |
|
94 |
if (!tableInfo.isSelected()) { |
|
95 |
continue; |
|
96 |
} |
|
97 |
tablesInformation.add((OnlineTableInfo) tableInfo); |
|
98 |
} |
|
99 |
tablesInformation.sort(new Comparator<OnlineTableInfo>() { |
|
100 |
@Override |
|
101 |
public int compare(OnlineTableInfo o1, OnlineTableInfo o2) { |
|
102 |
if( o1==null || o2==null ) { |
|
103 |
return 0; |
|
104 |
} |
|
105 |
OnlineEntity e1 = o1.getEntity(); |
|
106 |
OnlineEntity e2 = o2.getEntity(); |
|
107 |
if( e1==null || e2==null ) { |
|
108 |
return 0; |
|
109 |
} |
|
110 |
FeatureType ft1 = o1.getFeatureType(); |
|
111 |
FeatureType ft2 = o2.getFeatureType(); |
|
112 |
int order1 = (ft1==null)? 0:ft1.getTags().getInt("TOC_Order",0); |
|
113 |
int order2 = (ft2==null)? 0:ft2.getTags().getInt("TOC_Order",0); |
|
114 |
String id1 = String.format("%05d/%02d/%s/%s", order1, getLayerOrderWeight(e1), getCategory(e1), e1.getLabelOrName()); |
|
115 |
String id2 = String.format("%05d/%02d/%s/%s", order2, getLayerOrderWeight(e2), getCategory(e2), e2.getLabelOrName()); |
|
116 |
return id2.compareTo(id1); |
|
117 |
} |
|
118 |
}); |
|
119 |
|
|
120 |
List<String> dataModels = new ArrayList<>(); |
|
121 |
for (OnlineTableInfo tableInfo : tablesInformation) { |
|
122 |
OnlineEntity entity = tableInfo.getEntity(); |
|
123 |
List<String> entityModels = entity.getDataModelsAsList(); |
|
124 |
if( entityModels!=null ) { |
|
125 |
for (String entityModel : entityModels) { |
|
126 |
dataModels.add(entityModel); |
|
127 |
} |
|
128 |
} |
|
129 |
} |
|
130 |
if( !dataModels.isEmpty() ) { |
|
131 |
for (StoresRepository storesRepository : man.getStoresRepository().getSubrepositories() ) { |
|
132 |
dataModels.remove(storesRepository.getID()); |
|
133 |
} |
|
134 |
for (String dataModel : dataModels) { |
|
135 |
registerDataModelRepository(workspace, dataModel); |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
taskstatus.setRangeOfValues(0, tablesInformation.size()); |
|
140 |
FLayer layer; |
|
141 |
for (OnlineTableInfo tableInfo : tablesInformation) { |
|
142 |
if( taskstatus.isCancellationRequested() ) { |
|
143 |
taskstatus.cancel(); |
|
144 |
return; |
|
145 |
} |
|
146 |
taskstatus.message(tableInfo.getEntity().getLabelOrName()); |
|
147 |
LOGGER.info("Load layer '"+tableInfo.getId()+"'"); |
|
148 |
DBStoreParameters params = tableInfo.getParameters(); |
|
149 |
OnlineEntity entity = tableInfo.getEntity(); |
|
150 |
List<String> entityModels = entity.getDataModelsAsList(); |
|
151 |
if( entityModels!=null ) { |
|
152 |
for (String entityModel : entityModels) { |
|
153 |
dataModels.add(entityModel); |
|
154 |
} |
|
155 |
} |
|
156 |
String category = this.getCategory(entity); |
|
157 |
fixCRS(params); |
|
158 |
|
|
159 |
if( tableInfo.getVisible()==null ) { |
|
160 |
tableInfo.setVisible(entity.getCategoryTags(category).getBoolean("visibility", true)); |
|
161 |
} |
|
162 |
boolean defaultVisibility = tableInfo.getVisible(); |
|
163 |
|
|
164 |
try { |
|
165 |
|
|
166 |
layer = mapContextManager.createLayer( |
|
167 |
tableInfo.getDocumentName(), |
|
168 |
new BaseCreateLayerParameters(params, defaultVisibility) |
|
169 |
); |
|
170 |
if( defaultVisibility ) { |
|
171 |
checkForVisibilityScale(layer, checkScale); |
|
172 |
} |
|
173 |
|
|
174 |
mapContext.getLayers().add(layer); |
|
175 |
} catch (Exception e) { |
|
176 |
LOGGER.warn("Can't create layer '" + tableInfo.getDocumentName() + "'.", e); |
|
177 |
} finally { |
|
178 |
// DisposeUtils.disposeQuietly(store); |
|
179 |
} |
|
180 |
taskstatus.incrementCurrentValue(); |
|
181 |
} |
|
182 |
taskstatus.terminate(); |
|
183 |
} finally { |
|
184 |
// Dispose all created layers. If they have been included into |
|
185 |
// a FLayers object, they will have been binded there. |
|
186 |
// for (FLayer layer : layers) { |
|
187 |
// layer.dispose(); |
|
188 |
// } |
|
189 |
} |
|
190 |
}, "WizardOnlineVectorial"); |
|
191 |
th.start(); |
|
192 |
return null; |
|
193 |
} |
|
194 |
|
|
195 |
private void fireLayerErrorEvent(FLayer lyr, MapControl mapControl) { |
|
196 |
mapControl.getMapContext().callNewErrorEvent(null); |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
protected Function<OnlineEntity, String> getLabelEntityFormatter() { |
|
201 |
return (OnlineEntity entity) -> { |
|
202 |
String label = this.getWorkspace().formatEntityLabel(entity); |
|
203 |
FeatureType type = entity.getFeatureType(); |
|
204 |
if (type == null) { |
|
205 |
return label; |
|
206 |
} |
|
207 |
IProjection srs = type.getDefaultSRS(); |
|
208 |
if (srs == null) { |
|
209 |
return label; |
|
210 |
} |
|
211 |
MapContext mapContext1 = getMapContext(); |
|
212 |
if (mapContext1 == null) { |
|
213 |
return label + " [" + srs.getAbrev() + "]"; |
|
214 |
} |
|
215 |
if (mapContext1.getProjection() == null) { |
|
216 |
return label + " [" + srs.getAbrev() + "]"; |
|
217 |
} |
|
218 |
if (StringUtils.equalsIgnoreCase(mapContext1.getProjection().getAbrev(), srs.getAbrev())) { |
|
219 |
return label + " [" + srs.getAbrev() + "]"; |
|
220 |
} |
|
221 |
return label + " [" + srs.getAbrev() + "!]"; |
|
222 |
}; |
|
223 |
} |
|
224 |
|
|
225 |
private int getLayerOrderWeight(OnlineEntity entity) { |
|
226 |
|
|
227 |
int type2d = Geometry.TYPES.SURFACE; |
|
228 |
try { |
|
229 |
GeometryType geomtype = entity.getFeatureType().getDefaultGeometryAttribute().getGeomType(); |
|
230 |
type2d = simplifyType(geomtype); |
|
231 |
} catch (Exception e) { |
|
232 |
LOGGER.warn("While getting geo type.", e); |
|
233 |
} |
|
234 |
switch (type2d) { |
|
235 |
case Geometry.TYPES.SURFACE: |
|
236 |
return 2; |
|
237 |
case Geometry.TYPES.CURVE: |
|
238 |
return 1; |
|
239 |
case Geometry.TYPES.POINT: |
|
240 |
return 0; |
|
241 |
default: |
|
242 |
// should not reach this |
|
243 |
return 3; |
|
244 |
} |
|
245 |
|
|
246 |
} |
|
247 |
|
|
248 |
private int simplifyType(GeometryType gt) { |
|
249 |
if (gt.isTypeOf(Geometry.TYPES.POINT) || gt.isTypeOf(Geometry.TYPES.MULTIPOINT)) { |
|
250 |
return Geometry.TYPES.POINT; |
|
251 |
|
|
252 |
} else if (gt.isTypeOf(Geometry.TYPES.CURVE) || gt.isTypeOf(Geometry.TYPES.MULTICURVE)) { |
|
253 |
return Geometry.TYPES.CURVE; |
|
254 |
|
|
255 |
} else if (gt.isTypeOf(Geometry.TYPES.SURFACE) || gt.isTypeOf(Geometry.TYPES.MULTISURFACE)) { |
|
256 |
return Geometry.TYPES.SURFACE; |
|
257 |
|
|
258 |
} |
|
259 |
return Geometry.TYPES.SURFACE; |
|
260 |
} |
|
261 |
} |
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.app/org.gvsig.online.app.mainplugin/src/main/java/org/gvsig/online/app/mainplugin/addlayer/WizardOnlineTabular.java | ||
---|---|---|
1 |
package org.gvsig.online.app.mainplugin.addlayer; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
import javax.swing.JOptionPane; |
|
6 |
import org.gvsig.app.ApplicationLocator; |
|
7 |
import org.gvsig.app.ApplicationManager; |
|
8 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
9 |
import org.gvsig.app.project.documents.table.TableManager; |
|
10 |
import org.gvsig.fmap.dal.DALLocator; |
|
11 |
import org.gvsig.fmap.dal.DataManager; |
|
12 |
import org.gvsig.fmap.dal.StoresRepository; |
|
13 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
14 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
|
15 |
import org.gvsig.geodb.TableInfo; |
|
16 |
import org.gvsig.online.lib.api.workingcopy.OnlineEntity; |
|
17 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
|
18 |
import org.gvsig.tools.ToolsLocator; |
|
19 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
20 |
import org.gvsig.tools.i18n.I18nManager; |
|
21 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
22 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author jjdelcerro |
|
27 |
*/ |
|
28 |
public class WizardOnlineTabular extends AbstractWizardOnline { |
Also available in: Unified diff