You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/03/24 10:26:35 UTC

[groovy] branch GROOVY_2_5_X updated (6a9095f -> 6b00c6c)

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a change to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from 6a9095f  Ignore ".shelf" directory by updating ".gitignore" file
     new a657fd0  replace link with newer reference (old one was broken)
     new 6b00c6c  GROOVY-9022: Added option under View menu of whether or not to have vertical orientation (unchecking changes it to horizontal; value stored in Preferences) (closes #891)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/spec/doc/design-pattern-singleton.adoc             |  2 +-
 .../src/main/groovy/groovy/ui/Console.groovy           | 18 ++++++++++++++++++
 .../src/main/groovy/groovy/ui/ConsoleActions.groovy    |  6 ++++++
 .../main/groovy/groovy/ui/view/BasicContentPane.groovy |  8 ++++----
 .../src/main/groovy/groovy/ui/view/BasicMenuBar.groovy |  1 +
 5 files changed, 30 insertions(+), 5 deletions(-)


[groovy] 02/02: GROOVY-9022: Added option under View menu of whether or not to have vertical orientation (unchecking changes it to horizontal; value stored in Preferences) (closes #891)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 6b00c6cfb814dd07da086c7a7fc0dceaf6e23534
Author: Adam Davis <ad...@gmail.com>
AuthorDate: Fri Mar 8 07:52:18 2019 -0500

    GROOVY-9022: Added option under View menu of whether or not to have vertical orientation (unchecking changes it to horizontal; value stored in Preferences) (closes #891)
---
 .../src/main/groovy/groovy/ui/Console.groovy           | 18 ++++++++++++++++++
 .../src/main/groovy/groovy/ui/ConsoleActions.groovy    |  6 ++++++
 .../main/groovy/groovy/ui/view/BasicContentPane.groovy |  8 ++++----
 .../src/main/groovy/groovy/ui/view/BasicMenuBar.groovy |  1 +
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
index 02172cf..3d0e976 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
@@ -100,6 +100,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo
 
     boolean detachedOutput = prefs.getBoolean('detachedOutput', false)
     Action detachedOutputAction
+
+    boolean orientationVertical = prefs.getBoolean('orientationVertical', true)
+    Action orientationVerticalAction
     Action showOutputWindowAction
     Action hideOutputWindowAction1
     Action hideOutputWindowAction2
@@ -654,6 +657,21 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo
         toolbar.visible = showToolbar
     }
 
+    void orientationVertical(EventObject evt) {
+        def oldValue = orientationVertical
+        orientationVertical = evt.source.selected
+        prefs.putBoolean('orientationVertical', orientationVertical)
+        if (oldValue != orientationVertical) {
+            if (orientationVertical) {
+                splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT)
+            } else {
+                splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT)
+            }
+            splitPane.resizeWeight = detachedOutput ? 1.0 : 0.5
+            splitPane.resetToPreferredSizes()
+        }
+    }
+
     void detachedOutput(EventObject evt) {
         def oldDetachedOutput = detachedOutput
         detachedOutput = evt.source.selected
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleActions.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleActions.groovy
index 627d52b..3aaa929 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleActions.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleActions.groovy
@@ -305,6 +305,12 @@ detachedOutputAction = action(
     mnemonic: 'D'
 )
 
+orientationVerticalAction = action(
+    name: 'Vertical Orientation',
+    closure: controller.&orientationVertical,
+    mnemonic: 'n'
+)
+
 showOutputWindowAction = action(
     closure: controller.&showOutputWindow,
     keyStroke: shortcut('shift O'),
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicContentPane.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicContentPane.groovy
index ce5026e..b60dbf6 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicContentPane.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicContentPane.groovy
@@ -19,7 +19,6 @@
 package groovy.ui.view
 
 import groovy.ui.Console
-import groovy.ui.ConsoleTextEditor
 
 import javax.swing.*
 import javax.swing.text.Style
@@ -30,16 +29,17 @@ import java.awt.*
 import java.awt.image.BufferedImage
 import java.util.prefs.Preferences
 
+import static javax.swing.JSplitPane.HORIZONTAL_SPLIT
 import static javax.swing.JSplitPane.VERTICAL_SPLIT
 
-def prefs = Preferences.userNodeForPackage(Console)
+Preferences prefs = Preferences.userNodeForPackage(Console)
 def detachedOutputFlag = prefs.getBoolean('detachedOutput', false)
 outputWindow = frame(visible:false, defaultCloseOperation: WindowConstants.HIDE_ON_CLOSE) {
     blank = glue()
     blank.preferredSize = [0, 0] as Dimension
 }
-splitPane = splitPane(resizeWeight: 0.5, orientation: VERTICAL_SPLIT) {
-    inputEditor = widget(new ConsoleTextEditor(), border:emptyBorder(0))
+splitPane = splitPane(resizeWeight: 0.5, orientation:
+        prefs.getBoolean('orientationVertical', true) ? VERTICAL_SPLIT : HORIZONTAL_SPLIT) {
     buildOutputArea(prefs)
 }
 
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicMenuBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicMenuBar.groovy
index 9246ea1..81316ed 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicMenuBar.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/BasicMenuBar.groovy
@@ -67,6 +67,7 @@ menuBar {
         checkBoxMenuItem(showToolbarAction, selected: controller.showToolbar)
         checkBoxMenuItem(detachedOutputAction, selected: controller.detachedOutput)
         checkBoxMenuItem(autoClearOutputAction, selected: controller.autoClearOutput)
+        checkBoxMenuItem(orientationVerticalAction, selected: controller.orientationVertical)
     }
 
     menu(text: 'History', mnemonic: 'I') {


[groovy] 01/02: replace link with newer reference (old one was broken)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit a657fd0ff5a78abc6b1c7b7c089e08c64ce65f22
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Mar 24 12:46:05 2019 +1000

    replace link with newer reference (old one was broken)
---
 src/spec/doc/design-pattern-singleton.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spec/doc/design-pattern-singleton.adoc b/src/spec/doc/design-pattern-singleton.adoc
index 1c7e3ab..a8287d7 100644
--- a/src/spec/doc/design-pattern-singleton.adoc
+++ b/src/spec/doc/design-pattern-singleton.adoc
@@ -158,4 +158,4 @@ Client: 14800362, Calc: 10580099, Total Calculations: 2
 - http://www.ibm.com/developerworks/webservices/library/co-single/index.html[Use your singletons wisely]
 - http://www.ibm.com/developerworks/java/library/j-dcl/index.html[Double-checked locking and the Singleton pattern]
 - https://web.archive.org/web/20160807234810/http://blog.crazybob.org/2007/01/lazy-loading-singletons.html[Lazy Loading Singletons]
-- http://www.yoda.arachsys.com/csharp/singleton.html[Implementing the Singleton Pattern in C#]
\ No newline at end of file
+- https://csharpindepth.com/Articles/Singleton[Implementing the Singleton Pattern in C#]
\ No newline at end of file