IDEMPIERE-4158 Move Swing Client out of core. Move 3 swing client specific method
This commit is contained in:
parent
b3b53a478e
commit
444ade9162
|
@ -16,11 +16,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.util;
|
package org.compiere.util;
|
||||||
|
|
||||||
import java.awt.Container;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.Window;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -43,8 +38,6 @@ import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
import org.adempiere.base.IResourceFinder;
|
import org.adempiere.base.IResourceFinder;
|
||||||
|
@ -1749,67 +1742,7 @@ public final class Env
|
||||||
{
|
{
|
||||||
getCtx().clear();
|
getCtx().clear();
|
||||||
} // clearContext
|
} // clearContext
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Graphics of container or its parent.
|
|
||||||
* The element may not have a Graphic if not displayed yet,
|
|
||||||
* but the parent might have.
|
|
||||||
* @param container Container
|
|
||||||
* @return Graphics of container or null
|
|
||||||
*/
|
|
||||||
public static Graphics getGraphics (Container container)
|
|
||||||
{
|
|
||||||
Container element = container;
|
|
||||||
while (element != null)
|
|
||||||
{
|
|
||||||
Graphics g = element.getGraphics();
|
|
||||||
if (g != null)
|
|
||||||
return g;
|
|
||||||
element = element.getParent();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} // getFrame
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return JDialog or JFrame Parent
|
|
||||||
* @param container Container
|
|
||||||
* @return JDialog or JFrame of container
|
|
||||||
*/
|
|
||||||
public static Window getParent (Container container)
|
|
||||||
{
|
|
||||||
Container element = container;
|
|
||||||
while (element != null)
|
|
||||||
{
|
|
||||||
if (element instanceof JDialog || element instanceof JFrame)
|
|
||||||
return (Window)element;
|
|
||||||
if (element instanceof Window)
|
|
||||||
return (Window)element;
|
|
||||||
element = element.getParent();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} // getParent
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Get Image with File name
|
|
||||||
*
|
|
||||||
* @param fileNameInImageDir full file name in imgaes folder (e.g. Bean16.gif)
|
|
||||||
* @return image
|
|
||||||
*/
|
|
||||||
public static Image getImage (String fileNameInImageDir)
|
|
||||||
{
|
|
||||||
IResourceFinder rf = Core.getResourceFinder();
|
|
||||||
URL url = rf.getResource("images/" + fileNameInImageDir);
|
|
||||||
|
|
||||||
// URL url = Adempiere.class.getResource("images/" + fileNameInImageDir);
|
|
||||||
if (url == null)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, "Not found: " + fileNameInImageDir);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
|
||||||
return tk.getImage(url);
|
|
||||||
} // getImage
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ImageIcon.
|
* Get ImageIcon.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue