Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

daily work

  • Loading branch information...
commit 28a800698d87112bf9affb5eaf77ba99c51f3407 1 parent e5ed5c5
Daniel Qian authored January 24, 2012
4  src/main/java/com/github/chillhall/EmptyPage.java
@@ -6,17 +6,13 @@
6 6
 
7 7
 import java.util.Arrays;
8 8
 import java.util.List;
9  
-import java.util.Properties;
10 9
 
11  
-import org.apache.wicket.RuntimeConfigurationType;
12 10
 import org.apache.wicket.devutils.debugbar.DebugBar;
13 11
 import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
14 12
 import org.apache.wicket.markup.html.WebMarkupContainer;
15 13
 import org.apache.wicket.markup.html.WebPage;
16 14
 import org.apache.wicket.request.mapper.parameter.PageParameters;
17 15
 
18  
-import com.google.inject.Inject;
19  
-
20 16
 import fiftyfive.wicket.js.JavaScriptDependency;
21 17
 import fiftyfive.wicket.link.HomeLink;
22 18
 
16  src/main/java/com/github/chillhall/home/HomePage.html
... ...
@@ -1,10 +1,10 @@
1 1
 <wicket:extend>
2  
-  <div class="row">
3  
-    <section id="about" class="eightcol">
4  
-
5  
-      <h1>Welcome to chill-hall! Your G+ Id is <span wicket:id="gourmetId"></span></h1>
6  
-
7  
-    </section>
8  
-
9  
-  </div> <!-- /.row -->
  2
+	<!-- /.row -->
  3
+	<div class="row">
  4
+		<div class="twelvecol last">
  5
+			<h1>
  6
+				歡迎您,<span wicket:id="gourmet"></span>
  7
+			</h1>
  8
+		</div>
  9
+	</div>
10 10
 </wicket:extend>
4  src/main/java/com/github/chillhall/home/HomePage.java
@@ -36,8 +36,6 @@ public HomePage(PageParameters parameters) throws IOException {
36 36
         getBody().setMarkupId("home");
37 37
         // Add your components here
38 38
 		Person p = plusProxy.getPlus().people().get("me").execute();
39  
-		p.getId();
40  
-		p.get("image.url");
41 39
 		Objectify o = dataStore.begin();
42 40
 		Gourmet a = null;
43 41
 		try {
@@ -47,7 +45,7 @@ public HomePage(PageParameters parameters) throws IOException {
47 45
 			Key<Gourmet> key = o.put(new Gourmet(p.getId()));
48 46
 			a = o.get(key);
49 47
 		}
50  
-		add(new Label("gourmetId", a.getGplusId()));
  48
+		add(new Label("gourmet", p.getDisplayName()));
51 49
 	}
52 50
 
53 51
 }
6  src/main/java/com/github/chillhall/home/OAuth2CallbackPage.java
@@ -17,7 +17,6 @@
17 17
 
18 18
 import org.apache.wicket.RestartResponseException;
19 19
 import org.apache.wicket.Session;
20  
-import org.apache.wicket.markup.html.WebPage;
21 20
 import org.apache.wicket.markup.html.pages.RedirectPage;
22 21
 import org.apache.wicket.request.mapper.parameter.PageParameters;
23 22
 import org.apache.wicket.util.string.StringValue;
@@ -25,6 +24,7 @@
25 24
 import org.slf4j.LoggerFactory;
26 25
 
27 26
 import com.github.chillhall.ChillHallSession;
  27
+import com.github.chillhall.EmptyPage;
28 28
 import com.github.chillhall.bootstrap.ConfigKey;
29 29
 import com.github.chillhall.bootstrap.annotation.WicketConfig;
30 30
 import com.github.chillhall.util.SerializableAccessToken;
@@ -38,7 +38,7 @@
38 38
 import com.google.api.client.json.gson.GsonFactory;
39 39
 import com.google.inject.Inject;
40 40
 
41  
-public class OAuth2CallbackPage extends WebPage {
  41
+public class OAuth2CallbackPage extends EmptyPage {
42 42
 
43 43
 	/**
44 44
 	 * 
@@ -107,7 +107,7 @@ public OAuth2CallbackPage(PageParameters parameters) {
107 107
 		session.setAccessToken(new SerializableAccessToken(accessTokenResponse));
108 108
 		session.bind();
109 109
 		
110  
-		continueToOriginalDestination();
  110
+		throw new RestartResponseException(HomePage.class);
111 111
 	}
112 112
 
113 113
 }
15  src/main/java/com/github/chillhall/home/ProfilePage.html
... ...
@@ -1,9 +1,10 @@
1 1
 <wicket:extend>
2  
-  <div class="row">
3  
-    <section id="about" class="eightcol">
4  
-
5  
-
6  
-    </section>
7  
-
8  
-  </div> <!-- /.row -->
  2
+	<!-- /.row -->
  3
+	<div class="row">
  4
+		<div class="eightcol">
  5
+		<img wicket:id="gourmet-avatar"></img>
  6
+		</div>
  7
+		<div class="sixcol last">
  8
+		</div>
  9
+	</div>
9 10
 </wicket:extend>
10  src/main/java/com/github/chillhall/home/ProfilePage.java
@@ -12,11 +12,16 @@
12 12
 
13 13
 import java.io.IOException;
14 14
 
  15
+import org.apache.wicket.AttributeModifier;
  16
+import org.apache.wicket.markup.html.image.Image;
  17
+import org.apache.wicket.model.AbstractReadOnlyModel;
  18
+import org.apache.wicket.model.Model;
15 19
 import org.apache.wicket.request.mapper.parameter.PageParameters;
16 20
 import org.slf4j.Logger;
17 21
 import org.slf4j.LoggerFactory;
18 22
 
19 23
 import com.github.chillhall.BasePage;
  24
+import com.github.chillhall.component.StaticImage;
20 25
 import com.google.api.services.plus.model.Person;
21 26
 
22 27
 
@@ -30,8 +35,9 @@ public ProfilePage(PageParameters parameters) throws IOException {
30 35
         super(parameters);
31 36
         getBody().setMarkupId("profile");
32 37
         
33  
-        Person p = plusProxy.getPlus().people().get("me").execute();
34  
-        p.getImage().getUrl();
  38
+        final Person p = plusProxy.getPlus().people().get("me").execute();
  39
+        
  40
+        add(new StaticImage("gourmet-avatar", new Model<String>(p.getImage().getUrl())));
35 41
 	}
36 42
 
37 43
 }

0 notes on commit 28a8006

Please sign in to comment.
Something went wrong with that request. Please try again.