- Use logging level FINE across SDK Core
- Allow setting logging level in Application output

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10281 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 2e95df2ed8
commit f44f182e62
  1. 4
      sdk/jme3-core/src/com/jme3/gde/core/assets/AssetData.java
  2. 7
      sdk/jme3-core/src/com/jme3/gde/core/assets/AssetsLookupProvider.java
  3. 8
      sdk/jme3-core/src/com/jme3/gde/core/assets/ProjectAssetManager.java
  4. 4
      sdk/jme3-core/src/com/jme3/gde/core/assets/SpatialAssetDataObject.java
  5. 27
      sdk/jme3-core/src/com/jme3/gde/core/filters/FilterExplorerTopComponent.java
  6. 49
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/ProjectExtensionManager.java
  7. 41
      sdk/jme3-core/src/com/jme3/gde/core/scene/ApplicationLogHandler.java
  8. 33
      sdk/jme3-core/src/com/jme3/gde/core/scene/OffScenePanel.java
  9. 45
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/SceneExplorerTopComponent.java
  10. 9
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainGrid.java
  11. 3
      sdk/jme3-core/src/com/jme3/gde/core/util/ZipExtensionTool.java
  12. 2
      sdk/jme3-core/src/com/jme3/gde/core/util/notify/NotifyUtil.java

