Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
PStellmann committed Apr 17, 2018
1 parent 92a2419 commit e6002e4
Show file tree
Hide file tree
Showing 282 changed files with 12,842 additions and 3,313 deletions.
1,226 changes: 14 additions & 1,212 deletions dita-semia.resolver.test.xpr

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions integrator.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<dummy>
<import file="preprocess.resolver.xml"/>
<import file="xhtml.xml"/>
</dummy>
11 changes: 11 additions & 0 deletions java/base/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,16 @@
<classpathentry kind="var" path="OXYGENXML/lib/saxon9ee.jar"/>
<classpathentry kind="var" path="OXYGENXML/lib/xercesImpl.jar"/>
<classpathentry kind="var" path="OXYGENXML/lib/commons-io-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/apache-poi/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/apache-poi/poi-3.10-FINAL-20140208.jar">
<attributes>
<attribute name="javadoc_location" value="file:/C:/Users/NissenJ/Downloads/poi-3.10-FINAL/docs/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/apache-poi/poi-ooxml-3.10-FINAL-20140208.jar"/>
<classpathentry kind="lib" path="lib/apache-poi/poi-ooxml-schemas-3.10-FINAL-20140208.jar"/>
<classpathentry kind="lib" path="lib/apache-poi/xmlbeans-2.3.0.jar"/>
<classpathentry kind="lib" path="lib/commons-csv-1.4.jar"/>
<classpathentry kind="var" path="OXYGENXML/lib/fop.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions java/base/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
<property name="src.dir" value="src"/>

<path id="classpath">
<fileset dir="lib/apache-poi" includes="**/*.jar"/>
<fileset dir="lib" includes="log4j.jar"/>
<fileset dir="lib" includes="saxonHE-9.6.0.7.jar"/>
<fileset dir="lib" includes="commons-csv-1.4.jar"/>
<fileset dir="${OXYGENXML}/lib" includes="**/*.jar"/>
</path>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
Expand Down Expand Up @@ -58,9 +57,11 @@
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

import org.DitaSemia.Base.FilterProperties;
import org.apache.log4j.Logger;


Expand All @@ -74,6 +75,7 @@ public class AdvancedKeyrefDialog extends JDialog {
JOptionPane optionPane;
private KeyDefInterface contextKeyDef;
private KeyDefInterface selectedKeyDef = null;
private FilterProperties filterProperties;
private String outputclass;
private JComboBox<String> outputclassComboBox;
private boolean accepted = false;
Expand All @@ -88,13 +90,15 @@ public class AdvancedKeyrefDialog extends JDialog {
protected JTextField descField = null;
protected JTextField urlField = null;
protected JTextField defIdField = null;
protected JTextField propertiesField = null;

protected KeyRefInterface currentKeyRef;
private int fixedPathLen;

protected JLabel contextKeyField = null;
protected JLabel contextTypeField = null;
protected JLabel contextNamespaceField = null;
protected JLabel contextPropertiesField = null;
protected JTextField searchField = null;

private JButton expand;
Expand Down Expand Up @@ -125,6 +129,8 @@ public class AdvancedKeyrefDialog extends JDialog {
public AdvancedKeyrefDialog(Frame parentFrame, KeyDefListInterface keyDefList, KeyRefInterface currentKeyRef, KeyDefInterface contextKeyDef, KeyPrioritizer keyPrioritizer) {
super(parentFrame, true);

this.filterProperties = FilterProperties.getFromNodeWithAncestors(currentKeyRef.getNode());

this.setTitle("Edit KeyRef-Element");

this.parentFrame = parentFrame;
Expand Down Expand Up @@ -236,6 +242,7 @@ public void valueChanged(ListSelectionEvent evt) {
this.add(optionPane);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
previewTextField.setBackground(Color.WHITE);

}

private void registerKeyBindings() {
Expand Down Expand Up @@ -301,6 +308,22 @@ public void actionPerformed(ActionEvent e) {
}
};

Action outputclassAction = new AbstractAction() {

@Override
public void actionPerformed(ActionEvent e) {
int index = outputclassComboBox.getSelectedIndex();
int count = outputclassComboBox.getItemCount();

if (index == count - 1) {
index = 0;
} else if (index < count) {
index ++;
}
outputclassComboBox.setSelectedIndex(index);
}
};

Action scrollUp = keyTable.getActionMap().get("scrollUpChangeSelection");
Action scrollDown = keyTable.getActionMap().get("scrollDownChangeSelection");

Expand All @@ -320,6 +343,9 @@ public void actionPerformed(ActionEvent e) {
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "reduce");
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), "reduce");
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), "home");
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, 0), "outputclass");
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK), "outputclass");
keyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK), "outputclass");

keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK), "enter");
Expand All @@ -338,6 +364,9 @@ public void actionPerformed(ActionEvent e) {
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), "reduce");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "scrollDown");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "scrollUp");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, 0), "outputclass");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK), "outputclass");
keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK), "outputclass");

//logger.info("ohne alles: " + keyTable.getInputMap().get(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)));
//logger.info("in focused window: " + keyTable.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)));
Expand All @@ -353,6 +382,7 @@ public void actionPerformed(ActionEvent e) {
keyTable.getActionMap().put("home", home);
keyTable.getActionMap().put("scrollUp", scrollUp);
keyTable.getActionMap().put("scrollDown", scrollDown);
keyTable.getActionMap().put("outputclass", outputclassAction);
}

public boolean getResult() {
Expand Down Expand Up @@ -402,6 +432,7 @@ private void createPreviewPanel(JPanel previewPanel) {
previewPanel.setPreferredSize(new Dimension(200, 50));

previewTextField = new JEditorPane("text/html", "");
previewTextField.setBorder(BorderFactory.createEmptyBorder());
previewTextField.setEditable(false);
previewTextField.setOpaque(false);
previewTextField.setBackground(Color.BLUE);
Expand All @@ -416,6 +447,7 @@ private void createPreviewPanel(JPanel previewPanel) {
values.add("Key (Name)");
values.add("Key - Name");
values.add("Name");
values.add("Key: \"Name\"");
enabled = true;
}

Expand All @@ -429,12 +461,14 @@ private void createPreviewPanel(JPanel previewPanel) {
case KeyRef.OC_KEY_NAME_BRACED:
outputclassComboBox.setSelectedIndex(1);
break;
case KeyRef.OC_KEY_NAME_DASHED:
case KeyRef.OC_KEY_DASH_NAME:
outputclassComboBox.setSelectedIndex(2);
break;
case KeyRef.OC_NAME:
outputclassComboBox.setSelectedIndex(3);
break;
case KeyRef.OC_KEY_COLON_NAME:
outputclassComboBox.setSelectedIndex(4);
default:
outputclassComboBox.setSelectedIndex(0);
break;
Expand Down Expand Up @@ -537,9 +571,10 @@ private void createContextPanel(JPanel panel) {
labelConstr.fill = GridBagConstraints.BOTH;
labelConstr.anchor = GridBagConstraints.NORTHWEST;

contextKeyField = addLabelPair("Key", labelConstr, contextPanel);
contextTypeField = addLabelPair("Typ", labelConstr, contextPanel);
contextNamespaceField = addLabelPair("Namespace", labelConstr, contextPanel);
contextKeyField = addLabelPair("Key", labelConstr, contextPanel);
contextTypeField = addLabelPair("Typ", labelConstr, contextPanel);
contextNamespaceField = addLabelPair("Namespace", labelConstr, contextPanel);
contextPropertiesField = addLabelPair("Filter Properties", labelConstr, contextPanel);

if (contextKeyDef != null) {
contextKeyField.setText(contextKeyDef.getKey());
Expand All @@ -550,8 +585,9 @@ private void createContextPanel(JPanel panel) {
contextTypeField.setText("-");
contextNamespaceField.setText("-");
}

contextPropertiesField.setText(filterProperties.toString());


panel.add(contextPanel, contextConstraints);
panel.add(searchPanel, searchConstraints);
}
Expand Down Expand Up @@ -605,8 +641,20 @@ public void actionPerformed(ActionEvent e) {
private void createTablePanel(JPanel tablePanel) {

tablePanel.setLayout(new GridBagLayout());

keyTable = new JTable(keyDefTableModel);

keyTable = new JTable(keyDefTableModel) {
@Override
public java.awt.Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
java.awt.Component comp = super.prepareRenderer(renderer, row, col);
KeyDefInterface keyDef = keyDefTableModel.get(keyTable.convertRowIndexToModel(row)).getKeyDef();
if (FilterProperties.isValidReference(filterProperties, keyDef.getFilterProperties())) {
comp.setEnabled(true);
} else {
comp.setEnabled(false);
}
return comp;
}
};
JScrollPane scrollPane = new JScrollPane(keyTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

enableSorting(keyTable);
Expand Down Expand Up @@ -674,6 +722,7 @@ public void sorterChanged (RowSorterEvent e) {

@SuppressWarnings("unchecked")
private void createFilter(int column, String filterText) {
//logger.info("createFilter: " + column + ", " + filterText + ", " + filters.size());
try {
if (column == 0 && filterText == null) {
// reset ComboBoxFilter
Expand All @@ -688,7 +737,6 @@ private void createFilter(int column, String filterText) {
if (filterText != null) {
if (column > 0) {
// ComboBoxFilter
filters = new ArrayList<RowFilter<KeyDefTableModel, Object>>();
comboBoxFilters[column-1] = null;
if (!filterText.startsWith("<")) {
comboBoxFilters[column-1] = RowFilter.regexFilter("(?i)" + filterText, column);
Expand All @@ -705,6 +753,7 @@ private void createFilter(int column, String filterText) {
filters.add(searchFieldFilter);
}
}
//logger.info("filters.size: " + filters.size());
RowFilter<KeyDefTableModel, Object> rowf = RowFilter.andFilter(filters);
sorter.setRowFilter(rowf);
keyTable.scrollRectToVisible(new Rectangle(keyTable.getCellRect(keyTable.getSelectedRow(), 0, true)));
Expand Down Expand Up @@ -756,6 +805,7 @@ private void updateDetails() {
descField.setText(keyDef.getDesc());
urlField.setText(keyDef.getDefUrl());
defIdField.setText(keyDef.getDefId());
propertiesField.setText(keyDef.getFilterProperties());

namespaceList = keyDef.getNamespaceList();
currentNamespaceList = createCurrentNamespaceList();
Expand All @@ -767,6 +817,9 @@ private void updateDetails() {
typeField.setText("");
namespaceField.setText("");
descField.setText("");
urlField.setText("");
defIdField.setText("");
propertiesField.setText("");

previewTextField.setText("");
}
Expand Down Expand Up @@ -830,6 +883,7 @@ private void setPreviewLength() {
}

private void updatePreview() {
KeyTypeDef keyTypeDef = keyDefList.getKeyTypeDef(selectedKeyDef.getType());
StringBuilder sb = new StringBuilder();
if (previewLength == namespaceList.size() + 1) {
expand.setEnabled(false);
Expand All @@ -839,7 +893,7 @@ private void updatePreview() {
reduce.setEnabled(true);
for (String s : currentNamespaceList) {
sb.append(s);
sb.append(KeyspecInterface.PATH_DELIMITER);
sb.append(keyTypeDef.getPathDelimiter());
}
sb.append(currentKey);
currentPreview = sb.toString();
Expand All @@ -864,7 +918,7 @@ private void updatePreview() {
}
break;
case 2:
outputclass = KeyRef.OC_KEY_NAME_DASHED;
outputclass = KeyRef.OC_KEY_DASH_NAME;
if (name != null && !name.isEmpty()) {
nameSuffix = " - " + name;
}
Expand All @@ -874,17 +928,21 @@ private void updatePreview() {
if (name != null && !name.isEmpty()) {
nameSuffix = name;
}
case 4:
outputclass = KeyRef.OC_KEY_COLON_NAME;
if (name != null && !name.isEmpty()) {
nameSuffix = ": " + name;
}
break;
}
String previewString = stylePreview(currentPreview, nameSuffix);
String previewString = stylePreview(currentPreview, nameSuffix, keyTypeDef);
previewTextField.setText(previewString);
}

private String stylePreview(String preview, String nameSuffix) {
private String stylePreview(String preview, String nameSuffix, KeyTypeDef keyTypeDef) {
String text = "";
String style = " style=\"font-family:serif\"";
if (!outputclass.equals(KeyRef.OC_NAME)) {
KeyTypeDef keyTypeDef = keyDefList.getKeyTypeDef(selectedKeyDef.getType());
String fontFamily = "serif";
String prefix = keyTypeDef.prefix;
String suffix = keyTypeDef.suffix;
Expand Down Expand Up @@ -1012,13 +1070,14 @@ private void createSelectionPanel(JPanel selectionPanel) {
localConstr.fill = GridBagConstraints.BOTH;
localConstr.anchor = GridBagConstraints.NORTHWEST;

keyField = addLabelFieldPair("Key", localConstr, selectionPanel);
nameField = addLabelFieldPair("Name", localConstr, selectionPanel);
typeField = addLabelFieldPair("Typ", localConstr, selectionPanel);
namespaceField = addLabelFieldPair("Namespace", localConstr, selectionPanel);
descField = addLabelFieldPair("Beschreibung", localConstr, selectionPanel);
urlField = addLabelFieldPair("URL", localConstr, selectionPanel);
defIdField = addLabelFieldPair("ID", localConstr, selectionPanel);
keyField = addLabelFieldPair("Key", localConstr, selectionPanel);
nameField = addLabelFieldPair("Name", localConstr, selectionPanel);
typeField = addLabelFieldPair("Typ", localConstr, selectionPanel);
namespaceField = addLabelFieldPair("Namespace", localConstr, selectionPanel);
descField = addLabelFieldPair("Beschreibung", localConstr, selectionPanel);
urlField = addLabelFieldPair("URL", localConstr, selectionPanel);
defIdField = addLabelFieldPair("ID", localConstr, selectionPanel);
propertiesField = addLabelFieldPair("Filter Properties", localConstr, selectionPanel);
}

private JLabel addLabelPair(String labelText, GridBagConstraints constr, JPanel mainPanel) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package org.DitaSemia.Base.AdvancedKeyref.ExtensionFunctions;

import java.util.LinkedList;
import java.util.List;

import org.DitaSemia.Base.AdvancedKeyref.KeyDefInterface;
import org.DitaSemia.Base.AdvancedKeyref.KeyDefListInterface;
import org.apache.log4j.Logger;

import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.lib.ExtensionFunctionCall;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.Sequence;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.value.EmptySequence;
import net.sf.saxon.value.SequenceExtent;
import net.sf.saxon.value.StringValue;

public class AncestorPathCall extends ExtensionFunctionCall {

Expand All @@ -33,7 +26,7 @@ public Sequence call(XPathContext context, Sequence[] arguments) throws XPathExc
try {

final KeyDefInterface keyDef = Common.GetAncestorKeyDef(context, arguments, keyDefList);
return getPath(keyDef);
return GetPathCall.getPath(keyDef);

} catch (XPathException e) {
throw e;
Expand All @@ -43,22 +36,4 @@ public Sequence call(XPathContext context, Sequence[] arguments) throws XPathExc
}
}

public static Sequence getPath(KeyDefInterface keyDef) {
if (keyDef != null) {
List<String> path = keyDef.getNamespaceList();
List<Item> list = new LinkedList<>();
if (path != null) {
for (String element : path) {
list.add(new StringValue(element));
}
}
list.add(new StringValue(keyDef.getKey()));
//logger.info("result: " + keyDef.getNamespace() + " " + keyDef.getKey());
return new SequenceExtent(list);
} else {
//logger.info("result: ()");
return EmptySequence.getInstance();
}
}

}
Loading

0 comments on commit e6002e4

Please sign in to comment.