Revision 45379 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/searchpanel/DefaultSearchPanel.java
DefaultSearchPanel.java | ||
---|---|---|
93 | 93 |
import org.gvsig.tools.bookmarksandhistory.History; |
94 | 94 |
import org.gvsig.tools.dispose.Disposable; |
95 | 95 |
import org.gvsig.tools.dispose.DisposeUtils; |
96 |
import org.gvsig.tools.swing.api.SupportIsEnable; |
|
97 |
import org.gvsig.tools.swing.api.SupportIsVisible; |
|
96 | 98 |
import org.gvsig.tools.swing.api.bookmarkshistory.ActionEventWithCurrentValue; |
97 | 99 |
import static org.gvsig.tools.swing.api.bookmarkshistory.ActionEventWithCurrentValue.ID_GETVALUE; |
98 | 100 |
import static org.gvsig.tools.swing.api.bookmarkshistory.ActionEventWithCurrentValue.ID_SETVALUE; |
... | ... | |
107 | 109 |
@SuppressWarnings({"UseSpecificCatch"}) |
108 | 110 |
public class DefaultSearchPanel |
109 | 111 |
extends DefaultSearchPanelView |
110 |
implements FeatureStoreSearchPanel { |
|
112 |
implements FeatureStoreSearchPanel, SupportIsEnable, SupportIsVisible {
|
|
111 | 113 |
|
112 | 114 |
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSearchPanel.class); |
113 | 115 |
|
... | ... | |
362 | 364 |
private static final String BOOKMARKSANDHISTORY_NAME = "SearchPanel"; |
363 | 365 |
private final Bookmarks<Object> bookmarks; |
364 | 366 |
private final History<Object> history; |
367 |
private boolean filterOnlyMode; |
|
365 | 368 |
|
366 | 369 |
public DefaultSearchPanel(FeatureStore store) { |
367 | 370 |
this.store = store; |
371 |
this.filterOnlyMode = false; |
|
368 | 372 |
DisposeUtils.bind(store); |
369 | 373 |
this.acctionListeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
370 | 374 |
this.actions = new HashMap<>(); |
... | ... | |
1225 | 1229 |
cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new GroupByAction()); |
1226 | 1230 |
cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new OrderByAction()); |
1227 | 1231 |
} |
1232 |
|
|
1233 |
@Override |
|
1234 |
public boolean isVisible(Object component) { |
|
1235 |
if( this.filterOnlyMode ) { |
|
1236 |
if( component instanceof GroupByAction ) { |
|
1237 |
return false; |
|
1238 |
} |
|
1239 |
if( component instanceof OrderByAction ) { |
|
1240 |
return false; |
|
1241 |
} |
|
1242 |
if( component instanceof CalculatedColumnsAction ) { |
|
1243 |
return false; |
|
1244 |
} |
|
1245 |
} |
|
1246 |
return true; |
|
1247 |
} |
|
1248 |
|
|
1249 |
@Override |
|
1250 |
public boolean isEnabled(Object component) { |
|
1251 |
if( component instanceof GroupByAction ) { |
|
1252 |
DataStoreProviderFactory dataFactory = this.store.getProviderFactory(); |
|
1253 |
int allowGroupBy = ((FeatureStoreProviderFactory) dataFactory).allowGroupBy(); |
|
1254 |
if (allowGroupBy != DataType.YES) { |
|
1255 |
return false; |
|
1256 |
} |
|
1257 |
} |
|
1258 |
return true; |
|
1259 |
} |
|
1260 |
|
|
1261 |
@Override |
|
1262 |
public void setFilterOnlyMode(boolean filterOnlyMode) { |
|
1263 |
if( this.conditionPanels!=null ) { |
|
1264 |
throw new IllegalStateException("Cannot change filter-only-mode after invoking asJComponent."); |
|
1265 |
} |
|
1266 |
this.filterOnlyMode = filterOnlyMode; |
|
1267 |
this.showActions = false; |
|
1268 |
} |
|
1269 |
|
|
1270 |
@Override |
|
1271 |
public boolean isFilterOnlyMode() { |
|
1272 |
return this.filterOnlyMode; |
|
1273 |
} |
|
1274 |
|
|
1275 |
|
|
1228 | 1276 |
} |
Also available in: Unified diff