@ -191,7 +191,7 @@ public class AssetData {
Exceptions.printStackTrace(ex);
}
}
logger.log(Level.INFO, "Read AssetData properties for {0}", file);
logger.log(Level.FINE, "Read AssetData properties for {0}", file);
}
}
});
@ -215,7 +215,7 @@ public class AssetData {
props.store(out, "");
out.flush();
lastLoaded = myFile.lastModified();
logger.log(Level.INFO, "Written AssetData properties for {0}", file);
logger.log(Level.FINE, "Written AssetData properties for {0}", file);
} catch (IOException e) {
Exceptions.printStackTrace(e);
} finally {

@ -60,6 +60,7 @@ import org.openide.util.lookup.Lookups;
*/
public class AssetsLookupProvider implements LookupProvider {
private static final Logger logger = Logger.getLogger(AssetsLookupProvider.class.getName());
private Project project;
public static final String[] keyList = new String[]{
"assets.jar.name",
@ -103,7 +104,7 @@ public class AssetsLookupProvider implements LookupProvider {
in.close();
String assetsFolderName = properties.getProperty("assets.folder.name", "assets");
if (prj.getProjectDirectory().getFileObject(assetsFolderName) != null) {
Logger.getLogger(AssetsLookupProvider.class.getName()).log(Level.INFO, "Valid jMP project, extending with ProjectAssetManager");
logger.log(Level.FINE, "Valid jMP project, extending with ProjectAssetManager");
return Lookups.fixed(new ProjectAssetManager(prj, assetsFolderName), openedHook);
}
} catch (Exception ex) {
@ -118,7 +119,6 @@ public class AssetsLookupProvider implements LookupProvider {
return Lookups.fixed();
}
private ProjectOpenedHook openedHook = new ProjectOpenedHook() {
@Override
protected void projectClosed() {
}
@ -143,7 +143,7 @@ public class AssetsLookupProvider implements LookupProvider {
//old properties files
FileObject oldProperties = projDir.getFileObject("nbproject/assets.properties");
if (oldProperties != null) {
Logger.getLogger(AssetsLookupProvider.class.getName()).log(Level.INFO, "Deleting old project assets.properties");
logger.log(Level.FINE, "Deleting old project assets.properties");
try {
props.load(oldProperties.getInputStream());
store(props, project);
@ -193,7 +193,6 @@ public class AssetsLookupProvider implements LookupProvider {
final InputStream is = projPropsFO.getInputStream();
// final InputStream pis = privPropsFO.getInputStream();
ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
@Override
public Void run() throws Exception {
try {

@ -115,7 +115,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
this.project = new DummyProject(this, path);
}
String projectRootPath = project.getProjectDirectory().getPath();
logger.log(Level.INFO, "Add locator: {0}", projectRootPath);
logger.log(Level.FINE, "Add locator: {0}", projectRootPath);
registerLocator(projectRootPath, com.jme3.gde.core.assets.RootLockingFileLocator.class);
for (AssetManagerConfigurator di : Lookup.getDefault().lookupAll(AssetManagerConfigurator.class)) {
di.prepareManager(this);
@ -131,7 +131,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
if (jarItems.isEmpty() && classPathItems.isEmpty()) {
return;
}
logger.log(Level.INFO, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
logger.log(Level.FINE, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
for (FileObject fileObject : jarItems) {
logger.log(Level.FINE, "Remove locator:{0}", fileObject.toURL());
unregisterLocator(fileObject.toURL().toExternalForm(),
@ -181,7 +181,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
}
loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
addClassLoader(loader);
logger.log(Level.INFO, "Updated {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
logger.log(Level.FINE, "Updated {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
}
}
FileChangeListener listener = new FileChangeListener() {
@ -370,7 +370,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
*/
public void addFolderLocator(String relativePath) {
String string = project.getProjectDirectory().getPath() + "/" + relativePath + "/";
logger.log(Level.INFO, "Add locator:{0}", string);
logger.log(Level.FINE, "Add locator:{0}", string);
registerLocator(string,
"com.jme3.asset.plugins.FileLocator");
folderNames.add(relativePath);

@ -162,7 +162,7 @@ public class SpatialAssetDataObject extends AssetDataObject {
geomName = "null";
}
geom.setUserData("ORIGINAL_NAME", geomName);
logger.log(Level.INFO, "Set ORIGINAL_NAME for {0}", geomName);
logger.log(Level.FINE, "Set ORIGINAL_NAME for {0}", geomName);
while (curSpat != null) {
String name = curSpat.getName();
if (name == null) {
@ -179,7 +179,7 @@ public class SpatialAssetDataObject extends AssetDataObject {
}
geomMap.add(id);
geom.setUserData("ORIGINAL_PATH", id);
logger.log(Level.INFO, "Set ORIGINAL_PATH for {0}", id);
logger.log(Level.FINE, "Set ORIGINAL_PATH for {0}", id);
super.visit(geom);
}
});

@ -70,6 +70,7 @@ preferredID = "FilterExplorerTopComponent")
@SuppressWarnings("unchecked")
public final class FilterExplorerTopComponent extends TopComponent implements ExplorerManager.Provider {
private static final Logger logger = Logger.getLogger(FilterExplorerTopComponent.class.getName());
private static FilterExplorerTopComponent instance;
private static final String PREFERRED_ID = "FilterExplorerTopComponent";
private transient ExplorerManager explorerManager = new ExplorerManager();
@ -89,10 +90,10 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@ -153,7 +154,7 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
public HelpCtx getHelpCtx() {
return new HelpCtx("sdk.filters");
}
public void loadFile(FilterDataObject object) {
currentFile = object;
node = object.getLookup().lookup(FilterPostProcessorNode.class);
@ -182,10 +183,9 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
clearFilters();
if (filterEnabled && fpp != null) {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
SceneApplication.getApplication().getViewPort().addProcessor(fpp);
Logger.getLogger(FilterExplorerTopComponent.class.getName()).log(Level.INFO, "Enabled post filters");
logger.log(Level.FINE, "Enabled post filters");
return null;
}
});
@ -194,7 +194,6 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
private synchronized void clearFilters() {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
for (Iterator<SceneProcessor> it = SceneApplication.getApplication().getViewPort().getProcessors().iterator(); it.hasNext();) {
SceneProcessor proc = it.next();
@ -202,7 +201,7 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
it.remove();
proc.cleanup();
}
Logger.getLogger(FilterExplorerTopComponent.class.getName()).log(Level.INFO, "Disabled post filters");
logger.log(Level.FINE, "Disabled post filters");
}
return null;
}
@ -210,9 +209,10 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
}
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
* To obtain the singleton instance, use {@link #findInstance}.
* Gets default instance. Do not use directly: reserved for *.settings files
* only, i.e. deserialization routines; otherwise you could get a
* non-deserialized instance. To obtain the singleton instance, use
* {@link #findInstance}.
*/
public static synchronized FilterExplorerTopComponent getDefault() {
if (instance == null) {
@ -222,7 +222,8 @@ public final class FilterExplorerTopComponent extends TopComponent implements Ex
}
/**
* Obtain the SceneExplorerTopComponent instance. Never call {@link #getDefault} directly!
* Obtain the SceneExplorerTopComponent instance. Never call
* {@link #getDefault} directly!
*/
public static synchronized FilterExplorerTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);

@ -64,6 +64,7 @@ import org.openide.util.Exceptions;
* @author normenhansen
*/
public class ProjectExtensionManager {
private static final Logger logger = Logger.getLogger(ProjectExtensionManager.class.getName());
private String extensionName;
private String extensionVersion;
@ -124,16 +125,16 @@ public class ProjectExtensionManager {
* @param proj
*/
public void checkExtension(Project proj) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Checking extension..");
logger.log(Level.FINE, "Checking extension..");
if (!(proj instanceof J2SEProject)) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "Trying to load Assets Properties from non-asset project");
logger.log(Level.WARNING, "Trying to load Assets Properties from non-asset project");
return;
}
FileObject projDir = proj.getProjectDirectory();
final FileObject buildXmlFO = J2SEProjectUtil.getBuildXml((J2SEProject) proj);
if (buildXmlFO == null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "The project build script does not exist, the project cannot be extended by jMP.");
logger.log(Level.WARNING, "The project build script does not exist, the project cannot be extended by jMP.");
return;
}
FileObject assetsBuildFile = getImplFile(projDir, true);
@ -141,7 +142,7 @@ public class ProjectExtensionManager {
if (extender != null) {
assert assetsBuildFile != null;
if (extender.getExtension(extensionName) == null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Creating extension {0}", extensionName);
logger.log(Level.FINE, "Creating extension {0}", extensionName);
AntBuildExtender.Extension ext = extender.addExtension(extensionName, assetsBuildFile);
if (extensionDependencies != null) {
for (int i = 0; i < extensionDependencies.length; i += 2) {
@ -163,7 +164,7 @@ public class ProjectExtensionManager {
}
}
} else {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "Trying to include assets build snippet in project type that doesn't support AntBuildExtender API contract.");
logger.log(Level.WARNING, "Trying to include assets build snippet in project type that doesn't support AntBuildExtender API contract.");
}
}
@ -174,28 +175,28 @@ public class ProjectExtensionManager {
*/
public void removeExtension(Project proj) {
if (!(proj instanceof J2SEProject)) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "Trying to load Assets Properties from non-asset project");
logger.log(Level.WARNING, "Trying to load Assets Properties from non-asset project");
return;
}
FileObject projDir = proj.getProjectDirectory();
final FileObject buildXmlFO = J2SEProjectUtil.getBuildXml((J2SEProject) proj);
if (buildXmlFO == null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "The project build script does not exist, the project cannot be extended by jMP.");
logger.log(Level.WARNING, "The project build script does not exist, the project cannot be extended by jMP.");
return;
}
AntBuildExtender extender = proj.getLookup().lookup(AntBuildExtender.class);
if (extender != null) {
if (extender.getExtension(extensionName) != null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Removing extension {0}", extensionName);
logger.log(Level.FINE, "Removing extension {0}", extensionName);
extender.removeExtension(extensionName);
try {
FileObject assetsBuildFile = getImplFile(projDir, false);
if (assetsBuildFile != null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Deleting {0}", assetsBuildFile.getNameExt());
logger.log(Level.FINE, "Deleting {0}", assetsBuildFile.getNameExt());
assetsBuildFile.delete();
}
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Saving project {0}", proj.getProjectDirectory().getName());
logger.log(Level.FINE, "Saving project {0}", proj.getProjectDirectory().getName());
// ProjectManager.getDefault().saveProject(proj);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
@ -208,7 +209,7 @@ public class ProjectExtensionManager {
}
}
} else {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.WARNING, "Trying to include assets build snippet in project type that doesn't support AntBuildExtender API contract.");
logger.log(Level.WARNING, "Trying to include assets build snippet in project type that doesn't support AntBuildExtender API contract.");
}
}
@ -353,20 +354,20 @@ public class ProjectExtensionManager {
private FileObject getImplFile(FileObject projDir, boolean create) {
FileObject assetsImpl = projDir.getFileObject("nbproject/" + extensionName + "-impl.xml");
if (assetsImpl == null) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "No extension file {0}-impl.xml found", extensionName);
logger.log(Level.FINE, "No extension file {0}-impl.xml found", extensionName);
if (create) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Creating extension file {0}-impl.xml", extensionName);
logger.log(Level.FINE, "Creating extension file {0}-impl.xml", extensionName);
assetsImpl = createImplFile(projDir);
}
} else {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Found extension file {0}-impl.xml", extensionName);
logger.log(Level.FINE, "Found extension file {0}-impl.xml", extensionName);
try {
if (create && !assetsImpl.asLines().get(1).startsWith("<!--" + extensionName + "-impl.xml " + extensionVersion + "-->")) {
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Updating extension file {0}-impl.xml", extensionName);
logger.log(Level.FINE, "Updating extension file {0}-impl.xml", extensionName);
assetsImpl.delete();
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Deleted extension file {0}-impl.xml", extensionName);
logger.log(Level.FINE, "Deleted extension file {0}-impl.xml", extensionName);
assetsImpl = createImplFile(projDir);
Logger.getLogger(ProjectExtensionManager.class.getName()).log(Level.INFO, "Recreated extension file {0}-impl.xml", extensionName);
logger.log(Level.FINE, "Recreated extension file {0}-impl.xml", extensionName);
}
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
@ -447,7 +448,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo != null && entry.getSize() != -1 && entry.getSize() == fo.getSize()) {
logger.log(Level.INFO, "Deleting old folder {0}", fo.getNameExt());
logger.log(Level.FINE, "Deleting old folder {0}", fo.getNameExt());
fo.delete();
}
FileUtil.createFolder(projectRoot, fileName);
@ -455,7 +456,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo != null && !fo.equals(projectRoot)) {
logger.log(Level.INFO, "Deleting old file {0}", fo.getNameExt());
logger.log(Level.FINE, "Deleting old file {0}", fo.getNameExt());
fo.delete();
}
fo = projectRoot.getFileObject(fileName);
@ -463,7 +464,7 @@ public class ProjectExtensionManager {
fo = FileUtil.createData(projectRoot, fileName);
writeFile(str, fo);
} else {
logger.log(Level.INFO, "Not overwriting existing file {0}", fo.getNameExt());
logger.log(Level.FINE, "Not overwriting existing file {0}", fo.getNameExt());
}
}
}
@ -485,7 +486,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here
FileObject old = projectRoot.getFileObject(entry.getName());
if (old != null && !old.equals(projectRoot)) {
logger.log(Level.INFO, "Deleting old file {0}", old.getNameExt());
logger.log(Level.FINE, "Deleting old file {0}", old.getNameExt());
if (entry.getSize() != -1 && entry.getSize() == old.getSize()) {
old.delete();
}
@ -494,11 +495,11 @@ public class ProjectExtensionManager {
FileObject obj = projectRoot.getFileObject(fileName);
if (obj != null && !obj.equals(projectRoot) && !obj.isFolder()) {
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) {
logger.log(Level.INFO, "Deleting file {0}", obj.getNameExt());
logger.log(Level.FINE, "Deleting file {0}", obj.getNameExt());
obj.delete();
} else {
kept = true;
logger.log(Level.INFO, "Keeping file {0}", obj.getNameExt());
logger.log(Level.FINE, "Keeping file {0}", obj.getNameExt());
}
}
}
@ -518,7 +519,7 @@ public class ProjectExtensionManager {
private void writeFile(ZipInputStream str, FileObject fo) throws IOException {
OutputStream out = fo.getOutputStream();
try {
logger.log(Level.INFO, "Creating file " + fo.getNameExt());
logger.log(Level.FINE, "Creating file " + fo.getNameExt());
FileUtil.copy(str, out);
} finally {
out.close();

@ -31,6 +31,7 @@
*/
package com.jme3.gde.core.scene;
import com.jme3.gde.core.icons.IconList;
import com.jme3.gde.core.util.notify.MessageType;
import com.jme3.gde.core.util.notify.NotifyUtil;
import com.jme3.util.JmeFormatter;
@ -40,6 +41,9 @@ import java.util.concurrent.Callable;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
@ -50,26 +54,57 @@ import org.openide.windows.InputOutput;
*/
public class ApplicationLogHandler extends Handler implements Callable<JButton> {
private static final Logger logger = Logger.getLogger(ApplicationLogHandler.class.getName());
public static class LogLevel extends Level {
/**
* Log level of 801 (one above "INFO") - used to display messages
* to the user via the little "monkey bubble" bottom right.
* Log level of 801 (one above "INFO") - used to display messages to the
* user via the little "monkey bubble" bottom right.
*/
public static final Level USERINFO = new LogLevel("User Info", 801, "User Info Log Level");
public LogLevel(String name, int level, String string) {
super(name, level, string);
}
}
InputOutput io = IOProvider.getDefault().getIO("Application", true);
InputOutput io;
JmeFormatter formatter = new JmeFormatter();
ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
io.select();
}
};
Action levelFine = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Logger.getLogger("com.jme3").setLevel(Level.FINE);
NotifyUtil.info("Changed logging level", "Changed logging level to FINE");
}
};
Action levelInfo = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Logger.getLogger("com.jme3").setLevel(Level.INFO);
NotifyUtil.info("Changed logging level", "Changed logging level to INFO");
}
};
Action levelWarning = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Logger.getLogger("com.jme3").setLevel(Level.WARNING);
NotifyUtil.info("Changed logging level", "Changed logging level to WARNING");
}
};
public ApplicationLogHandler() {
levelFine.putValue(Action.SMALL_ICON, IconList.chimpConfused);
levelInfo.putValue(Action.SMALL_ICON, IconList.chimpSmile);
levelWarning.putValue(Action.SMALL_ICON, IconList.chimpNogood);
levelFine.putValue(Action.NAME, "Fine");
levelInfo.putValue(Action.NAME, "Normal");
levelWarning.putValue(Action.NAME, "Warning");
levelFine.putValue(Action.SHORT_DESCRIPTION, "Set Fine Logging Level");
levelInfo.putValue(Action.SHORT_DESCRIPTION, "Set Normal Logging Level");
levelWarning.putValue(Action.SHORT_DESCRIPTION, "Set Warning Logging Level");
io = IOProvider.getDefault().getIO("Application", new Action[]{levelFine, levelInfo, levelWarning});
io.setErrSeparated(true);
}

@ -70,6 +70,7 @@ import java.util.logging.Logger;
*/
public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor {
private static final Logger logger = Logger.getLogger(OffScenePanel.class.getName());
private int width = 640, height = 480;
private ByteBuffer cpuBuf;
// private byte[] cpuArray;
@ -93,7 +94,9 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
this(640, 480);
}
/** Creates new form ScenePanel */
/**
* Creates new form ScenePanel
*/
public OffScenePanel(int width, int height) {
this.width = width;
this.height = height;
@ -103,7 +106,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void resizeGLView(final int x, final int y) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
width = x;
height = y;
@ -116,7 +118,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
}
});
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Dimension dim = new Dimension(x, y);
setPreferredSize(dim);
@ -135,7 +136,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
// }
// });
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
setupOffView();
setupOffBuffer();
@ -148,13 +148,12 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void stopPreview() {
//TODO add your handling code here:
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
SceneApplication.getApplication().getRenderManager().removePreView(viewPort);
return null;
}
});
Logger.getLogger(OffScenePanel.class.getName()).log(Level.INFO, "Component hidden");
logger.log(Level.FINE, "Component hidden");
}
private void setupScene() {
@ -163,7 +162,7 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
light.setColor(ColorRGBA.White);
rootNode.addLight(light);
}
private void attachScene() {
// attach the scene to the viewport to be rendered
//setup framebuffer's cam
@ -281,11 +280,11 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
/**
* threadsafe attach to root node
*
* @param spat
*/
public void attach(final Spatial spat) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
rootNode.attachChild(spat);
return null;
@ -295,11 +294,11 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
/**
* threadsafe detach from root node
*
* @param spat
*/
public void detach(final Spatial spat) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
rootNode.detachChild(spat);
return null;
@ -309,11 +308,11 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
/**
* threadsafe detach from root node
*
* @param spat
*/
public void detachAll() {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
rootNode.detachAllChildren();
return null;
@ -323,7 +322,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void setCamFocus(final Vector3f focus) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
doSetCamFocus(focus);
return null;
@ -334,7 +332,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void doSetCamFocus(final Vector3f focus_) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
focus.set(focus_);
camera.setLocation(focus_.add(vector, camera.getLocation()));
@ -348,7 +345,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
*/
public void rotateCamera(final Vector3f axis, final float amount_) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
float amount = amount_;
if (axis.equals(camera.getLeft())) {
@ -371,7 +367,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void panCamera(final float left, final float up) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
camera.getLeft().mult(left, vector);
vector.scaleAdd(up, camera.getUp(), vector);
@ -385,7 +380,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void moveCamera(final float forward) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
camera.getDirection().mult(forward, vector);
camera.setLocation(camera.getLocation().add(vector));
@ -396,7 +390,6 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
public void zoomCamera(final float amount_) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
float amount = amount_;
amount = camera.getLocation().distance(focus) * amount;
@ -410,10 +403,10 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor
});
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents

@ -73,10 +73,9 @@ import org.openide.windows.WindowManager;
autostore = false)
public final class SceneExplorerTopComponent extends TopComponent implements ExplorerManager.Provider, SceneListener/*, LookupListener */ {
private static final Logger logger = Logger.getLogger(SceneExplorerTopComponent.class.getName());
private static SceneExplorerTopComponent instance;
/** path to the icon used by the component and its open action */
private static final String PREFERRED_ID = "SceneExplorerTopComponent";
private SceneRequest request;
// private final Result<AbstractSceneExplorerNode> nodeSelectionResult;
private AbstractSceneExplorerNode selectedSpatial;
private AbstractSceneExplorerNode lastSelected;
@ -105,10 +104,10 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
getActionMap().put(delete.getActionMapKey(), ExplorerUtils.actionDelete(explorerManager, true));
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@ -160,9 +159,10 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
// End of variables declaration//GEN-END:variables
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
* To obtain the singleton instance, use {@link #findInstance}.
* Gets default instance. Do not use directly: reserved for *.settings files
* only, i.e. deserialization routines; otherwise you could get a
* non-deserialized instance. To obtain the singleton instance, use
* {@link #findInstance}.
*/
public static synchronized SceneExplorerTopComponent getDefault() {
if (instance == null) {
@ -172,19 +172,20 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
/**
* Obtain the SceneExplorerTopComponent instance. Never call {@link #getDefault} directly!
* Obtain the SceneExplorerTopComponent instance. Never call
* {@link #getDefault} directly!
*/
public static synchronized SceneExplorerTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
if (win == null) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).warning(
logger.warning(
"Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
return getDefault();
}
if (win instanceof SceneExplorerTopComponent) {
return (SceneExplorerTopComponent) win;
}
Logger.getLogger(SceneExplorerTopComponent.class.getName()).warning(
logger.warning(
"There seem to be multiple components with the '" + PREFERRED_ID
+ "' ID. That is a potential source of errors and unexpected behavior.");
return getDefault();
@ -279,17 +280,16 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
// selectedSpatial = null;
// }
public void sceneOpened(SceneRequest request) {
this.request = request;
final JmeNode node = request.getJmeNode();
for (Iterator it = materialChangeProviders.values().iterator(); it.hasNext();) {
MaterialChangeProvider provider = (MaterialChangeProvider) it.next();
provider.clearMaterialChangeListeners();
}
if (node != null) {
explorerManager.setRootContext(node);
explorerManager.getRootContext().setDisplayName(node.getName());
setActivatedNodes(new Node[]{node});
requestVisible();
explorerManager.setRootContext(node);
explorerManager.getRootContext().setDisplayName(node.getName());
setActivatedNodes(new Node[]{node});
requestVisible();
try {
explorerManager.setSelectedNodes(new Node[]{node});
} catch (PropertyVetoException ex) {
@ -300,7 +300,6 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
public void sceneClosed(SceneRequest request) {
this.request = null;
explorerManager.setRootContext(Node.EMPTY);
}
@ -315,7 +314,7 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
public void addMaterialChangeProvider(MaterialChangeProvider provider) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).log(Level.INFO, "New materail provider registered for: {0}", provider.getKey());
logger.log(Level.FINE, "New materail provider registered for: {0}", provider.getKey());
materialChangeProviders.put(provider.getKey(), provider);
List<MaterialChangeListener> listeners = materialChangeListeners.get(provider.getKey());
if (listeners == null) {
@ -325,14 +324,14 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
public void removeMaterialChangeProvider(MaterialChangeProvider provider) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).log(Level.INFO, "Removing material provider for : {0}", provider.getKey());
logger.log(Level.FINE, "Removing material provider for : {0}", provider.getKey());
materialChangeProviders.remove(provider.getKey());
}
public void addMaterialChangeListener(MaterialChangeListener listener) {
if (listener.getKey() != null) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).log(Level.INFO, "New material listener for : {0}", listener.getKey());
logger.log(Level.FINE, "New material listener for : {0}", listener.getKey());
List<MaterialChangeListener> listeners = materialChangeListeners.get(listener.getKey());
if (listeners == null) {
listeners = new ArrayList<MaterialChangeListener>();
@ -348,7 +347,7 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
public void removeMaterialChangeListener(MaterialChangeListener listener) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).log(Level.INFO, "Removing material listener for: {0}", listener.getKey());
logger.log(Level.FINE, "Removing material listener for: {0}", listener.getKey());
List<MaterialChangeListener> listeners = materialChangeListeners.get(listener.getKey());
if (listeners == null) {
return;
@ -362,7 +361,7 @@ public final class SceneExplorerTopComponent extends TopComponent implements Exp
}
public void swapMaterialChangeListener(MaterialChangeListener listener, String oldKey, String newKey) {
Logger.getLogger(SceneExplorerTopComponent.class.getName()).log(Level.INFO, "Swaping material listeners : {0} -> {1}", new Object[]{oldKey, newKey});
logger.log(Level.FINE, "Swaping material listeners : {0} -> {1}", new Object[]{oldKey, newKey});
if (oldKey != null) {
List<MaterialChangeListener> listeners = materialChangeListeners.get(oldKey);
if (listeners != null) {

@ -49,6 +49,7 @@ import org.openide.nodes.Sheet;
@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class)
public class JmeTerrainGrid extends JmeTerrainQuad implements TerrainGridListener {
private static final Logger logger = Logger.getLogger(JmeTerrainGrid.class.getName());
private static Image smallImage = IconList.terrain.getImage();
private TerrainGrid geom;
@ -59,7 +60,7 @@ public class JmeTerrainGrid extends JmeTerrainQuad implements TerrainGridListene
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
// setName(spatial.getName());
// setName(spatial.getName());
geom.addListener(this);
}
@ -113,9 +114,8 @@ public class JmeTerrainGrid extends JmeTerrainQuad implements TerrainGridListene
}
public void tileAttached(Vector3f vctrf, TerrainQuad tq) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Calling TerrainGrid update for node: {0}" + this);
logger.log(Level.FINE, "Calling TerrainGrid update for node: {0}" + this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
refresh(false);
}
@ -123,9 +123,8 @@ public class JmeTerrainGrid extends JmeTerrainQuad implements TerrainGridListene
}
public void tileDetached(Vector3f vctrf, TerrainQuad tq) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Calling TerrainGrid update for node: {0}" + this);
logger.log(Level.FINE, "Calling TerrainGrid update for node: {0}" + this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
refresh(false);
}

@ -66,6 +66,7 @@ import org.openide.util.Utilities;
*/
public class ZipExtensionTool {
private static final Logger logger = Logger.getLogger(ZipExtensionTool.class.getName());
static final ConcurrentHashMap<String, Boolean> installMap = new ConcurrentHashMap<String, Boolean>();
static final int BUFFER = 2048;
private final String settingsFolder = System.getProperty("netbeans.user");
@ -309,7 +310,7 @@ public class ZipExtensionTool {
String line;
while ((line = in.readLine()) != null) {
if (line.trim().length() > 0) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, line);
logger.log(Level.FINE, line);
}
}
} catch (Exception e) {

@ -98,7 +98,7 @@ public class NotifyUtil {
* @param message
*/
public static Notification info(String title, String message) {
return error(title, message, true);
return info(title, message, true);
}
/**

Loading…
Cancel
Save