|
From: <tre...@us...> - 2008-02-26 17:33:25
|
Revision: 772
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=772&view=rev
Author: trevorolio
Date: 2008-02-26 09:32:44 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Though it looks like a lot of changes because someone who shall remain named Ian isn't using the standard code formatter, this is just a couple of changes.
Fixed the broken email test which only worked if you had /emailValidated.html in a ROOT webapp on the same machine.
Made the viewer display the scene before your body arrives, which should give people more feedback during the process of loading bodies which now takes too long thanks to attachments and morphs.
Logged when an email address is validated.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2008-02-26 17:03:05 UTC (rev 771)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2008-02-26 17:32:44 UTC (rev 772)
@@ -113,6 +113,8 @@
private J3DDataManager dataManager = null;
+ private BranchGroup tempCameraGroup = new BranchGroup();
+
public J3DRenderer(SpaceClient spaceClient, boolean offScreen) {
this(spaceClient.getSpace(), spaceClient.getUsername(), spaceClient, spaceClient.getTemplateDataProvider(), spaceClient.getBodyDataProvider(), offScreen);
}
@@ -127,6 +129,7 @@
setCapabilities(sceneRoot);
setCapabilities(usersGroup);
setCapabilities(worldGroup);
+ setCapabilities(tempCameraGroup);
GraphicsConfiguration graphicsConfig = getGraphicsConfiguration(offScreen);
if (graphicsConfig == null) {
throw new IllegalStateException("Cannot create a 3D graphics configuration.");
@@ -242,8 +245,15 @@
picker = new J3DPicker(this);
+ float cameraHeight = (float) (2 - 2 / 5);
+ camera.setDefaultLocation(0, 0, 0);
+ camera.setRelativePosition(0, cameraHeight, 3f);
+
+ tempCameraGroup.addChild(camera.getNode());
+
new Thread() {
public void run() {
+ worldGroup.addChild(tempCameraGroup);
getSpace().addListener(new SpaceListener(), true);
completedInitialLoad = true;
}
@@ -713,6 +723,8 @@
boolean isLocalUser = username != null && user.getUsername().equals(username);
if (isLocalUser) {
+ worldGroup.removeChild(tempCameraGroup);
+ tempCameraGroup.removeAllChildren();
float cameraHeight = (float) (renderable.getHeight() - renderable.getHeight() / 5);
camera.setDefaultLocation(0, 0, 0);
camera.setRelativePosition(0, cameraHeight, 3f);
@@ -743,6 +755,8 @@
}
public void setSimCamera() {
+ worldGroup.removeChild(tempCameraGroup);
+ tempCameraGroup.removeAllChildren();
BranchGroup cameraBranch = new BranchGroup();
camera.setRelativePosition(0f, 2f, 2f);
cameraBranch.addChild(camera.getNode());
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2008-02-26 17:03:05 UTC (rev 771)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2008-02-26 17:32:44 UTC (rev 772)
@@ -224,10 +224,10 @@
String emailValidationURL = getLastEmailValidationURL(accountDoc.getEmail());
assertNotNull(emailValidationURL);
try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
+ StreamUtils.discardInput(wire1.performGET(URI.create(emailValidationURL), null, false, true));
+ } catch (IOException e) {
+ //this will happen if you don't have a ROOT webapp with /emailValidated.html in it. Looking the other way.
}
- StreamUtils.discardInput(wire1.performGET(URI.create(emailValidationURL), null, false, false));
accountDoc = adminWebClient.getAccountDocument(username);
assertTrue(accountDoc.isEmailValid());
@@ -407,7 +407,7 @@
checkUserSitting(spaceDocument, thingDocs, spaceClient1, guestSpaceClient1);
checkAttachments(spaceDocument, thingDocs, spaceClient1, advancedClient);
-
+
checkDeletingSpaceDestroysThings(spaceDocument.getSpaceID(), advancedClient, USERNAME1);
} finally {
@@ -422,38 +422,37 @@
}
public void testSimDocumentAndRetirement() throws AuthenticationFailedException, IOException {
- if(true){
+ if (true) {
Log.warn("TEMPORARILY TURNING OFF testSimDocumentAndRetirement TEST AS IT BREAKS SPACE SHUTDOWN");
return;
}
-
+
WebAPIClient adminWebClient = createAdminWebClient();
WebAPIClient stdWebClient = createStandardWebClient();
-
- SimDocument[] sims=adminWebClient.getSimDocuments(false);
+
+ SimDocument[] sims = adminWebClient.getSimDocuments(false);
assertNotNull(sims);
- assertEquals(1,sims.length);
-
- SimDocument simDoc= adminWebClient.getSimDocument(sims[0].getSimID());
- boolean origRetired=simDoc.isRetired();
+ assertEquals(1, sims.length);
+
+ SimDocument simDoc = adminWebClient.getSimDocument(sims[0].getSimID());
+ boolean origRetired = simDoc.isRetired();
boolean origReachable = simDoc.isReachable();
- adminWebClient.setSimRetired(simDoc.getSimID(),!origRetired);
- simDoc=adminWebClient.getSimDocument(sims[0].getSimID());
- assertEquals(simDoc.isRetired(),!origRetired);
- adminWebClient.setSimReachable(simDoc.getSimID(),!origReachable);
- simDoc=adminWebClient.getSimDocument(sims[0].getSimID());
- assertEquals(simDoc.isReachable(),!origReachable);
-
+ adminWebClient.setSimRetired(simDoc.getSimID(), !origRetired);
+ simDoc = adminWebClient.getSimDocument(sims[0].getSimID());
+ assertEquals(simDoc.isRetired(), !origRetired);
+ adminWebClient.setSimReachable(simDoc.getSimID(), !origReachable);
+ simDoc = adminWebClient.getSimDocument(sims[0].getSimID());
+ assertEquals(simDoc.isReachable(), !origReachable);
+
//check perms and but don't actually do deletion
assertFalse(stdWebClient.deleteSim(simDoc.getSimID()));
//blow it away as admin
assertTrue(adminWebClient.deleteSim(simDoc.getSimID()));
//put back in right state
- assertNotNull(adminWebClient.createSimRecord(simDoc.getSimURI(),true,false));
+ assertNotNull(adminWebClient.createSimRecord(simDoc.getSimURI(), true, false));
}
-
private WebAPIClient createStandardWebClient() throws IOException, AuthenticationFailedException {
WebAPIAuthenticator basicAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, USERNAME1, PASSWORD1);
assertNotNull("got null auth cookie", basicAuthenticator.getAuthCookie());
@@ -482,23 +481,23 @@
attachmentDocs = confDoc.getAttachmentDocuments();
assertEquals(1, attachmentDocs.length);
assertEquals(templateDoc.getTemplateID(), attachmentDocs[0].getTemplateID());
-
+
confDoc.removeAttachment(attachmentDocs[0].getAttachmentID());
advancedClient.updateBodyConfiguration(confDoc);
confDoc = advancedClient.getDefaultBodyConfiguration(advancedClient.getAuthenticator().getUsername());
attachmentDocs = confDoc.getAttachmentDocuments();
assertEquals(0, attachmentDocs.length);
-
+
TemplateDocument[] attachmentTemplateDocs = advancedClient.getAttachmentTemplateDocuments();
boolean foundNewTemplate = false;
for (int i = 0; i < attachmentTemplateDocs.length; i++) {
- if(attachmentTemplateDocs[i].getTemplateID() == templateDoc.getTemplateID()){
+ if (attachmentTemplateDocs[i].getTemplateID() == templateDoc.getTemplateID()) {
foundNewTemplate = true;
break;
}
}
assertTrue(foundNewTemplate);
-
+
advancedClient.deleteTemplate(templateDoc.getTemplateID());
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-26 17:03:05 UTC (rev 771)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-26 17:32:44 UTC (rev 772)
@@ -493,7 +493,7 @@
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
-
+ Log.info("Validated email address: " + validationRecord.getEmail());
//this isn't likely to do anything useful unless you set the crossContext=true attribute
//in your context decl for your root application
response.sendRedirect("/emailValidated.html");
Modified: maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
===================================================================
--- maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2008-02-26 17:03:05 UTC (rev 771)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2008-02-26 17:32:44 UTC (rev 772)
@@ -68,13 +68,13 @@
private Renderer renderer = null;
private SpaceClientListener spaceClientListener = new SpaceClientListener();
-
+
private RendererListener rendererListener = new RendererListener();
private URI serviceURI = null;
private String serverIP = null;
-
+
private String authCookie = null;
private Map popupMap = new HashMap();
@@ -88,9 +88,9 @@
private AudioClip incomingChatAudioClip = null;
private String helpMessage = null;
-
+
private ViewerApplet theApplet;
-
+
private String osType;
public ViewerApplet() {
@@ -98,7 +98,7 @@
setLayout(new BorderLayout());
add(splashPanel, BorderLayout.CENTER);
theApplet = this;
- osType = System.getProperty("os.name");
+ osType = System.getProperty("os.name");
}
public void start() {
@@ -120,7 +120,7 @@
}
serverIP = getParameter("serverIP");
- if(serverIP == null || serverIP.length() == 0){
+ if (serverIP == null || serverIP.length() == 0) {
removeAll();
validate();
add(new ErrorPanel("I can't find the server IP."), BorderLayout.CENTER);
@@ -128,7 +128,7 @@
repaint();
return;
}
-
+
float x = getFloatParameter("x", 0);
float y = getFloatParameter("y", 0);
float z = getFloatParameter("z", 0);
@@ -163,8 +163,9 @@
}
if (spaceClient.getSpace().getUser(spaceClient.getUsername()) == null) {
Log.warn("No user by that name in the space!");
+ } else {
+ spaceClient.getSpace().getUser(spaceClient.getUsername()).setPosition(transform);
}
- spaceClient.getSpace().getUser(spaceClient.getUsername()).setPosition(transform);
}
renderer = new J3DRenderer(spaceClient, false);
renderer.addListener(rendererListener);
@@ -291,23 +292,23 @@
imUser(message.substring(4));
} else if ("/debugChatter".equals(message)) {
new ChatterBoxThread().start();
- } else if(message.startsWith("/r ")){
- if(message.length() < 4){
+ } else if (message.startsWith("/r ")) {
+ if (message.length() < 4) {
return;
}
- if(spaceClientListener.lastTellUser == null){
+ if (spaceClientListener.lastTellUser == null) {
chatPanel.displayMessage(null, "I don't know to whom to reply.");
return;
}
String clippedMessage = message.substring(3);
spaceClient.userSentPrivateMessage(spaceClientListener.lastTellUser, clippedMessage);
String username = spaceClientListener.lastTellUser.getUsername();
- if(username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)){
+ if (username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
username = J3DUserRenderable.convertGuestCookieToDisplayName(username);
}
chatPanel.displayMessage(null, "you told " + username + ": " + clippedMessage);
- } else if (message.startsWith("/t ")){
- if(message.length() < 6 || message.substring(3).indexOf(" ") == -1){
+ } else if (message.startsWith("/t ")) {
+ if (message.length() < 6 || message.substring(3).indexOf(" ") == -1) {
return;
}
String clippedMessage = message.substring(3);
@@ -316,16 +317,16 @@
String displayUsername = null;
for (int i = 0; i < users.length; i++) {
String testUsername = users[i].getUsername();
- if(testUsername.startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
+ if (testUsername.startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
testUsername = J3DUserRenderable.convertGuestCookieToDisplayName(testUsername);
}
- if(clippedMessage.startsWith(testUsername + " ")){
+ if (clippedMessage.startsWith(testUsername + " ")) {
namedUser = users[i];
displayUsername = testUsername;
break;
}
}
- if(namedUser == null){
+ if (namedUser == null) {
chatPanel.displayMessage(null, "No such user.");
return;
}
@@ -496,18 +497,18 @@
public String getUsername() {
return spaceClient.getUsername();
}
-
+
private class RendererListener implements Renderer.Listener {
- public void ranOutOfMemory() {
- MemoryInfoPanel memoryBox = new MemoryInfoPanel(new Frame(""));
- }
+ public void ranOutOfMemory() {
+ MemoryInfoPanel memoryBox = new MemoryInfoPanel(new Frame(""));
+ }
}
private class SpaceClientListener implements SpaceClient.Listener {
User lastTellUser = null;
-
+
public void disconnected() {
chatPanel.displayMessage(null, "Disconnected.");
}
@@ -524,13 +525,13 @@
incomingChatAudioClip.play();
}
}
-
+
public void receivedTellMessage(String username, String message) {
- if(!showChat){
+ if (!showChat) {
return;
}
User user = spaceClient.getSpace().getUser(username);
- if(user == null){
+ if (user == null) {
System.err.println("Received tell from unknown user: " + username);
return;
}
@@ -732,81 +733,75 @@
add(new JLabel("Connecting..."));
}
}
-
+
private class MemoryInfoPanel extends Dialog implements ActionListener {
- Button help,cancel;
- TextArea text;
- String memoryMessage =
- "\n"
- + "Our renderer ran out of memory and could not "
- + "display all of the objects in the space - "
- + "they were replaced by question marks. Click "
- + "the Help button below to open a page with "
- + "instructions about how to easily solve this "
- + "problem in your current operating system."
- + "\n";
- String helpURL;
-
- public MemoryInfoPanel(Frame frame){
- super(frame, "Out Of Memory Error", true);
- setLayout(new BorderLayout());
- text = new TextArea(memoryMessage, 8, 30, TextArea.SCROLLBARS_NONE);
- text.setEditable(false);
- text.setBackground(Color.LIGHT_GRAY);
- add(text, BorderLayout.CENTER);
- addHelpCancelPanel();
- createFrame();
- pack();
- setVisible(true);
- }
+ Button help, cancel;
- private void addHelpCancelPanel() {
- Panel p = new Panel();
- p.setLayout(new FlowLayout());
- createButtons(p);
- add(p, BorderLayout.SOUTH);
- }
+ TextArea text;
- private void createButtons(Panel p) {
- p.add(help = new Button("Help"));
- help.addActionListener(this);
- p.add(cancel = new Button("Cancel"));
- cancel.addActionListener(this);
- }
+ String memoryMessage = "\n" + "Our renderer ran out of memory and could not " + "display all of the objects in the space - " + "they were replaced by question marks. Click " + "the Help button below to open a page with " + "instructions about how to easily solve this " + "problem in your current operating system." + "\n";
- private void createFrame() {
- Dimension d = theApplet.getSize();
- setLocation(d.width/4,d.height/3);
- }
+ String helpURL;
- public void actionPerformed(ActionEvent ae){
- if(ae.getSource() == help) {
-
- setVisible(false);
-
- String protocol = theApplet.getCodeBase().getProtocol();
- int port = theApplet.getCodeBase().getPort();
- String host = theApplet.getCodeBase().getHost();
+ public MemoryInfoPanel(Frame frame) {
+ super(frame, "Out Of Memory Error", true);
+ setLayout(new BorderLayout());
+ text = new TextArea(memoryMessage, 8, 30, TextArea.SCROLLBARS_NONE);
+ text.setEditable(false);
+ text.setBackground(Color.LIGHT_GRAY);
+ add(text, BorderLayout.CENTER);
+ addHelpCancelPanel();
+ createFrame();
+ pack();
+ setVisible(true);
+ }
- if (osType.startsWith("Mac")) {
- helpURL = protocol + "://" + host + ":" + port + "/appletSettingsOSX.html";
- } else if (osType.startsWith("Windows")) {
- helpURL = protocol + "://" + host + ":" + port + "/appletSettingsXP.html";
- } else {
- // TODO: add pages for other OS
- helpURL = protocol + "://" + host + ":" + port + "/support.html";
- }
-
- try {
- theApplet.stop();
- theApplet.getAppletContext().showDocument(new URL(helpURL), "_top");
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
- else if (ae.getSource() == cancel) {
- setVisible(false);
- }
- }
- }
+ private void addHelpCancelPanel() {
+ Panel p = new Panel();
+ p.setLayout(new FlowLayout());
+ createButtons(p);
+ add(p, BorderLayout.SOUTH);
+ }
+
+ private void createButtons(Panel p) {
+ p.add(help = new Button("Help"));
+ help.addActionListener(this);
+ p.add(cancel = new Button("Cancel"));
+ cancel.addActionListener(this);
+ }
+
+ private void createFrame() {
+ Dimension d = theApplet.getSize();
+ setLocation(d.width / 4, d.height / 3);
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+ if (ae.getSource() == help) {
+
+ setVisible(false);
+
+ String protocol = theApplet.getCodeBase().getProtocol();
+ int port = theApplet.getCodeBase().getPort();
+ String host = theApplet.getCodeBase().getHost();
+
+ if (osType.startsWith("Mac")) {
+ helpURL = protocol + "://" + host + ":" + port + "/appletSettingsOSX.html";
+ } else if (osType.startsWith("Windows")) {
+ helpURL = protocol + "://" + host + ":" + port + "/appletSettingsXP.html";
+ } else {
+ // TODO: add pages for other OS
+ helpURL = protocol + "://" + host + ":" + port + "/support.html";
+ }
+
+ try {
+ theApplet.stop();
+ theApplet.getAppletContext().showDocument(new URL(helpURL), "_top");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ } else if (ae.getSource() == cancel) {
+ setVisible(false);
+ }
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|