svn-gvsig-desktop / 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 / actions / ShowFormForOpenStoreParametersAction.java @ 45154
History | View | Annotate | Download (2.49 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.fmap.dal.swing.impl.actions; |
7 |
|
8 |
import java.awt.event.ActionEvent; |
9 |
import javax.swing.AbstractAction; |
10 |
import javax.swing.Action; |
11 |
import org.gvsig.featureform.swing.JFeaturesForm.FeaturesFormContext; |
12 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_REPOSITORY_PARAMETERS; |
13 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_REPOSITORY_NAME; |
14 |
import org.gvsig.tools.dynform.JDynFormField; |
15 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
16 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
17 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager.PopupMenuActionFactory; |
18 |
import org.slf4j.Logger; |
19 |
import org.slf4j.LoggerFactory; |
20 |
|
21 |
/**
|
22 |
*
|
23 |
* @author jjdelcerro
|
24 |
*/
|
25 |
public class ShowFormForOpenStoreParametersAction |
26 |
extends AbstractAction { |
27 |
|
28 |
private static final Logger LOGGER = LoggerFactory.getLogger(ShowFormForOpenStoreParametersAction.class); |
29 |
|
30 |
public static final class ShowFormForOpenStoreParametersActionFactory |
31 |
implements PopupMenuActionFactory {
|
32 |
|
33 |
@Override
|
34 |
public String getName() { |
35 |
return "ShowFormForOpenStoreParametersAction"; |
36 |
} |
37 |
|
38 |
@Override
|
39 |
public boolean isApplicable(JDynFormField jfield) { |
40 |
if (!(jfield.getForm().getContext() instanceof FeaturesFormContext)) { |
41 |
return false; |
42 |
} |
43 |
FeaturesFormContext context = (FeaturesFormContext) jfield.getForm().getContext(); |
44 |
if (!context.getFeatureStore().getName().equalsIgnoreCase(TABLE_REPOSITORY_NAME)) {
|
45 |
return false; |
46 |
} |
47 |
return jfield.getDefinition().getName().equals(FIELD_REPOSITORY_PARAMETERS);
|
48 |
} |
49 |
|
50 |
@Override
|
51 |
public Action create(JDynFormField jfield) { |
52 |
return new ShowFormForOpenStoreParametersAction(jfield); |
53 |
} |
54 |
|
55 |
} |
56 |
|
57 |
private final JDynFormField jfield; |
58 |
|
59 |
public ShowFormForOpenStoreParametersAction(JDynFormField jfield) {
|
60 |
super("Show parameters"); |
61 |
this.jfield = jfield;
|
62 |
} |
63 |
|
64 |
@Override
|
65 |
public void actionPerformed(ActionEvent e) { |
66 |
Object value = this.jfield.getValue(); |
67 |
} |
68 |
|
69 |
public static final void selfRegister() { |
70 |
DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager(); |
71 |
manager.addPopupMenuAction(new ShowFormForOpenStoreParametersActionFactory());
|
72 |
} |
73 |
} |