Revision 46737 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/DefaultDataSwingManager.java
DefaultDataSwingManager.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.dal.swing.impl; |
24 | 24 |
|
25 |
import java.net.URL; |
|
25 | 26 |
import java.util.Collection; |
26 | 27 |
import java.util.Collections; |
27 | 28 |
import java.util.HashMap; |
... | ... | |
31 | 32 |
import java.util.function.Predicate; |
32 | 33 |
import javax.swing.AbstractButton; |
33 | 34 |
import javax.swing.Action; |
35 |
import javax.swing.Icon; |
|
36 |
import javax.swing.ImageIcon; |
|
34 | 37 |
import javax.swing.JButton; |
35 | 38 |
import javax.swing.JComboBox; |
36 | 39 |
import javax.swing.JList; |
37 | 40 |
import javax.swing.JTextField; |
41 |
import javax.swing.JTree; |
|
38 | 42 |
import javax.swing.text.JTextComponent; |
39 | 43 |
import javax.swing.tree.TreeModel; |
40 | 44 |
import org.apache.commons.lang3.StringUtils; |
... | ... | |
61 | 65 |
import static org.gvsig.fmap.dal.DataManager.USE_LABELS_BOTH; |
62 | 66 |
import static org.gvsig.fmap.dal.DataManager.USE_LABELS_NO; |
63 | 67 |
import static org.gvsig.fmap.dal.DataManager.USE_LABELS_YES; |
68 |
import org.gvsig.fmap.dal.DataStore; |
|
64 | 69 |
import org.gvsig.fmap.dal.DataStoreProviderFactory; |
65 | 70 |
import org.gvsig.fmap.dal.StoresRepository; |
66 | 71 |
import org.gvsig.fmap.dal.exception.DataException; |
... | ... | |
120 | 125 |
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController; |
121 | 126 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
122 | 127 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchParameters; |
123 |
import org.gvsig.fmap.dal.swing.impl.storerepository.StoresRepositoryTreeModel; |
|
128 |
import org.gvsig.fmap.dal.swing.impl.storesrepository.StoresRepositoryControllerImpl; |
|
129 |
import org.gvsig.fmap.dal.swing.impl.storesrepository.StoresRepositoryTreeModel; |
|
124 | 130 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
125 | 131 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionPanel; |
126 | 132 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcessFactory; |
127 | 133 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
128 | 134 |
import org.gvsig.fmap.dal.swing.searchpanel.SearchConditionPanel.SearchConditionPanelFactory; |
129 | 135 |
import org.gvsig.fmap.dal.swing.searchpanel.SearchParameters; |
136 |
import org.gvsig.fmap.dal.swing.storesrepository.StoresRepositoryController; |
|
137 |
import org.gvsig.fmap.geom.Geometry; |
|
130 | 138 |
import org.gvsig.tools.dynform.DynFormDefinition; |
131 | 139 |
import org.gvsig.tools.dynform.DynFormLocator; |
132 | 140 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
672 | 680 |
DefaultFeatureQueryPickerController controller = new DefaultFeatureQueryPickerController(text, button, history, bookmarks); |
673 | 681 |
return controller; |
674 | 682 |
} |
683 |
|
|
684 |
@Override |
|
685 |
public StoresRepositoryController createStoresRepositoryController(JTree tree) { |
|
686 |
StoresRepositoryControllerImpl src = new StoresRepositoryControllerImpl(tree); |
|
687 |
return src; |
|
688 |
} |
|
689 |
|
|
690 |
@Override |
|
691 |
public Icon getStoreGeometryIcon(FeatureStore store) { |
|
692 |
try { |
|
693 |
if( store == null ) { |
|
694 |
return null; |
|
695 |
} |
|
696 |
FeatureType ft = store.getDefaultFeatureTypeQuietly(); |
|
697 |
if( ft == null ) { |
|
698 |
return null; |
|
699 |
} |
|
700 |
FeatureAttributeDescriptor geomattr = ft.getDefaultGeometryAttribute(); |
|
701 |
if( geomattr == null ) { |
|
702 |
return null; |
|
703 |
} |
|
704 |
int geometryType = geomattr.getGeomType().getType(); |
|
705 |
String name; |
|
706 |
switch (geometryType) { |
|
707 |
case Geometry.TYPES.LINE: |
|
708 |
name = "store-geomtype-line"; |
|
709 |
break; |
|
710 |
case Geometry.TYPES.POINT: |
|
711 |
name = "store-geomtype-point"; |
|
712 |
break; |
|
713 |
case Geometry.TYPES.POLYGON: |
|
714 |
name = "store-geomtype-polygon"; |
|
715 |
break; |
|
716 |
case Geometry.TYPES.MULTILINE: |
|
717 |
name = "store-geomtype-multiline"; |
|
718 |
break; |
|
719 |
case Geometry.TYPES.MULTIPOINT: |
|
720 |
name = "store-geomtype-multipoint"; |
|
721 |
break; |
|
722 |
case Geometry.TYPES.MULTIPOLYGON: |
|
723 |
name = "store-geomtype-multipolygon"; |
|
724 |
break; |
|
725 |
case Geometry.TYPES.GEOMETRY: |
|
726 |
name = "store-geomtype-mix"; |
|
727 |
break; |
|
728 |
default: |
|
729 |
return null; |
|
730 |
} |
|
731 |
if (!store.isFeatureSelectionEmpty()) { |
|
732 |
name = name + "-sel"; |
|
733 |
} |
|
734 |
name = name + ".png"; |
|
735 |
URL url = this.getClass().getResource("/storegeomtypes/" + name); |
|
736 |
if (url == null) { |
|
737 |
return null; |
|
738 |
} |
|
739 |
Icon icon = new ImageIcon(url); |
|
740 |
return icon; |
|
741 |
} catch (Exception ex) { |
|
742 |
return null; |
|
743 |
} |
|
744 |
} |
|
745 |
|
|
675 | 746 |
} |
676 | 747 |
|
677 | 748 |
|
Also available in: Unified diff