| java.lang.Object it.businesslogic.ireport.util.Misc
Misc | public class Misc (Code) | | author: Administrator |
Constructor Summary | |
public | Misc() |
Method Summary | |
public static void | addProperties(String resourceUri, java.util.Properties props) Add the properties in resourceUri to props. | public static void | centerFrame(java.awt.Component c) | public static String | changeFileExtension(String filename, String newExtension) | public static boolean | dockAt(Dockable toDock, String side, int index) side can be:
DockingConstants.NOTRH_REGION
DockingConstants.EAST_REGION
DockingConstants.SOUTH_REGION
DockingConstants.WEST_REGION
index is the position into a side
i.e. | public static void | ensurePathIsSelected(TreePath treePath, JTree jTree) If treePath is not in the current jTree selection, set it as selected. | public static DefaultMutableTreeNode | findNodeWithUserObject(Object userObject, javax.swing.tree.TreeNode node) | public static java.awt.Frame | frameFromComponent(java.awt.Component parent) Method used to grab the Frame which is above this component in the hierarchy. | public static java.util.List | getAvailablePLAF() | public static String | getClassPath() | public static Object | getComboboxSelectedValue(JComboBox combo) If the selected value is a Tag, tag.getValue is returned,
otherwise the selected item itself is returned. | public static java.sql.Connection | getConnection(String name) | public static net.sf.jasperreports.engine.JRDataSource | getJRDataSource(String name) | public static String | getJRFieldType(String type) Return the correct field type... | public static String | getJdbcTypeClass(java.sql.ResultSetMetaData rsmd, int t) | public static long | getLastWriteTime(String filename) | public static java.util.Locale | getLocaleFromString(String localeName) | public static java.util.Locale | getLocaleFromString(String localeName, Locale defaultLocale) | public static int | getMaxBandHeight(Report report, Band band) | public static SubDataset | getObjectSubDataset(SubDataset report, Object object) Look for the SubDataset of an Object in the given report / subDataset. | public static Set | getResoucesInPackage(String packageName) Enumerates the resouces in a give package name. | public static String | getResourceContent(String resourceUri) Get the content of a text resource file... | public static String | getShortFileName(String filename) | public static boolean | isValidUrl(String url) | public static java.awt.image.BufferedImage | loadBufferedImageFromResources(Component c, String filename) | public static String | loadExpression() | public static String | loadExpression(Component c) Load the query asking for a file. | public static Vector | loadExpressionsList(String xmlFile) Read the expressions list from the specified file... | public static java.awt.Image | loadImageFromFile(String path) | public static java.awt.Image | loadImageFromResources(String filename) | public static String | loadSQLQuery() | public static String | loadSQLQuery(Component c) Load the query asking for a file. | public static Vector | loadStyleLibrary(String fileName) | public static Vector | loadStyleLibrary(InputStream is, String filename) | public static String | nvl(Object obj, String def) | public static void | openURL(String url) | public static void | optime(String opName) This function is used for debug porpuses. | public static it.businesslogic.ireport.Style | readStyle(Node styleNode, ConditionedStyle cStyle) | public static String | replaceTabWithBlank(String source) | public static boolean | saveExpression(String expression) Save the expression asking for a file. | public static boolean | saveExpression(String expression, Component c) Save the query asking for a file. | public static boolean | saveExpressionsList(Vector v, String xmlFile) Save the expressions list to the specified file... | public static boolean | saveSQLQuery(String query) Save the query asking for a file. | public static boolean | saveSQLQuery(String query, Component c) Save the query asking for a file. | public static void | saveStyleLibrary(String filename, Vector styles) | public static void | saveTemporaryLocale(java.util.Properties properties, String fileName) | public static void | selectTextAndFocusArea(JComponent expArea) This method select the whole text inside a textarea and set there the focus. | public static void | setComboboxSelectedTagValue(javax.swing.JComboBox comboBox, String itemValue) | public static void | setPLAF(String s) | public static String | string_replace(String s1, String s2, String s3) | public static String | toHTML(String s) | public static String | treatNewLineChars(String source) This method inserts a blank character between to consecutive
newline characters if encoutered. | public static void | updateComboBox(javax.swing.JComboBox comboBox, Vector newItems) | public static void | updateComboBox(javax.swing.JComboBox comboBox, Vector newItems, boolean addNullEntry) | public static void | updateStringComboBox(javax.swing.JComboBox comboBox, Vector newItems, boolean addNullEntry) | public static String | xmlEscape(String text) |
special_chars | final public static String[] special_chars(Code) | | |
Misc | public Misc()(Code) | | Creates a new instance of Misc
|
addProperties | public static void addProperties(String resourceUri, java.util.Properties props)(Code) | | Add the properties in resourceUri to props.
If resourceUri does not exists, nothing happen.
|
changeFileExtension | public static String changeFileExtension(String filename, String newExtension)(Code) | | Take a filename, strip out the extension and append the new extension
newExtension = ".xyz" or "xyz"
If filename is null, ".xyz" is returned
|
dockAt | public static boolean dockAt(Dockable toDock, String side, int index)(Code) | | side can be:
DockingConstants.NOTRH_REGION
DockingConstants.EAST_REGION
DockingConstants.SOUTH_REGION
DockingConstants.WEST_REGION
index is the position into a side
i.e.
dockAt( dockable, DockingConstants.WEST_REGION, 0) means the top left position
|
ensurePathIsSelected | public static void ensurePathIsSelected(TreePath treePath, JTree jTree)(Code) | | If treePath is not in the current jTree selection, set it as selected.
|
frameFromComponent | public static java.awt.Frame frameFromComponent(java.awt.Component parent)(Code) | | Method used to grab the Frame which is above this component in the hierarchy.
This allows programmers to make any component the parent of any window or
dialog easier.
Parameters: comp - the component to get the Frame for the Frame above this component in the hierarchy |
getComboboxSelectedValue | public static Object getComboboxSelectedValue(JComboBox combo)(Code) | | If the selected value is a Tag, tag.getValue is returned,
otherwise the selected item itself is returned.
If not item is selected, the method return null.
|
getConnection | public static java.sql.Connection getConnection(String name)(Code) | | Return the named connection configured in iReport
Return a java.sql.Connection;
|
getJRDataSource | public static net.sf.jasperreports.engine.JRDataSource getJRDataSource(String name)(Code) | | Return the named connection configured in iReport
Return a net.sf.jasperreports.engine.getJRDataSource
|
getJRFieldType | public static String getJRFieldType(String type)(Code) | | Return the correct field type...
|
getLastWriteTime | public static long getLastWriteTime(String filename)(Code) | | |
getLocaleFromString | public static java.util.Locale getLocaleFromString(String localeName)(Code) | | Take a string like _it_IT or it_IT or it
and return the right locale
Default return value is Locale.getDefault()
|
getLocaleFromString | public static java.util.Locale getLocaleFromString(String localeName, Locale defaultLocale)(Code) | | Take a string like _it_IT or it_IT or it
and return the right locale
|
getMaxBandHeight | public static int getMaxBandHeight(Report report, Band band)(Code) | | |
getObjectSubDataset | public static SubDataset getObjectSubDataset(SubDataset report, Object object)(Code) | | Look for the SubDataset of an Object in the given report / subDataset.
If the subDataset is a report, it looks recursively in each subdataset...
Parameters: report - Report or SubDataset to look in Parameters: object - Object to search for (Parameter, Field, Variable) a subdataset or null if the object is not found |
getResoucesInPackage | public static Set getResoucesInPackage(String packageName) throws IOException(Code) | | Enumerates the resouces in a give package name.
This works even if the resources are loaded from a jar file!
Adapted from code by mikewse
on the java.sun.com message boards.
http://forum.java.sun.com/thread.jsp?forum=22&thread=30984
Parameters: packageName - The package to enumerate A Set of Strings for each resouce in the package. |
getResourceContent | public static String getResourceContent(String resourceUri)(Code) | | Get the content of a text resource file...
|
isValidUrl | public static boolean isValidUrl(String url)(Code) | | This method validates URL like:
123.123.123[:port]
domain.domain.dom[:port]
|
loadExpression | public static String loadExpression()(Code) | | See loadSQLQuery(Component c)
|
loadExpression | public static String loadExpression(Component c)(Code) | | Load the query asking for a file.
The optional component is used as parent for the file selection dialog
Default is the MainFrame
|
loadExpressionsList | public static Vector loadExpressionsList(String xmlFile)(Code) | | Read the expressions list from the specified file...
|
loadSQLQuery | public static String loadSQLQuery()(Code) | | See loadSQLQuery(Component c)
|
loadSQLQuery | public static String loadSQLQuery(Component c)(Code) | | Load the query asking for a file.
The optional component is used as parent for the file selection dialog
Default is the MainFrame
|
openURL | public static void openURL(String url)(Code) | | This method uses the code from: http://www.centerkey.com/java/browser/
Bare Bones Browser Launch
Version 1.5
December 10, 2005
Supports: Mac OS X, GNU/Linux, Unix, Windows XP
Example Usage:
String url = "http://www.centerkey.com/";
BareBonesBrowserLaunch.openURL(url);
Public Domain Software -- Free to Use as You Like
|
optime | public static void optime(String opName)(Code) | | This function is used for debug porpuses. It is used to misure the time
of an operation.
Sample usage:
....some code
Misc.optime("My operation"); // Start the timer
....block to measure....
Misc.optime("My operation"); // Stop the timer
Result on video:
My operation START (1)
My operation END (1) 20ms
|
replaceTabWithBlank | public static String replaceTabWithBlank(String source)(Code) | | Thanks to Teodor Danciu for this method (c) 2003 Teodor Danciu
|
saveExpression | public static boolean saveExpression(String expression)(Code) | | Save the expression asking for a file.
see saveSQLQuery(String query, Component c)
|
saveExpression | public static boolean saveExpression(String expression, Component c)(Code) | | Save the query asking for a file.
The optional component is used as parent for the file selection dialog
Default is the MainFrame
|
saveExpressionsList | public static boolean saveExpressionsList(Vector v, String xmlFile)(Code) | | Save the expressions list to the specified file...
|
saveSQLQuery | public static boolean saveSQLQuery(String query)(Code) | | Save the query asking for a file.
see saveSQLQuery(String query, Component c)
|
saveSQLQuery | public static boolean saveSQLQuery(String query, Component c)(Code) | | Save the query asking for a file.
The optional component is used as parent for the file selection dialog
Default is the MainFrame
|
saveTemporaryLocale | public static void saveTemporaryLocale(java.util.Properties properties, String fileName)(Code) | | Creates fileName inside /classes/it/businesslogic/ireport/locale
and stores there the properties keys
|
selectTextAndFocusArea | public static void selectTextAndFocusArea(JComponent expArea)(Code) | | This method select the whole text inside a textarea and set there the focus.
It should be used to select a component that contains a wrong expression.
In the future other properties of the componenct can be modified
|
treatNewLineChars | public static String treatNewLineChars(String source)(Code) | | This method inserts a blank character between to consecutive
newline characters if encoutered. Also appends a blank character at
the beginning of the text, if the first character is a newline character
and at the end of the text, if the last character is also a newline.
This is useful when trying to layout the paragraphs.
Thanks to Teodor Danciu for this this method (c) 2003 Teodor Danciu
|
updateStringComboBox | public static void updateStringComboBox(javax.swing.JComboBox comboBox, Vector newItems, boolean addNullEntry)(Code) | | Mthis method perform equals based on string rapresentation of objects
|
|
|