Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd1c1db
commit 07023de
Showing
11 changed files
with
534 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
Package: rChoiceDialogs | ||
Type: Package | ||
Title: rChoiceDialogs collection | ||
Version: 1.0.4 | ||
Date: 2012-10-11 | ||
Author: Alex Lisovich, Roger Day | ||
Maintainer: Alex Lisovich <alex.lisovich@gmail.com> | ||
Version: 1.0.6 | ||
Date: 2014-09-05 | ||
Authors@R: c(person("Alex","Lisovich",role=c("aut","cre"),email="alex.lisovich@gmail.com"), | ||
person("Roger","Day",role="aut",email="day01@pitt.edu"), | ||
person("Sun Microsystems, Inc",role="cph", | ||
comment="swing-layout-1.0.4.jar, download from http://www.java2s.com/Code/Jar/s/Downloadswinglayout104jar.htm")) | ||
Description: Collection of portable choice dialog widgets | ||
License: GPL (>= 2.0) | ||
License: LGPL (>= 2.1) | ||
Depends: rJava, utils | ||
Imports: tcltk | ||
Collate: 'zzz.R' 'rChoiceDialogs-package.R' 'rFileChooser.R' | ||
'rListChooser.R' 'rMiscFunctions.R' | ||
Packaged: 2012-10-11 23:51:04 UTC; alex | ||
Packaged: 2014-09-10 20:49:54 UTC; alex | ||
Author: Alex Lisovich [aut, cre], | ||
Roger Day [aut], | ||
Sun Microsystems, Inc [cph] (swing-layout-1.0.4.jar, download from | ||
http://www.java2s.com/Code/Jar/s/Downloadswinglayout104jar.htm) | ||
Maintainer: Alex Lisovich <alex.lisovich@gmail.com> | ||
NeedsCompilation: no | ||
Repository: CRAN | ||
Date/Publication: 2012-10-12 05:41:04 | ||
Date/Publication: 2014-09-11 07:26:55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import( | ||
rJava) | ||
export( | ||
canUseJava, | ||
canUseJavaModal, | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
### R code from vignette source 'rChoiceDialogs.Rnw' | ||
### Encoding: UTF-8 | ||
|
||
################################################### | ||
### code chunk number 1: sessionInfo | ||
################################################### | ||
|
||
library(rChoiceDialogs) | ||
|
||
toLatex(sessionInfo()) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package rjavautils; | ||
|
||
import java.io.File; | ||
import javax.swing.filechooser.FileFilter; | ||
|
||
class ExtensionFileFilter extends FileFilter | ||
{ | ||
String description; | ||
String[] extensions; | ||
|
||
public ExtensionFileFilter(String description, String extension) | ||
{ | ||
this(description, new String[] { extension }); | ||
} | ||
|
||
public ExtensionFileFilter(String description, String[] extensions) | ||
{ | ||
if (description == null) | ||
this.description = (extensions[0] + "{ " + extensions.length + "} "); | ||
else { | ||
this.description = description; | ||
} | ||
this.extensions = ((String[])(String[])extensions.clone()); | ||
toLower(this.extensions); | ||
} | ||
|
||
private void toLower(String[] array) { | ||
int i = 0; for (int n = array.length; i < n; i++) | ||
array[i] = array[i].toLowerCase(); | ||
} | ||
|
||
public String getDescription() | ||
{ | ||
return this.description; | ||
} | ||
|
||
public boolean accept(File file) { | ||
if (file.isDirectory()) { | ||
return true; | ||
} | ||
String path = file.getAbsolutePath().toLowerCase(); | ||
int i = 0; for (int n = this.extensions.length; i < n; i++) { | ||
String extension = this.extensions[i]; | ||
if (extension.equals("*")) | ||
return true; | ||
if ((path.endsWith(extension)) && (path.charAt(path.length() - extension.length() - 1) == '.')) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package rjavautils; | ||
|
||
import javax.swing.SwingUtilities; | ||
|
||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
SwingUtilities.invokeLater(new Runnable() { | ||
public void run() { | ||
//rJavaFileChooser fc = new rJavaFileChooser(); | ||
//fc.setMultiSelectionEnabled(true); | ||
//int res = fc.showOpenDialog(null, true); | ||
String [] choice={"one","two","three","four"}; | ||
rJavaListChooser lc= new rJavaListChooser(null,true); | ||
lc.setMultipleSelection(true); | ||
lc.setTitle("test"); | ||
|
||
lc.setSelectionValues(choice); | ||
String [] res=lc.showDialog(); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package rjavautils; | ||
|
||
import java.awt.Container; | ||
import java.awt.EventQueue; | ||
import java.awt.Frame; | ||
import java.awt.HeadlessException; | ||
import java.awt.Toolkit; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.WindowEvent; | ||
import javax.swing.JDialog; | ||
import javax.swing.JFileChooser; | ||
|
||
public class rJavaFileChooser extends JFileChooser | ||
{ | ||
JDialog parent; | ||
int retVal; | ||
|
||
protected void closeDialog() | ||
{ | ||
if (this.parent.isModal()) { | ||
WindowEvent wev = new WindowEvent(this.parent, 201); | ||
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev); | ||
} else { | ||
this.parent.setVisible(false); | ||
} | ||
} | ||
|
||
public int showOpenDialog(Frame owner, boolean Modal) throws HeadlessException | ||
{ | ||
this.retVal = 1; | ||
|
||
this.parent = new JDialog(owner, getDialogTitle(), Modal); | ||
|
||
addActionListener(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
if (e.getActionCommand().equals("ApproveSelection")) { | ||
rJavaFileChooser.this.retVal = 0; | ||
rJavaFileChooser.this.closeDialog(); | ||
} else if (e.getActionCommand().equals("CancelSelection")) { | ||
rJavaFileChooser.this.closeDialog(); | ||
} | ||
} | ||
}); | ||
if (this.parent.isModal()) | ||
this.parent.setDefaultCloseOperation(2); | ||
else { | ||
this.parent.setDefaultCloseOperation(1); | ||
} | ||
|
||
this.parent.getContentPane().add(this); | ||
|
||
this.parent.pack(); | ||
this.parent.setLocationRelativeTo(null); | ||
this.parent.setAlwaysOnTop(true); | ||
this.parent.setVisible(true); | ||
|
||
return this.retVal; | ||
} | ||
|
||
public void dispose() { | ||
this.parent.setDefaultCloseOperation(2); | ||
WindowEvent wev = new WindowEvent(this.parent, 201); | ||
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev); | ||
} | ||
|
||
public boolean isRunning() { | ||
return this.parent.isVisible(); | ||
} | ||
|
||
public boolean selectionApproved() { | ||
return this.retVal == 0; | ||
} | ||
} |
Oops, something went wrong.