From: Charles Ofoegbu Date: Thu, 9 Oct 2014 15:16:58 +0000 (+0100) Subject: Integration of Freemarker API to the Jalview help system to aid X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f244cdf6267fd446edc039d49428fa8eabcca42c;p=jalview.git Integration of Freemarker API to the Jalview help system to aid self-documentation where possible using predefined templates and boiler-plates codes from Jalview codebase --- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..50a7ed6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +* text=auto + +# Windows users +core.autocrlf = true + +# Mac users +#core.autocrlf = input \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9841761..c4c7880 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ -.project -/dist -/classes -.externalToolBuilders/Jalview Release indices [Builder].launch -/.DS_Store -/.com.apple.timemachine.supported +.project +/dist +/classes +.externalToolBuilders/Jalview Release indices [Builder].launch +/.DS_Store +/.com.apple.timemachine.supported +/nbproject/private/ +.settings/ \ No newline at end of file diff --git a/help/freemarker_templates/alignmentMenu.ftl b/help/freemarker_templates/alignmentMenu.ftl new file mode 100644 index 0000000..c341a7a --- /dev/null +++ b/help/freemarker_templates/alignmentMenu.ftl @@ -0,0 +1,642 @@ + + + + Alignment Window Menus + + + +

Alignment Window Menus x

+ + + + +
  • Colour + +
  • + + +
  • Calculate + +
  • + + +
  • Web Service Menu
    + This menu is dynamic, and may contain user-defined web service +entries in addition to any of the following ones:
    + + +

    Selecting items from the following submenus will start +a remote service on compute facilities at the University of Dundee, or +elsewhere. You need a continuous network connection in order to use +these services through Jalview.

    + + +
  • + + + \ No newline at end of file diff --git a/help/html/freemarker_html_output/alignmentMenu.html b/help/html/freemarker_html_output/alignmentMenu.html new file mode 100644 index 0000000..d691be1 --- /dev/null +++ b/help/html/freemarker_html_output/alignmentMenu.html @@ -0,0 +1,649 @@ + + + + Alignment Window Menus + + + +

    Alignment Window Menus x

    + + + + +
  • Colour + +
  • + + +
  • Calculate + +
  • + + +
  • Web Service Menu
    + This menu is dynamic, and may contain user-defined web service +entries in addition to any of the following ones:
    + + +

    Selecting items from the following submenus will start +a remote service on compute facilities at the University of Dundee, or +elsewhere. You need a continuous network connection in order to use +these services through Jalview.

    + + +
  • + + + \ No newline at end of file diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index 1af18b6..2022a7f 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -1,19 +1,19 @@ /* * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) * Copyright (C) 2014 The Jalview Authors - * + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. @@ -24,9 +24,9 @@ package jalview.datamodel; * Defines internal constants for unambiguous annotation of DbRefEntry source * strings and describing the data retrieved from external database sources (see * jalview.ws.DbSourcProxy) - * + * * @author JimP - * + * */ public class DBRefSource { @@ -36,6 +36,11 @@ public class DBRefSource public static String UNIPROT = "UNIPROT"; /** + * INTERMINE ID + */ + public static String INTERMINE = "INTERMINE"; + + /** * UNIPROT Entry Name */ public static String UP_NAME = "UNIPROT_NAME"; @@ -79,22 +84,22 @@ public class DBRefSource * List of databases whose sequences might have coding regions annotated */ public static final String[] DNACODINGDBS = - { EMBL, EMBLCDS, GENEDB }; + { EMBL, EMBLCDS, GENEDB }; public static final String[] CODINGDBS = - { EMBLCDS, GENEDB }; + { EMBLCDS, GENEDB }; public static final String[] PROTEINDBS = - { UNIPROT, PDB, UNIPROTKB }; + { UNIPROT, PDB, UNIPROTKB }; public static final String[] PROTEINSEQ = - { UNIPROT, UNIPROTKB }; + { UNIPROT, UNIPROTKB }; public static final String[] PROTEINSTR = - { PDB }; + { PDB }; public static final String[] DOMAINDBS = - { PFAM, RFAM }; + { PFAM, RFAM }; /** * set of unique DBRefSource property constants. These could be used to diff --git a/src/jalview/help/freemarker/AllignmentMenuTemplateData.java b/src/jalview/help/freemarker/AllignmentMenuTemplateData.java index a1b808b..61c94d9 100644 --- a/src/jalview/help/freemarker/AllignmentMenuTemplateData.java +++ b/src/jalview/help/freemarker/AllignmentMenuTemplateData.java @@ -1,59 +1,58 @@ -package jalview.help.freemarker; - -import jalview.io.AppletFormatAdapter; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; - -public class AllignmentMenuTemplateData -{ - - public static void main(String[] args) - { - // System.out.println("Absolute Path " + new File().getAbsoluteFile()); - generateAllignmentMenuTemplateData(); - } - public static void generateAllignmentMenuTemplateData() - { - Configuration cfg = new Configuration(); - try - { - // Load template from source folder - Template template = cfg - .getTemplate("/help/freemarker_templates/alignmentMenu.ftl"); - - // Build the data-model - Map data = new HashMap(); - data.put("format_adapters", AppletFormatAdapter.WRITEABLE_FORMATS); - - // Console output - Writer out = new OutputStreamWriter(System.out); - template.process(data, out); - out.flush(); - - // File output - Writer file = new FileWriter( - new File( - "help/html/freemarker_html_output/alignmentMenu.html")); - template.process(data, file); - file.flush(); - file.close(); - - } catch (IOException e) - { - e.printStackTrace(); - } catch (TemplateException e) - { - e.printStackTrace(); - } - } -} +package jalview.help.freemarker; + +import jalview.io.AppletFormatAdapter; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.HashMap; +import java.util.Map; + +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; + +public class AllignmentMenuTemplateData +{ + + public static void main(String[] args) + { + generateAllignmentMenuTemplateData(); + } + public static void generateAllignmentMenuTemplateData() + { + Configuration cfg = new Configuration(); + try + { + // Load template from source folder + Template template = cfg + .getTemplate("/help/freemarker_templates/alignmentMenu.ftl"); + + // Build the data-model + Map data = new HashMap(); + data.put("format_adapters", AppletFormatAdapter.WRITEABLE_FORMATS); + + // Console output + Writer out = new OutputStreamWriter(System.out); + template.process(data, out); + out.flush(); + + // File output + Writer file = new FileWriter( + new File( + "help/html/freemarker_html_output/alignmentMenu.html")); + template.process(data, file); + file.flush(); + file.close(); + + } catch (IOException e) + { + e.printStackTrace(); + } catch (TemplateException e) + { + e.printStackTrace(); + } + } +}