|
From: <tre...@us...> - 2007-10-30 00:18:20
|
Revision: 544
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=544&view=rev
Author: trevorolio
Date: 2007-10-29 17:18:21 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Updated the body editor so that you can choose a new body configuration and choose which body data to use as the base.
Still need to add the ability to add a body configuration.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/render/PageRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -61,7 +61,7 @@
}
public AccountDocument createAccount(String username, String accountLevel, String firstName, String lastName, String homepage, String email, String password) throws IOException {
- AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
+ AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, -1);
try {
XMLElement result = wire.sendAuthenticatedXML(descriptor.getAccountURI(), newAccountDoc.toString(), "POST", authenticator.getAuthCookie());
return new AccountDocument(result);
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -69,6 +69,12 @@
return bodyConfiguration;
}
+ public void setBodyConfiguration(BodyConfiguration bodyConfiguration){
+ ArgumentUtils.assertNotNull(bodyConfiguration);
+ this.bodyConfiguration = bodyConfiguration;
+ bodyConfiguration.setUser(this);
+ }
+
public String toString() {
return "User: " + username;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -31,6 +31,7 @@
import com.ogoglio.util.StreamUtils;
import com.ogoglio.viewer.render.PageRenderable;
import com.ogoglio.viewer.render.Renderable;
+import com.ogoglio.viewer.render.ThingRenderable;
import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.picking.PickTool;
@@ -42,8 +43,11 @@
private BrowserScreen screen = null;
- public J3DPageRenderable(Page page) {
+ private J3DThingRenderable thingRenderable = null;
+
+ public J3DPageRenderable(Page page, J3DThingRenderable thingRenderable) {
this.page = page;
+ this.thingRenderable = thingRenderable;
setCapability(BranchGroup.ALLOW_DETACH);
pageGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
pageGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
@@ -54,6 +58,10 @@
reloadContent();
}
+ public ThingRenderable getThingRenderable(){
+ return thingRenderable;
+ }
+
public void cleanup() {
//removeAllChildren();
//pageGroup.removeAllChildren();
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 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -264,7 +264,7 @@
Log.error("Tried to add a page to an unknown thing: " + page.getThing().getThingID());
return;
}
- J3DPageRenderable pageRenderable = new J3DPageRenderable(page);
+ J3DPageRenderable pageRenderable = new J3DPageRenderable(page, thingRenderable);
thingRenderable.addPageRenderable(pageRenderable);
}
@@ -727,7 +727,7 @@
Page[] pages = thing.getPages();
for (int i = 0; i < pages.length; i++) {
- J3DPageRenderable pageRenderable = new J3DPageRenderable(pages[i]);
+ J3DPageRenderable pageRenderable = new J3DPageRenderable(pages[i], renderable);
renderable.addPageRenderable(pageRenderable);
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -247,6 +247,7 @@
} else if (clickTarget.getRenderable() instanceof DoorRenderable) {
userInputListener.mouseClickedDoor(((DoorRenderable) clickTarget.getRenderable()).getDoor(), null, clickTarget.getIntersection());
} else if (clickTarget.getRenderable() instanceof PageRenderable) {
+ System.out.println("Clicked page: " + ((PageRenderable) clickTarget.getRenderable()).getPage());
userInputListener.mouseClickedPage(((PageRenderable) clickTarget.getRenderable()).getPage(), clickTarget.getIntersection());
} else {
throw new IllegalStateException("Clicked on a type of renderable we don't understand");
@@ -285,6 +286,9 @@
ShapeRenderable shape = (ShapeRenderable) clickTarget.getRenderable();
renderable = (ThingRenderable) shape.getRenderable();
name = shape.getName();
+ } else if(clickTarget.getRenderable() instanceof PageRenderable){
+ PageRenderable pageRenderable = (PageRenderable)clickTarget.getRenderable();
+ renderable = pageRenderable.getThingRenderable();
} else {
return;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/render/PageRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/render/PageRenderable.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/render/PageRenderable.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -19,4 +19,5 @@
public Page getPage();
+ public ThingRenderable getThingRenderable();
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -19,7 +19,7 @@
public class AccountDocument {
- public static final long NO_TIME_VALUE=-97; //indicates there is no time value
+ public static final long NO_TIME_VALUE = -97; //indicates there is no time value
public static final String ACCOUNT_LEVEL_BASIC = "basic";
@@ -34,7 +34,7 @@
public static final String NAME = "account";
public static final String USERNAME = "username";
-
+
public static final String ACCOUNT_LEVEL = "accountlevel";
public static final String FIRST_NAME = "firstname";
@@ -53,18 +53,20 @@
public static final String FROZEN_UNTIL = "frozenuntil";
+ public static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
XMLElement data = null;
- public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil) {
+ public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil, long bodyConfigurationID) {
data = new XMLElement(NAME);
if (username == null) {
throw new IllegalArgumentException("Bad username: " + username);
}
data.setAttribute(USERNAME, username);
-
+
if (accountLevel != null) {
- data.setAttribute(ACCOUNT_LEVEL, accountLevel);
+ data.setAttribute(ACCOUNT_LEVEL, accountLevel);
}
if (firstName != null)
@@ -82,22 +84,25 @@
if (creationDate != AccountDocument.NO_TIME_VALUE)
data.setAttribute(CREATION_DATE, creationDate);
- if (frozenUntil!=AccountDocument.NO_TIME_VALUE)
+ if (frozenUntil != AccountDocument.NO_TIME_VALUE)
data.setAttribute(FROZEN_UNTIL, frozenUntil);
+
+ if (bodyConfigurationID != -1)
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyConfigurationID);
}
public AccountDocument(XMLElement data) {
if (data == null) {
throw new IllegalArgumentException("AuthDocument data is null");
}
- if (!NAME.equals(data.getName())) {
+ if (!NAME.equals(data.getName())) {
throw new IllegalArgumentException("AccountDocument data is not named Account: " + data.getName());
}
this.data = data;
}
public AccountDocument(String username) { //used when updating the document, with absent items indicating no change
- this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
+ this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, -1);
}
public XMLElement toElement() {
@@ -111,71 +116,83 @@
public String getUsername() {
return data.getStringAttribute(USERNAME);
}
-
+
public void setAccountLevel(String level) {
data.setAttribute(ACCOUNT_LEVEL, level);
}
public String getAccountLevel() {
- return data.getStringAttribute(ACCOUNT_LEVEL);
+ return data.getStringAttribute(ACCOUNT_LEVEL);
}
- public String getFirstName(){
+ public String getFirstName() {
return data.getStringAttribute(FIRST_NAME);
}
- public String getLastName(){
+ public String getLastName() {
return data.getStringAttribute(LAST_NAME);
}
-
+
public String getHomepage() {
return data.getStringAttribute(HOMEPAGE);
}
-
+
public String getPassword() {
return data.getStringAttribute(PASSWORD);
}
-
+
public String getEmail() {
return data.getStringAttribute(EMAIL);
}
-
+
public String getCookie() {
return data.getStringAttribute(COOKIE);
}
-
+
public Date getCreationDate() {
long value = data.getLongAttribute(CREATION_DATE, -1);
- if(value == -1) {
+ if (value == -1) {
return null;
}
return new Date(value);
}
-
+
public Date getFrozenUntil() {
long value = data.getLongAttribute(FROZEN_UNTIL, -1);
- if(value == -1) {
+ if (value == -1) {
return null;
}
return new Date(value);
}
public void setFrozenUntil(Date date) {
- if(date == null) {
+ if (date == null) {
data.removeAttribute(FROZEN_UNTIL);
} else {
data.setAttribute(FROZEN_UNTIL, date.getTime());
}
}
+ public long getBodyConfigurationID(){
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public void setBodyConfigurationID(long id){
+ if(id < 0){
+ data.removeAttribute(BODY_CONFIGURATION_ID);
+ } else {
+ data.setAttribute(BODY_CONFIGURATION_ID, id);
+ }
+ }
+
public int hashCode() {
return getUsername().hashCode();
}
-
+
public boolean equals(Object obj) {
- if(obj == null || !(obj instanceof AccountDocument)) {
+ if (obj == null || !(obj instanceof AccountDocument)) {
return false;
}
- return getUsername().equals(((AccountDocument)obj).getUsername());
+ return getUsername().equals(((AccountDocument) obj).getUsername());
}
}
\ No newline at end of file
Modified: maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
===================================================================
--- maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-27 23:33:47 UTC (rev 543)
+++ maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-30 00:18:21 UTC (rev 544)
@@ -86,7 +86,7 @@
}
public void testAccountDocument() {
- AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1);
+ AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1, 1);
XMLElement element = new XMLElement();
element.parseString(doc1.toString());
AccountDocument doc2 = new AccountDocument(element);
@@ -104,6 +104,7 @@
assertEquals(doc1.getPassword(), doc2.getPassword());
assertEquals(doc1.getUsername(), doc2.getUsername());
assertEquals(doc1.getAccountLevel(), doc2.getAccountLevel());
+ assertEquals(doc1.getBodyConfigurationID(), doc2.getBodyConfigurationID());
}
public void testAuthDocument() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|