Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarijo committed Jul 23, 2018
2 parents f72fa4b + e48aff5 commit 8999959
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 18 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -75,6 +75,8 @@ The `-includeAnnotationProperties` flag will include annotation properties defin

The `-analytics` flag will add a code snippet for Google analytics to track your page. You need to add your code next to it. For example: UA-1234

The `-doNotDisplaySerializations` flag allows not displaying available serializations of the ontology.

How can I make WIDOCO automatically recognize my vocabulary annotations?
==========
There are two ways for making WIDOCO get your vocabulary metadata annotations and use them automatically to document the ontology.
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/widoco/Configuration.java
Expand Up @@ -114,6 +114,7 @@ public class Configuration {
private boolean createHTACCESS;
private boolean createWebVowlVisualization;
private boolean useLicensius;//optional usage of Licensius service.
private boolean displaySerializations;//in case someone does not want serializations in their page

/**
* Variable to keep track of possible errors in the changelog. If there are errors, the
Expand Down Expand Up @@ -172,6 +173,7 @@ public final void initializeConfig(){
addImportedOntologies = false;
createHTACCESS = false;
useLicensius = false;
displaySerializations = true;
initializeOntology();
}

Expand Down Expand Up @@ -970,8 +972,18 @@ public boolean isUseLicensius() {
public void setUseLicensius(boolean useLicensius) {
this.useLicensius = useLicensius;
}



/**
* True if serializations of the ontology will be displayed.
* @return
*/
public boolean isDisplaySerializations() {
return displaySerializations;
}

public void setDisplaySerializations(boolean displaySerializations) {
this.displaySerializations = displaySerializations;
}


}
12 changes: 7 additions & 5 deletions src/main/java/widoco/Constants.java
Expand Up @@ -656,12 +656,14 @@ public static String getHeadSection(Configuration c, Properties l){
if(!c.getMainOntology().getExtendedOntologies().isEmpty())
head += getExtends(c.getMainOntology().getExtendedOntologies(),l)+"\n";

HashMap<String,String> availableSerializations = c.getMainOntology().getSerializations();
head+="<dt>"+l.getProperty(LANG_SERIALIZATION)+"</dt><dd>";
for(String serialization:availableSerializations.keySet()){
head+="<span><a href=\""+availableSerializations.get(serialization)+"\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Format-"+serialization.replace("-", "_")+"-blue.svg\" alt=\""+serialization+"\" /></a> </span>";
if(c.isDisplaySerializations()){
HashMap<String,String> availableSerializations = c.getMainOntology().getSerializations();
head+="<dt>"+l.getProperty(LANG_SERIALIZATION)+"</dt><dd>";
for(String serialization:availableSerializations.keySet()){
head+="<span><a href=\""+availableSerializations.get(serialization)+"\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Format-"+serialization.replace("-", "_")+"-blue.svg\" alt=\""+serialization+"\" /></a> </span>";
}
head+="</dd>";
}
head+="</dd>";

if(c.getMainOntology().getLicense()!=null){
String lname = c.getMainOntology().getLicense().getName();//"license name goes here";
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/widoco/gui/GuiController.java
Expand Up @@ -71,7 +71,8 @@ public GuiController(String[] args){
String outFolder="myDocumentation"+(new Date().getTime()), ontology="", configOutFile=null;
boolean isFromFile=false, oops = false, rewriteAll=false, getOntoMetadata = true, useW3Cstyle = true,
includeImportedOntologies = false, htAccess = false, webVowl=false, errors = false, licensius = false,
generateOnlyCrossRef = false, includeNamedIndividuals=true, includeAnnotationProperties = false;
generateOnlyCrossRef = false, includeNamedIndividuals=true, includeAnnotationProperties = false,
displaySerializations = true;
String confPath="";
String code=null;//for tracking analytics.
String[] languages = null;
Expand Down Expand Up @@ -142,6 +143,9 @@ public GuiController(String[] args){
case "-includeAnnotationProperties":
includeAnnotationProperties = true;
break;
case "-doNotDisplaySerializations":
displaySerializations = false;
break;
default:
System.out.println("Command"+s+" not recognized.");
System.out.println("Usage: java -jar widoco.jar [-ontFile file] or [-ontURI uri] [-outFolder folderName] [-confFile propertiesFile] [-getOntologyMetadata] [-oops] [-rewriteAll] [-crossRef] [-saveConfig configOutFile] [-lang lang1-lang2] [-includeImportedOntologies] [-htaccess] [-licensius] [-webVowl] [-ignoreIndividuals] [-includeAnnotationProperties] [-analytics analyticsCode]\n");
Expand Down Expand Up @@ -179,6 +183,7 @@ public GuiController(String[] args){
this.config.setUseLicensius(licensius);
this.config.setIncludeNamedIndividuals(includeNamedIndividuals);
this.config.setIncludeAnnotationProperties(includeAnnotationProperties);
this.config.setDisplaySerializations(displaySerializations);
if(code!=null){
this.config.setGoogleAnalyticsCode(code);
}
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/widoco/gui/GuiStep3.form
Expand Up @@ -103,7 +103,7 @@
<Group type="102" alignment="0" attributes="0">
<Component id="jSeparator1" min="-2" pref="17" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" pref="380" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" pref="401" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
Expand Down Expand Up @@ -262,6 +262,7 @@
<EmptySpace min="-2" pref="219" max="-2" attributes="0"/>
</Group>
<Component id="checkBoxAutomatedChangeLog" alignment="0" max="32767" attributes="1"/>
<Component id="checkBoxDisplaySerialization" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace min="-2" pref="104" max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -316,7 +317,9 @@
<Component id="checkBoxWebVowl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkBoxAutomatedChangeLog" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="9" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkBoxDisplaySerialization" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="5" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="w3C" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="customRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -488,6 +491,15 @@
</Component>
<Component class="javax.swing.JTextField" name="analyticsField">
</Component>
<Component class="javax.swing.JCheckBox" name="checkBoxDisplaySerialization">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Display ontology serializations"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkBoxDisplaySerializationActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="labelDescription">
Expand Down
24 changes: 21 additions & 3 deletions src/main/java/widoco/gui/GuiStep3.java
Expand Up @@ -125,6 +125,7 @@ private void initComponents() {
checkBoxAutomatedChangeLog = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
analyticsField = new javax.swing.JTextField();
checkBoxDisplaySerialization = new javax.swing.JCheckBox();
labelDescription = new javax.swing.JLabel();
widocoLogo = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
Expand Down Expand Up @@ -269,6 +270,14 @@ public void mouseExited(java.awt.event.MouseEvent evt) {

jLabel3.setText("Google analytics code");

checkBoxDisplaySerialization.setSelected(true);
checkBoxDisplaySerialization.setText("Display ontology serializations");
checkBoxDisplaySerialization.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkBoxDisplaySerializationActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
Expand Down Expand Up @@ -323,7 +332,8 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(checkBoxWebVowl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(219, 219, 219))
.addComponent(checkBoxAutomatedChangeLog, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(checkBoxAutomatedChangeLog, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkBoxDisplaySerialization, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(104, 104, 104))))
);
jPanel1Layout.setVerticalGroup(
Expand Down Expand Up @@ -366,7 +376,9 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
.addComponent(checkBoxWebVowl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkBoxAutomatedChangeLog)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkBoxDisplaySerialization)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(w3C)
.addComponent(customRadioButton)
Expand Down Expand Up @@ -443,7 +455,7 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
.addGroup(layout.createSequentialGroup()
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 401, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
Expand Down Expand Up @@ -503,6 +515,7 @@ private void saveState(){
g.getConfig().setCreateWebVowlVisualization(checkBoxWebVowl.isSelected());
g.getConfig().setIncludeChangeLog(checkBoxAutomatedChangeLog.isSelected());
g.getConfig().setGoogleAnalyticsCode(analyticsField.getText());
g.getConfig().setDisplaySerializations(checkBoxDisplaySerialization.isSelected());
}

private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
Expand Down Expand Up @@ -545,6 +558,10 @@ private void abstractSectionButtonActionPerformed(java.awt.event.ActionEvent evt
abstractPath = loadSection();
}//GEN-LAST:event_abstractSectionButtonActionPerformed

private void checkBoxDisplaySerializationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxDisplaySerializationActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_checkBoxDisplaySerializationActionPerformed

private String loadSection(){
JFileChooser chooser = new JFileChooser();
int returnVal = chooser.showSaveDialog(this);
Expand Down Expand Up @@ -600,6 +617,7 @@ private String loadSection(){
private javax.swing.JCheckBox checkBoxAbstract;
private javax.swing.JCheckBox checkBoxAutomatedChangeLog;
private javax.swing.JCheckBox checkBoxDescription;
private javax.swing.JCheckBox checkBoxDisplaySerialization;
private javax.swing.JCheckBox checkBoxHTAccess;
private javax.swing.JCheckBox checkBoxIntro;
private javax.swing.JCheckBox checkBoxOverview;
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/widoco/gui/SelectLanguage.form
Expand Up @@ -33,6 +33,7 @@
<Component id="otherText" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cs" min="-2" max="-2" attributes="0"/>
<Component id="pt" min="-2" max="-2" attributes="0"/>
<Component id="en" min="-2" max="-2" attributes="0"/>
<Component id="fr" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -63,16 +64,17 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="fr" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cs" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="it" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="de" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace pref="5" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="otherText" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="doneButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -130,5 +132,10 @@
<Property name="text" type="java.lang.String" value="pt"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="cs">
<Properties>
<Property name="text" type="java.lang.String" value="cs"/>
</Properties>
</Component>
</SubComponents>
</Form>
20 changes: 17 additions & 3 deletions src/main/java/widoco/gui/SelectLanguage.java
Expand Up @@ -55,6 +55,9 @@ else if(nextL.contains("pt")){
else if(nextL.contains("fr")){
fr.setSelected(true);
}
else if(nextL.contains("cs")){
cs.setSelected(true);
}
else{
otherText.setText(nextL);
lang = nextL;
Expand Down Expand Up @@ -83,6 +86,7 @@ private void initComponents() {
fr = new javax.swing.JCheckBox();
es = new javax.swing.JCheckBox();
pt = new javax.swing.JCheckBox();
cs = new javax.swing.JCheckBox();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Languages...");
Expand Down Expand Up @@ -114,6 +118,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

pt.setText("pt");

cs.setText("cs");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
Expand All @@ -125,6 +131,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(otherText)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cs)
.addComponent(pt)
.addComponent(en)
.addComponent(fr)
Expand All @@ -150,16 +157,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fr)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cs)
.addGap(6, 6, 6)
.addComponent(it)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(de)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(otherText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(doneButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(doneButton))
);

pack();
Expand Down Expand Up @@ -187,6 +195,11 @@ private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
}else{
this.c.removeLanguageToGenerate("fr");
}
if(cs.isSelected()){
this.c.addLanguageToGenerate("cs");
}else{
this.c.removeLanguageToGenerate("cs");
}
String otherL = otherText.getText();
if(!"".equals(otherL)){
this.c.addLanguageToGenerate(otherL);
Expand All @@ -207,6 +220,7 @@ private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
*/

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox cs;
private javax.swing.JRadioButton de;
private javax.swing.JButton doneButton;
private javax.swing.JCheckBox en;
Expand Down
Binary file modified src/main/resources/lode.zip
Binary file not shown.

0 comments on commit 8999959

Please sign in to comment.