-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dumped src, pom.xml and updated README
- Loading branch information
Patrick Daniel Brookshire
authored and
Patrick Daniel Brookshire
committed
Jun 18, 2021
1 parent
ae5464c
commit a9e6ecd
Showing
28 changed files
with
2,341 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# ImportMore | ||
Adds custom operations with a focus on more interaction with external XML docs to the Oxygen XML Editor | ||
# ImportMoreXtension | ||
Adds custom operations with a focus on more interaction with external XML docs to the Oxygen XML Editor | ||
|
||
This software package provides six Java operations developed at the Digital Academy of the Academy of Sciences and Literature | Mainz that may be used to create custom actions within the Oxygen XML Editor that simplify importing XML fragments from resources other than the one to be edited. A documentation of all operations can be found in the [wiki of this repository](https://github.com/digicademy/ImportMoreXtension/wiki). | ||
|
||
|
||
# Requirements | ||
The ImportMoreXtension was developed and tested to be used with the versions 19.1 to 23.1 of the [Oxygen XML Editor](https://www.oxygenxml.com/) and depends on the the Saxon version included (saxon9ee.jar). | ||
|
||
Since it extends functionality of the [AskMoreXtension](https://github.com/digicademy/AskMoreXtension) you will also need to add a released JAR with a version greater than or equal to 1.3.0. | ||
|
||
If you plan on using the DisplayImportChartOperation you will also need to add JFreeChart (version 1.5.0). | ||
|
||
|
||
# Download and Installation | ||
All releases can be downloaded as a .jar file from the [release page of this repository](https://github.com/digicademy/ImportMoreXtension/releases). | ||
|
||
You can include the package into your own Oxygen framework by adding the necessary JARs (AskMoreXtension, (JFreeChart,) ImportMoreXtension) to the classpath. Please find notes on how to do this in the [official documentation of the ClassPath Tab](https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/document-type-classpath-tab.html). | ||
|
||
|
||
# License | ||
The software is published under the terms of the MIT license. | ||
|
||
|
||
# Research Software Engineering and Development | ||
|
||
Copyright 2021 <a href="https://orcid.org/0000-0002-5843-7577">Patrick Daniel Brookshire</a> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.adwmainz.da.extensions.importmore</groupId> | ||
<artifactId>importMoreXtension</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>ImportMoreXtension</name> | ||
<description>This Project provides additional XML fragment import related author operations for the Oxygen XML Editor</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.oxygenxml</groupId> | ||
<artifactId>oxygen</artifactId> | ||
<version>19.1.0.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jfree</groupId> | ||
<artifactId>jfreechart</artifactId> | ||
<version>1.5.0</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
59 changes: 59 additions & 0 deletions
59
src/main/java/org/adwmainz/da/extensions/importmore/exceptions/ImportMoreXMLException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* ImportMoreXMLException.java - is an exception class signaling that an XML parsing error occurred within the ImportMoreXtension developed at the | ||
* Digital Academy of the Academy of Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.exceptions; | ||
|
||
public class ImportMoreXMLException extends Exception { | ||
|
||
// default serial version ID | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Creates a new ImportMoreXMLException with <code>null</code> as its detail message. | ||
*/ | ||
public ImportMoreXMLException() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXMLException with the specified message. | ||
* @param message the detail message | ||
*/ | ||
public ImportMoreXMLException(String message) { | ||
super(message); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXMLException with the specified cause. | ||
* @param cause the Throwable that caused this exception | ||
*/ | ||
public ImportMoreXMLException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXMLException with the specified message and cause. | ||
* @param message the detail message | ||
* @param cause the Throwable that caused this exception | ||
*/ | ||
public ImportMoreXMLException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXMLException with the specified message and cause as well as suppression and | ||
* writable stack trace controls. | ||
* @param message the detail message | ||
* @param cause the Throwable that caused this exception | ||
* @param enableSuppression controls whether or not suppression should be enabled or disabled | ||
* @param writableStackTrace controls whether or not the stack trace should be writable | ||
*/ | ||
public ImportMoreXMLException(String message, Throwable cause, boolean enableSuppression, | ||
boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
src/main/java/org/adwmainz/da/extensions/importmore/exceptions/ImportMoreXPathException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* ImportMoreXPathException.java - is an exception class signaling that an XPath parsing error occurred within the ImportMoreXtension developed at | ||
* the Digital Academy of the Academy of Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.exceptions; | ||
|
||
public class ImportMoreXPathException extends Exception { | ||
|
||
// default serial version ID | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Creates a new ImportMoreXPathException with <code>null</code> as its detail message. | ||
*/ | ||
public ImportMoreXPathException() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXPathException with the specified message. | ||
* @param message the detail message | ||
*/ | ||
public ImportMoreXPathException(String message) { | ||
super(message); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXPathException with the specified cause. | ||
* @param cause the Throwable that caused this exception | ||
*/ | ||
public ImportMoreXPathException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
/** | ||
* Creates a new ImportMoreXPathException with the specified message and cause. | ||
* @param message the detail message | ||
* @param cause the Throwable that caused this exception | ||
*/ | ||
public ImportMoreXPathException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
|
||
/** | ||
* Creates a new ImportMoreXPathException with the specified message and cause as well as suppression and | ||
* writable stack trace controls. | ||
* @param message the detail message | ||
* @param cause the Throwable that caused this exception | ||
* @param enableSuppression controls whether or not suppression should be enabled or disabled | ||
* @param writableStackTrace controls whether or not the stack trace should be writable | ||
*/ | ||
public ImportMoreXPathException(String message, Throwable cause, boolean enableSuppression, | ||
boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/org/adwmainz/da/extensions/importmore/factories/DatasetFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* DatasetFactory.java - is a factory class that creates datasets as used within the ImportMoreXtension developed at the Digital Academy of the | ||
* Academy of Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.factories; | ||
|
||
import java.util.Map; | ||
|
||
import org.jfree.data.general.DefaultPieDataset; | ||
import org.jfree.data.general.PieDataset; | ||
|
||
public class DatasetFactory { | ||
|
||
/** | ||
* Converts the given Map to a PieDataset | ||
* @param labeledData some Integer values that are labeled with a String key | ||
*/ | ||
public static PieDataset createPieDataset(Map<String, Integer> labeledData) { | ||
DefaultPieDataset dataset = new DefaultPieDataset(); | ||
for (Map.Entry<String, Integer> entry: labeledData.entrySet()) { | ||
String key = entry.getKey(); | ||
int value = entry.getValue(); | ||
dataset.setValue(key + ": " + value, value); | ||
} | ||
return dataset; | ||
} | ||
|
||
/** | ||
* Converts the given Map to a PieDataset the keys of which contain percentages (e.g. "foo: 42 (12,34%)") | ||
* @param labeledData some Integer values that are labeled with a String key | ||
* @param precision the number of decimal places the calculated percentages should be trimmed to | ||
* @throws IllegalArgumentException if <code>precision</code> is not a positive integer | ||
*/ | ||
public static PieDataset createPieDatasetWithPercentages(Map<String, Integer> labeledData, int precision) | ||
throws IllegalArgumentException { | ||
// validate fractDigits | ||
if (precision < 0) | ||
throw new IllegalArgumentException(precision + "is not a positive integer!"); | ||
|
||
// calc base | ||
int base = 0; | ||
for (int value: labeledData.values()) | ||
base += value; | ||
|
||
// generate dataset | ||
DefaultPieDataset dataset = new DefaultPieDataset(); | ||
for (Map.Entry<String, Integer> entry: labeledData.entrySet()) { | ||
String key = entry.getKey(); | ||
int absoluteValue = entry.getValue(); | ||
double relativeValue = (double)absoluteValue / base; | ||
dataset.setValue(String.format("%s: %d (%."+precision+"f%%)", key, absoluteValue, 100*relativeValue), absoluteValue); | ||
} | ||
return dataset; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/adwmainz/da/extensions/importmore/factories/FrameFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* FrameFactory.java - is a factory class that creates frames used within the ImportMoreXtension developed at the Digital Academy of the Academy of | ||
* Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.factories; | ||
|
||
import org.adwmainz.da.extensions.importmore.views.LoadingFrame; | ||
import org.adwmainz.da.extensions.importmore.views.PieChartFrame; | ||
import org.jfree.data.general.PieDataset; | ||
|
||
public class FrameFactory { | ||
|
||
/** | ||
* Creates a PieChartFrame with the specified params | ||
* @param dialogTitle the title the generated dialog should have | ||
* @param chartTitle the title the generated pie chart should have | ||
* @param dataset the dataset that should be used to create a pie chart | ||
*/ | ||
public static PieChartFrame createPieChartFrame(String dialogTitle, String chartTitle, PieDataset dataset) { | ||
PieChartFrame frame = new PieChartFrame(chartTitle, dataset); | ||
frame.setTitle(dialogTitle); | ||
return frame; | ||
} | ||
|
||
/** | ||
* Creates a basic LoadingFrame | ||
*/ | ||
public static LoadingFrame createLoadingFrame() { | ||
LoadingFrame frame = new LoadingFrame(); | ||
frame.setLocationRelativeTo(null); // center view | ||
return frame; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/org/adwmainz/da/extensions/importmore/factories/URLFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* URLFactory.java - is a factory class that creates URLs as used within the ImportMoreXtension developed at the Digital Academy of the Academy of | ||
* Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.factories; | ||
|
||
import java.io.File; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
public class URLFactory { | ||
|
||
/** | ||
* Returns the URL corresponding to the specified resourceName | ||
* @param resourcePath the path to a resource | ||
* @throws MalformedURLException if <code>resourceName</code> cannot be parsed | ||
*/ | ||
public static URL create(String resourcePath) throws MalformedURLException { | ||
File file = new File(resourcePath); | ||
if (file.isFile()) | ||
return file.toURI().toURL(); | ||
return new URL(resourcePath); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/adwmainz/da/extensions/importmore/models/CheckboxListCellRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* CheckboxListCellRenderer.java - is a custom renderer that displays jList items as JCheckBoxes as used within the AskMoreXtension developed at | ||
* the Digital Academy of the Academy of Sciences and Literature | Mainz. | ||
* @author Patrick D. Brookshire | ||
* @version 1.0.0 | ||
*/ | ||
package org.adwmainz.da.extensions.importmore.models; | ||
|
||
import java.awt.Component; | ||
|
||
import javax.swing.JCheckBox; | ||
import javax.swing.JList; | ||
import javax.swing.ListCellRenderer; | ||
|
||
public class CheckboxListCellRenderer<E> extends JCheckBox implements ListCellRenderer<E> { | ||
|
||
// generated serial version id | ||
private static final long serialVersionUID = -278844714842243873L; | ||
|
||
// overridden renderer method | ||
@Override | ||
public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) { | ||
|
||
// keep original list configuration | ||
setComponentOrientation(list.getComponentOrientation()); | ||
setFont(list.getFont()); | ||
setBackground(list.getBackground()); | ||
setForeground(list.getForeground()); | ||
setSelected(isSelected); | ||
setEnabled(list.isEnabled()); | ||
setText(value == null ? "" : value.toString()); | ||
|
||
return this; | ||
} | ||
|
||
} |
Oops, something went wrong.