[oXygen-sdk] Styling inside the DITA Map Manager
Oxygen XML Editor Support
support at oxygenxml.com
Mon Jul 15 07:04:24 CDT 2013
Hello Nigel,
The tree used in the DITA Maps Manager is a standard Swing JTree and
does not take at all the CSS into account.
But if you implement a Workspace Access Plugin type (you probably
already have one) you could use our API to customize the cell renderer
set by us, for example something like:
> this.pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
> /**
> * @see ro.sync.exml.workspace.api.listeners.WSEditorChangeListener#editorOpened(java.net.URL)
> */
> @Override
> public void editorOpened(URL editorLocation) {
> WSEditor ed = pluginWorkspaceAccess.getEditorAccess(editorLocation, StandalonePluginWorkspace.DITA_MAPS_EDITING_AREA);
> WSDITAMapEditorPage ditaEDPage = (WSDITAMapEditorPage) ed.getCurrentPage();
> JTree tree = (JTree) ditaEDPage.getDITAMapTreeComponent();
> final TreeCellRenderer currentRenderer = tree.getCellRenderer();
> tree.setCellRenderer(new DefaultTreeCellRenderer() {
> /**
> * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
> */
> @Override
> public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel,
> boolean expanded, boolean leaf, int row, boolean hasFocus) {
> JPanel panel = (JPanel) currentRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
> panel.setBorder(null);
> if(value instanceof AuthorElement) {
> AuthorElement elem = (AuthorElement) value;
> if(elem.getAttribute("status") != null) {
> if("new".equals(elem.getAttribute("status").getValue())) {
> panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
> }
> }
> }
> return panel;
> }
> });
> }
> }, StandalonePluginWorkspace.DITA_MAPS_EDITING_AREA);
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On 7/15/2013 1:03 PM, Nigel Whitaker wrote:
> Hello,
>
> We are trying to show users the result of a DITA Map comparison (two
> input maps, in the result map we want to show users which topics are
> added/deleted/changed).
>
> We use @status on the topicrefs for example:
>
> <map>
> <title>DITA Topic Map</title>
> <topicrefhref="topic1.xml"status="changed"/>
> <topicrefhref="topic2.xml"status="new"/>
> </map>
>
> When the map is opened in an editor window some CSS can be used to style
> the topics:
>
> *[status=new] {
> text-decoration: underline;
> background-color: #90ee90; /* CSS - LightGreen */
> }
>
> *[status=changed] {
> background-color: #77ccff; /* CSS - LightCyan */
> }
>
>
> This works great in the editor - users looking at a result map can see
> the changed topics, click and see the topic level changes.
> However, when a user chooses to open the map in the DITA Map Manager,
> there isn't any styling.
>
> Is there an alternative way of styling that we could be using?
> If not, could we request an enhancement to support CSS in the Map Manager?
>
> Thanks,
>
> Nigel
>
>
> --
> Nigel Whitaker, Software Architect, DeltaXML Ltd. "Experts in
> information change"
> nigel.whitaker at deltaxml.com <mailto:nigel.whitaker at deltaxml.com>
> http://www.deltaxml.com +44 1684 869035
> Registered in England: 02528681 Reg. Office: Monsell House, WR8 0QN, UK
>
>
>
> _______________________________________________
> oXygen-sdk mailing list
> oXygen-sdk at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
>
More information about the oXygen-sdk
mailing list