Index: DefaultSearchPanel.java
===================================================================
--- DefaultSearchPanel.java	(revision 44643)
+++ DefaultSearchPanel.java	(revision 44644)
@@ -46,12 +46,14 @@
 import org.gvsig.fmap.dal.exception.DataException;
 import org.gvsig.fmap.dal.feature.Feature;
 import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
 import org.gvsig.fmap.dal.feature.FeatureStore;
 import org.gvsig.fmap.dal.feature.FeatureType;
 import org.gvsig.fmap.dal.swing.AbstractDALActionFactory.AbstractDALActionContext;
 import org.gvsig.fmap.dal.swing.DALActionFactory;
 import org.gvsig.fmap.dal.swing.DALSwingLocator;
 import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel;
+import org.gvsig.fmap.dal.swing.orderpanel.FeatureStoreOrderPanel;
 import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel;
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.dynobject.Tags;
@@ -59,6 +61,9 @@
 import org.gvsig.tools.swing.api.ActionListenerSupport;
 import org.gvsig.tools.swing.api.ToolsSwingLocator;
 import org.gvsig.tools.swing.api.ToolsSwingManager;
+import org.gvsig.tools.swing.api.windowmanager.Dialog;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
 import org.gvsig.tools.swing.icontheme.IconTheme;
 import org.gvsig.tools.util.ToolsUtilLocator;
 import org.slf4j.Logger;
@@ -74,12 +79,12 @@
         implements FeatureStoreSearchPanel {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSearchPanel.class);
-    private Expression currentSearch;
     
     static /* friend */ Integer useLabels = null;
     
     public static class UseLabelsYesAction extends AbstractAction {
 
+        @SuppressWarnings("OverridableMethodCallInConstructor")
         public UseLabelsYesAction() {
             I18nManager i18n = ToolsLocator.getI18nManager();
 
@@ -105,6 +110,7 @@
     
     public static class UseLabelsNoAction extends AbstractAction {
 
+        @SuppressWarnings("OverridableMethodCallInConstructor")
         public UseLabelsNoAction() {
             I18nManager i18n = ToolsLocator.getI18nManager();
             this.putValue(NAME, i18n.getTranslation("_Use_names"));
@@ -129,6 +135,7 @@
     
     public static class UseLabelsBothAction extends AbstractAction {
 
+        @SuppressWarnings("OverridableMethodCallInConstructor")
         public UseLabelsBothAction() {
             I18nManager i18n = ToolsLocator.getI18nManager();
 
@@ -153,6 +160,34 @@
     }
     
     
+    public static class SelectOrderAction extends AbstractAction {
+
+        @SuppressWarnings("OverridableMethodCallInConstructor")
+        public SelectOrderAction() {
+            I18nManager i18n = ToolsLocator.getI18nManager();
+
+            this.putValue(NAME, i18n.getTranslation("_Select_order"));
+            this.putValue(ACTION_COMMAND_KEY, "SelectOrder");
+        }
+
+        @Override
+        public Object getValue(String key) {
+            if( NAME.equals(key) ) {
+                // Cuando se registra la accion aun no se han cargado las traducciones
+                I18nManager i18n = ToolsLocator.getI18nManager();
+                return i18n.getTranslation("_Select_order");
+            }
+            return super.getValue(key);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent ae) {
+            DefaultSearchPanel panel = (DefaultSearchPanel) ae.getSource();
+            panel.doSelectOrder();
+        }
+    }
+    
+    
     private class ActionButtons {
         
         private final DALActionFactory factory;
@@ -186,6 +221,11 @@
         }
 
         @Override
+        public FeatureQueryOrder getOrder() {
+            return this.panel.getOrder();
+        }
+
+        @Override
         public JComponent getActionButton(String actionName) {
             return this.panel.getActionButton(actionName);
         }
@@ -209,6 +249,8 @@
     private boolean showActions = true;
     private int maxSearhFields = 4;
     private final I18nManager i18n = ToolsLocator.getI18nManager();
+    private Expression currentSearch;
+    private FeatureQueryOrder order;
 
     public DefaultSearchPanel(FeatureStore store) {
         this.store = store;
@@ -386,7 +428,7 @@
         addActions();
         this.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
 
-        doSearch(null);
+        doSearch(null,null);
     }
 
     @Override
@@ -422,6 +464,11 @@
     }
 
     @Override
+    public FeatureQueryOrder getOrder() {
+        return this.order;
+    }
+
+    @Override
     public Expression getFilter() {
         Expression filter;
         int searchMode = this.tabSearchMode.getSelectedIndex();
@@ -461,10 +508,15 @@
     
     private void doSearch() {
         Expression filter = this.getFilter();
-        doSearch(filter);
+        FeatureQueryOrder theOrder = this.getOrder();
+        if( theOrder!=null ) {
+            doSearch(filter,theOrder.toString());
+        } else {
+            doSearch(filter,null);
+        }
     }
 
-    private void doSearch(final Expression exp) {
+    private void doSearch(final Expression exp, String order) {
         final MutableObject model = new MutableObject(null);
         
         lblMsg.setText("Searching...");
@@ -474,11 +526,7 @@
             public void run() {
                 try {
                     final List<Feature> features;
-                    if (exp == null) {
-                        features = store.getFeatures();
-                    } else {
-                        features = store.getFeatures(exp);
-                    }
+                    features = store.getFeatures(exp,order);
                     currentSearch = exp;
                     model.setValue( new SimpleFeaturesTableModel(
                             store.getDefaultFeatureType(),
@@ -590,6 +638,30 @@
     public FeatureStore getStore() {
         return store;
     }
+
+    private void doSelectOrder() {
+        WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
+        FeatureStoreOrderPanel orderPanel = DALSwingLocator.getDataSwingManager().createFeatureStoreOrderPanel();
+        orderPanel.setStore(store);
+        orderPanel.setOrder(order);
+        Dialog dialog = windowManager.createDialog(
+                orderPanel.asJComponent(),
+                i18n.getTranslation("_Select_order"),
+                null, 
+                WindowManager_v2.BUTTONS_OK_CANCEL
+        );
+        dialog.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if( dialog.getAction()==WindowManager_v2.BUTTON_OK ) {
+                    order = orderPanel.getOrder();
+                    doSearch();
+                }
+            }
+        });
+        dialog.show(WindowManager.MODE.DIALOG);
+        
+    }
     
     @Override
     public ImageIcon loadImage(String imageName) {
@@ -625,7 +697,7 @@
         cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new UseLabelsYesAction());
         cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new UseLabelsNoAction());
         cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new UseLabelsBothAction());
-        
+        cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new SelectOrderAction());
     }
 
     @Override
