Jbusycomponent Plugin

Description

This plugin enables a busy state on any Swing component via JBusyComponent.

Installation

The current version of griffon-jbusycomponent-plugin is 0.2
To install just issue the following command

griffon install-plugin jbusycomponent

Usage

The following nodes will become available on a View script upon installing this plugin

Node Property Type Default Required Bindable Notes
busyComponent
[JBusyComponent]
busy boolean    
  busyModel [BusyModel]    
  view [JComponent]   or nest any JComponent node
busyModel
[DefaultBusyModel]
busy boolean    
  determinate boolean    
  autoCompletionEnabled boolean    
  cancellable boolean    
  description String    
futureBusyModel
[FutureBusyModel]
future Future    
jxlayer
[JXLayer]
view JComponent or nest a target component
  UI LayerUI   or nest one of the UI nodes
  glassPane JPanel    
buttonPanelUI
[ButtonPanelUI]
focusCyclic boolean false  
debugRepaintingUI
[DebugRepaintingUI]
           
mouseScrollableUI
[MouseScrollableUI]
           
spotLightUI
[SpotLightUI]
overlayColor Color Color(0, 0, 0, 128)  
  softClipWidth int 0  
  enabled boolean true  
            you can nest any number of Shapes (use bean() node)
lockableUI
[LockableUI]
locked boolean false  
            you can nest any number of LayerEffect (use bean() node)
bufferedImageOpEffect
[BufferedImageOpEffect]
bufferedImageOps BufferedImageOp[]   or nest any number of BufferedImageOp (use bean() node)

Here is a simple example of a textArea that is set to busy or not depending on a toggleButton's selected state

application(title: 'Sample',
  size: [320,320],
  locationByPlatform: true,
  iconImage: imageIcon('/griffon-icon-48x48.png').image,
  iconImages: [imageIcon('/griffon-icon-48x48.png').image,
               imageIcon('/griffon-icon-32x32.png').image,
               imageIcon('/griffon-icon-16x16.png').image]) {
    borderLayout()
    toggleButton(id: "t1", "Busy", constraints: NORTH)
    busyComponent(id: "c1", constraints: CENTER, busy: bind{t1.selected}) {
      busyModel(description: "Can't you see I'm busy?")
      scrollPane {
        textArea(columns: 30, rows: 5, text: """Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.""")
      }
    }
}

Before clicking the toggle button

After clicking the toggle button

Here is another example showing JXLayer and JBusyComponent nodes

import javax.swing.SwingConstants
import org.kordamp.jsilhouette.geom.*
import com.jhlabs.image.*
 
def lipsum = '''Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
'''
 
createContent = {
   scrollPane(preferredSize: [300, 300] ) {
      textArea(lineWrap: true, wrapStyleWord: true, text: lipsum*3, columns: 40)
   }
}
 
application(title: 'JXLayer',
  size: [460, 400],
  locationByPlatform:true,
  iconImage: imageIcon('/griffon-icon-48x48.png').image,
  iconImages: [imageIcon('/griffon-icon-48x48.png').image,
               imageIcon('/griffon-icon-32x32.png').image,
               imageIcon('/griffon-icon-16x16.png').image]) {
   tabbedPane(tabPlacement: SwingConstants.LEFT) {
      panel(title: 'MouseScrollableUI') {
         borderLayout()
         jxlayer(constraints: CENTER) {
            mouseScrollableUI()
            createContent()
         }
         label('Press middle-mouse button and scroll.', constraints: SOUTH)
      }
      panel(title: 'SpotLightUI') {
         borderLayout()
         jxlayer(constraints: CENTER) {
            spotLightUI(id: 'spotLight') {
               bean(new Star(), cx: 150f, cy: 150f, or: 100f, ir: 50f, count: 5i)
            }
            createContent()
         }
         checkBox('SpotLight', constraints: SOUTH,
            actionPerformed: {e-> spotLight.shadowEnabled = e.source.selected})
      }
      panel(title: 'LockableUI') {
         borderLayout()
         jxlayer(constraints: CENTER) {
            lockableUI(id: 'lock') {
               bufferedImageOpEffect {
                  bean(new BlurFilter())
               }
            }
            createContent()
         }
         checkBox('Lock', constraints: SOUTH,
            actionPerformed: {e-> lock.locked = e.source.selected})
      }
   }
}

History

Version Date Notes
0.2 12-10-09 added jxlayer nodes
0.1 10-15-09 first release
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.