The name of the configuration of the document being edited, if any, if
found in property CONFIGURATION_NAME_PROPERTY of the document.
Excerpts from src/com/xmlmind/xmledit/cmd/character/InsertCharByName.java:
---
import static com.xmlmind.xml.doc.Constants.CONFIGURATION_NAME_PROPERTY;
...
public boolean prepare(DocumentView docView,
String parameter, int x, int y) {
...
if (charEnts == null) {
String configName = (String)
docView.getDocument().getProperty(
CONFIGURATION_NAME_PROPERTY);
if (configName != null) {
charEnts = loadFromProperty(
configName + ".characterEntities");
}
}
...
}
---
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Constants.html#CONFIGURATION_NAME_PROPERTY
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Node.html#getProperty(com.xmlmind.xml.name.Name)
On 01/15/2011 01:11 AM, Jeff Hooker wrote:
>
> I'm working (with a Java developer) on a feature that allows users to define
> publishing parameters on the fly, right before running the Convert command.
>
> Basically, it searches the current document for a specific set of attributes
> (arch, audience, and document, in this case) and presents the user with a
> multipick interface so that they can determine the profiling parameters they
> want to use to publish. My only roadblock is determining which
> publishParameters
> set to write the parameters to. Since the publishParameters set is prefaced
> with
> the name of the configuration, I need access to that information.
>
> I think when I get the correct 'app' instance, the above configuration issue
> will be solved.
>
> I want to get Configuration whenever new document is opened. From this
> Configuration, I get the name, which is used to get corresponding
> attributeGroup.
>
> To do that, I need the 'app' instance. The code is like this:
>
> OpenedDocument openedDoc = app.getActiveOpenedDocument();
> Configuration config = openedDoc.getConfiguration();
> String configName = config.getName();
>
> My question is how to get the reference of 'app'(App class) instance from the
> command class. I understand Action classes can have access to 'app'.
>
> However, in this case, the command class should be used, not Action, because
> the
> menu is created all with commands in xsl, which have parameter values
>
> to send to each command classes.
>
> So, to get the 'app' variable, I created Action class which implements
> Command
> interface. At this time, the prepareCommand/executeCommand methods of the
> Command are not invoked. (Only the init() and exec() method of the Action
> were
> invoked.) These Command methods should be invoked to get the parameter value
> in
> the class.
>
> As second way, I made the class implements AppTool,in which 'app' variable
> exists. But this is not working either, because it has 'app' value as 'null'.
This should not happen. You probably made a mistake either in the
implementation of this AppTool or in the registration of this AppTool
with XXE.
>
> The current class/method looks like this:
>
> public class ExecWithConversionParameters extends RecordableCommand
> protected Object doExecute(DocumentView docView, String parameter, int x,
> int
> y)
>
>
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support