diff --git a/issues/pit-swing/0022bs3.rst b/issues/pit-swing/0022bs3.rst deleted file mode 100644 index 4b6a428..0000000 --- a/issues/pit-swing/0022bs3.rst +++ /dev/null @@ -1,35 +0,0 @@ -New 'Bugs' created are not correctly categorized. -================================================= - -Description ------------ - -If the user clicks *New Issue* and does not manually select *Bug* from the drop-down -list, but instead leaves the default *Bug* selected, the actual issue bypasses the -template generation phase and gets its category defaulted to *Task*. - -Implementation Notes --------------------- - -It looks like this is related to the default value of the category list in the -*New Task* dialog. - -Solution --------- - -The values from the *NewIssueDialog* are publicly visible via fields on the -model. The view has bound properties to update the model's fields whenever the -appropriate gui field is updated. But when the dialog is shown initially, the -view is reset programatically, not triggering the update to the model values. -In the case of the first new issue since launching the program, the fields on -the model are ``null`` or have their default initialized values. In subsequent -issues, they hold whatever was there before. If the user never changed those -values, they held their old values. The solution was to update the model as -well as the view when showing the dialog. - -Resolution ----------- - -Date Created: 2010-04-20 -Date Resolved: 2010-04-20 -Delivery: 0022 diff --git a/pit-swing/application.properties b/pit-swing/application.properties index e7d3722..71e1341 100644 --- a/pit-swing/application.properties +++ b/pit-swing/application.properties @@ -1,6 +1,5 @@ #utf-8 -#Thu May 13 17:04:40 CDT 2010 +#Thu May 27 05:01:16 CDT 2010 app.griffon.version=0.3 app.name=pit-swing -app.version=2.3.1 -plugins.fest=0.3 +app.version=2.4.0 diff --git a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy index c08e4ee..392a885 100644 --- a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy +++ b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy @@ -30,6 +30,8 @@ class PITController { configBinding.templates = model.templates configBinding.issueListRenderer = model.issueListRenderer configBinding.initialRepositories = [] + configBinding.issueCSS = model.issueCSS + configBinding.PIT_HOME = config.parentFile def configScript = loader.parseClass(config) .newInstance(configBinding) @@ -55,6 +57,12 @@ class PITController { loadProject(repo) } } + + // open any custom CSS for issue dsiplay + if (configBinding.issueCSS instanceof File) + model.issueCSS = configBinding.issueCSS.text + else + model.issueCSS = configBinding.issueCSS } } @@ -88,6 +96,7 @@ class PITController { mainMVC: [model: model, view: view, controller: this], newIssueDialogMVC: model.newIssueDialogMVC, issueCellRenderer: model.issueListRenderer, + issueCSS: model.issueCSS, rootProject: new FileProject(projectDir)) newMVC.model.id = projectDir.name diff --git a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy index e51b78c..af78a1e 100644 --- a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy +++ b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy @@ -10,13 +10,27 @@ import javax.swing.DefaultListModel import javax.swing.JOptionPane import javax.swing.tree.DefaultMutableTreeNode import javax.swing.tree.DefaultTreeModel +import org.dom4j.Document +import org.dom4j.io.OutputFormat +import org.dom4j.io.XMLWriter +import org.nuiton.jrst.JRSTGenerator +import org.nuiton.jrst.JRSTReader class ProjectPanelController { // these will be injected by Griffon def model def view + def jrstReader + def jrstGen + + static URL rst2htmlXSL = + ProjectPanelController.class.getResource("/rst2xhtml.xsl") + void mvcGroupInit(Map args) { + jrstReader = new JRSTReader() + jrstGen = new JRSTGenerator() + refreshProject() } @@ -27,6 +41,8 @@ class ProjectPanelController { */ void displayProject(Project project) { view.issueTextArea.text = "" + view.issueTextDisplay.text = "" + view.issueTextPanelLayout.show(view.issueTextPanel, "display") if (!project) return if (!model.projectTableModels[(project.name)]) { @@ -57,6 +73,9 @@ class ProjectPanelController { view.issueTextArea.text = issue.text view.issueTextArea.caretPosition = 0 + view.issueTextDisplay.text = rst2html(issue.text) + view.issueTextDisplay.caretPosition = 0 + view.issueTextPanelLayout.show(view.issueTextPanel, "display") } void showProjectPopup(Project project, def x, def y) { @@ -164,4 +183,40 @@ class ProjectPanelController { return view.issueTable.model.issues[view.issueTable. convertRowIndexToModel(view.issueTable.selectedRow)] } + + String rst2html(String rst) { + Document doc // memory model of document + StringWriter outString + StringBuilder result = new StringBuilder() + + // read the RST in with the RST parser + new StringReader(rst).withReader { doc = jrstReader.read(it) } + + // transform to XHTML + doc = jrstGen.transform(doc, rst2htmlXSL) + + // write to the StringWriter + outString = new StringWriter() + outString.withWriter { new XMLWriter(it, new OutputFormat("", true)).write(doc) } + + // java's embeded html is primitive, we need to massage the results + outString.toString().eachLine { line -> + + // remove the XML version and encoding, title element, + // meta elements + if (line =~ /<\?.*\?>/ || line =~ /.*)/) + if (m) line = m[0][1] + m[0][4] + + result.append(line) + + // add in the CSS information to the head + if (line =~//) result.append(model.issueCSS) + } + println result.toString() + + return result.toString() + } } diff --git a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy index 98f3e05..241d521 100644 --- a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy +++ b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy @@ -18,6 +18,8 @@ class PITModel { // map of category -> issue template def templates = [:] + def issueCSS = getClass().getResource("/default-issue.css").openStream().text + def categoryIcons = [:] def statusIcons = [:] diff --git a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy index ed17010..76af82d 100644 --- a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy +++ b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy @@ -18,6 +18,8 @@ class ProjectPanelModel { @Bindable Project selectedProject = null @Bindable Issue popupIssue = null + String issueCSS = "" + // cache the ListModels def projectTableModels = [:] def issueCellRenderer diff --git a/pit-swing/griffon-app/resources/default-issue.css b/pit-swing/griffon-app/resources/default-issue.css new file mode 100644 index 0000000..fe8ad75 --- /dev/null +++ b/pit-swing/griffon-app/resources/default-issue.css @@ -0,0 +1,24 @@ + diff --git a/pit-swing/griffon-app/resources/rst2xhtml.xsl b/pit-swing/griffon-app/resources/rst2xhtml.xsl new file mode 100644 index 0000000..b752a40 --- /dev/null +++ b/pit-swing/griffon-app/resources/rst2xhtml.xsl @@ -0,0 +1,495 @@ + + + + + + + + + + + <xsl:value-of select="title"/> + + + + + + + + + + + + + + + + + +

+ +

+
+ + + + title + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + + : + + + + + + + + + + + + : + + + + + + + + + + + + authors : + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+ + +
    + + + 1 + + + a + + + A + + + i + + + I + + + + +
+
+ + +
  • +
    + + +
    +
    + + + + +
    +
    + + + + + : + + + + + + + +
    + + + + + + + + + + +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + +
    +
    + + + + +
    + + + +
    +
    + + + + + + +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + +
    + +
    + + +

    +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +

    + +

    +

    + +

    +
    +
    +
    + + +
    +

    :

    +

    + +

    +
    +
    + + + +
    + +

    +

    + +

    +
    + + + +
    + +
    + + +
    +			
    +		
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + + + + + +
    +

    + +

    + +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + +
    + + [] + + + + +
    +
    + + + + [] + + + +
    \ No newline at end of file diff --git a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy index 847323e..ab60633 100644 --- a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy +++ b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy @@ -57,7 +57,8 @@ Status.values().each { openDialog = fileChooser(fileSelectionMode: JFileChooser.DIRECTORIES_ONLY) frame = application(title:'Personal Issue Tracker', - minimumSize: [800, 500], + minimumSize: [400, 200], + preferredSize: [800, 500], pack:true, locationRelativeTo: null, iconImage: imageIcon('/icon64x64.png').image, diff --git a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy index 3f4339b..a4f5ae5 100644 --- a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy +++ b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy @@ -10,6 +10,8 @@ import java.awt.Point import java.awt.event.MouseEvent import javax.swing.JOptionPane import javax.swing.JSplitPane +import javax.swing.JLabel +import javax.swing.JScrollPane import javax.swing.JTable import javax.swing.JTextField import javax.swing.ListSelectionModel @@ -261,32 +263,60 @@ panel = splitPane(orientation: JSplitPane.HORIZONTAL_SPLIT, deleteIssueButton = button(deleteIssue, constraints: gbc(gridx: 2, gridy: 1, anchor: GBC.EAST), - enabled: bind(source: issueTable.selectionModel, sourceEvent: 'valueChanged', + enabled: bind(source: issueTable.selectionModel, + sourceEvent: 'valueChanged', sourceValue: { !issueTable.selectionModel.isSelectionEmpty() })) } - scrollPane(constraints: "bottom") { - issueTextArea = textArea( - wrapStyleWord: true, - lineWrap: bind(source: wordWrapCheckBox, - sourceProperty: 'selected'), - editable: bind( source: issueTable.selectionModel, sourceEvent: 'valueChanged', - sourceValue: { !issueTable.selectionModel.isSelectionEmpty() }), - font: model.mainMVC.model.issueDetailFont, - focusGained: {}, - focusLost: { - def issue = controller.getSelectedIssue() - if (issue == null) return - if (issueTextArea.text != issue.text) - issue.text = issueTextArea.text - }, - mouseExited: { - def issue = controller.getSelectedIssue() - if (issue == null) return - if (issueTextArea.text != issue.text) - issue.text = issueTextArea.text - }) + scrollPane(constraints: "bottom", + horizontalScrollBarPolicy: JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) { + issueTextPanel = panel { + issueTextPanelLayout = cardLayout() + + issueTextArea = textArea( + constraints: "editor", + wrapStyleWord: true, + lineWrap: bind(source: wordWrapCheckBox, + sourceProperty: 'selected'), + editable: bind( source: issueTable.selectionModel, + sourceEvent: 'valueChanged', + sourceValue: + { !issueTable.selectionModel.isSelectionEmpty() }), + font: model.mainMVC.model.issueDetailFont, + focusGained: {}, + focusLost: { + def issue = controller.getSelectedIssue() + if (issue == null) return + if (issueTextArea.text != issue.text) { + issue.text = issueTextArea.text + issueTextDisplay.text = controller.rst2html( + issueTextArea.text) + } + issueTextPanelLayout.show(issueTextPanel, "display") + }, + mouseExited: { + def issue = controller.getSelectedIssue() + if (issue == null) return + if (issueTextArea.text != issue.text) { + issue.text = issueTextArea.text + issueTextDisplay.text = controller.rst2html( + issueTextArea.text) + } + issueTextPanelLayout.show(issueTextPanel, "display") + }) + + issueTextDisplay = editorPane(contentType: "text/html", + constraints: "display", + editable: false, + preferredSize: [200, 200], + mouseClicked: { evt -> + if (evt.clickCount > 1) + issueTextPanelLayout.show(issueTextPanel, "editor") + }) + } + + issueTextPanelLayout.show(issueTextPanel, "display") } } } diff --git a/pit-swing/lib/commons-lang-2.4.jar b/pit-swing/lib/commons-lang-2.4.jar new file mode 100644 index 0000000..532939e Binary files /dev/null and b/pit-swing/lib/commons-lang-2.4.jar differ diff --git a/pit-swing/lib/commons-logging-1.1.1.jar b/pit-swing/lib/commons-logging-1.1.1.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/pit-swing/lib/commons-logging-1.1.1.jar differ diff --git a/pit-swing/lib/commons-primitives-1.0.jar b/pit-swing/lib/commons-primitives-1.0.jar new file mode 100644 index 0000000..299648d Binary files /dev/null and b/pit-swing/lib/commons-primitives-1.0.jar differ diff --git a/pit-swing/lib/dom4j-1.6.1.jar b/pit-swing/lib/dom4j-1.6.1.jar new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and b/pit-swing/lib/dom4j-1.6.1.jar differ diff --git a/pit-swing/lib/jaxen-1.1.1.jar b/pit-swing/lib/jaxen-1.1.1.jar new file mode 100644 index 0000000..b633631 Binary files /dev/null and b/pit-swing/lib/jaxen-1.1.1.jar differ diff --git a/pit-swing/lib/jrst-1.1.1.jar b/pit-swing/lib/jrst-1.1.1.jar new file mode 100644 index 0000000..0846e94 Binary files /dev/null and b/pit-swing/lib/jrst-1.1.1.jar differ diff --git a/pit-swing/lib/log4j-1.2.15.jar b/pit-swing/lib/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/pit-swing/lib/log4j-1.2.15.jar differ diff --git a/pit-swing/lib/nuiton-i18n-1.1.jar b/pit-swing/lib/nuiton-i18n-1.1.jar new file mode 100644 index 0000000..e5bff59 Binary files /dev/null and b/pit-swing/lib/nuiton-i18n-1.1.jar differ diff --git a/pit-swing/lib/pit-2.3.0.jar b/pit-swing/lib/pit-2.3.0.jar deleted file mode 100644 index ba56089..0000000 Binary files a/pit-swing/lib/pit-2.3.0.jar and /dev/null differ diff --git a/pit-swing/lib/pit-2.3.1.jar b/pit-swing/lib/pit-2.3.1.jar new file mode 100644 index 0000000..bf362a5 Binary files /dev/null and b/pit-swing/lib/pit-2.3.1.jar differ diff --git a/release/pit-swing-2.3.1.jar b/release/pit-swing-2.4.0.jar similarity index 67% rename from release/pit-swing-2.3.1.jar rename to release/pit-swing-2.4.0.jar index 1d6e32b..b43f821 100644 Binary files a/release/pit-swing-2.3.1.jar and b/release/pit-swing-2.4.0.jar differ diff --git a/version.properties b/version.properties index 5f32ed4..366d3a6 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -application.version=2.3.1 +application.version=2.4.0