cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomek...@apache.org
Subject svn commit: r960230 - in /cxf/sandbox/logbrowser/rt/management-web/src: main/java/org/apache/cxf/management/web/logging/browser/client/browser/ main/java/org/apache/cxf/management/web/logging/browser/client/helper/ main/java/org/apache/cxf/management/w...
Date Sat, 03 Jul 2010 15:56:27 GMT
Author: tomekopo
Date: Sat Jul  3 15:56:26 2010
New Revision: 960230

URL: http://svn.apache.org/viewvc?rev=960230&view=rev
Log:
CXF-2878: Polished browsing feature. Added missing features like last, first page and refreshing. Change implementation to support ATOM-XML mime type. Added indicator when loading log entries from server. Fix layout bugs.

Added:
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Links.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/AbstractCallback.java
      - copied, changed from r959377, cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/JSONCallback.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/XmlCallback.java
Removed:
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/JSOEntry.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/JSOFeed.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java
Modified:
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/AtomPullServerProxy.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Entry.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Feed.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml
    cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/AtomPullServerProxy.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/AtomPullServerProxy.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/AtomPullServerProxy.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/AtomPullServerProxy.java Sat Jul  3 15:56:26 2010
@@ -21,15 +21,28 @@ package org.apache.cxf.management.web.lo
 
 import com.google.gwt.http.client.RequestBuilder;
 import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import static com.google.gwt.http.client.RequestBuilder.GET;
+import static com.google.gwt.http.client.RequestBuilder.Method;
 
-import org.apache.cxf.management.web.logging.browser.client.helper.JSONWebService;
 import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
 
 public class AtomPullServerProxy {
-    private JSONWebService webservice = new JSONWebService();
 
     public void getFeed(String url, Credentials credentials, RequestCallback callback) {
-        RequestBuilder builder = webservice.buildRequest(RequestBuilder.GET, url, credentials);
-        webservice.execute(builder, callback);
+        RequestBuilder builder = buildRequest(GET, url, credentials);
+        try {
+            builder.sendRequest(null, callback);
+        } catch (RequestException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private RequestBuilder buildRequest(Method method, String url, Credentials credentials) {
+        assert method != null;
+        RequestBuilder builder = new RequestBuilder(method, url);
+        builder.setHeader("Content-Type", "application/atom+xml");
+        builder.setHeader("Accept", "application/atom+xml");
+        return builder;
     }
 }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Entry.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Entry.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Entry.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Entry.java Sat Jul  3 15:56:26 2010
@@ -21,12 +21,82 @@ package org.apache.cxf.management.web.lo
 
 import java.util.Date;
 
-public interface Entry {
-    String getId();
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.xml.client.Element;
+import com.google.gwt.xml.client.Node;
+import com.google.gwt.xml.client.NodeList;
+import static com.google.gwt.xml.client.Node.*;
 
-    String getLevel();
+public class Entry {
+    private static DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");
 
-    Date getEventTimestamp();
+    private final Node root;
+    private String message;
+    private String level;
+    private String throwable;
+    private String threadName;
+    private Date eventTimestamp;
 
-    String getMessage();
+    public Entry(final Node root) {
+        if (root != null && root.getNodeType() == ELEMENT_NODE) {
+            this.root = root;
+        } else {
+            this.root = null;
+        }
+    }
+
+    private String getNodeValue(final String name) {
+        if (root != null) {
+            NodeList nodes = ((Element) root).getElementsByTagName(name);
+            Node node =  isSingle(nodes) ? nodes.item(0) : null;
+            if (node != null
+                    && node.getFirstChild() != null
+                    && node.getFirstChild().getNodeType() == TEXT_NODE) {
+                return node.getFirstChild().getNodeValue();
+            }
+        }
+        return null;
+    }
+
+    private boolean isSingle(final NodeList nodes) {
+        return nodes.getLength() == 1;
+    }
+
+    public Date getEventTimestamp() {
+        if (eventTimestamp == null) {
+            String value = getNodeValue("eventTimestamp");
+            if (value != null && !"".equals(value)) {
+                eventTimestamp = dtf.parse(value);
+            }
+        }
+        return eventTimestamp;
+    }
+
+    public String getThrowable() {
+        if (throwable == null) {
+            throwable = getNodeValue("throwable");
+        }
+        return throwable;
+    }
+
+    public String getThreadName() {
+        if (threadName == null) {
+            threadName = getNodeValue("threadName");
+        }
+        return threadName;
+    }
+
+    public String getLevel() {
+        if (level == null) {
+            level = getNodeValue("level");
+        }
+        return level;
+    }
+
+    public String getMessage() {
+        if (message == null) {
+            message = getNodeValue("message");
+        }
+        return message;
+    }
 }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Feed.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Feed.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Feed.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Feed.java Sat Jul  3 15:56:26 2010
@@ -19,8 +19,66 @@
 
 package org.apache.cxf.management.web.logging.browser.client.browser;
 
+import java.util.ArrayList;
 import java.util.List;
 
-public interface Feed {
-    List<Entry> getEntries();
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.Node;
+import com.google.gwt.xml.client.NodeList;
+
+public class Feed {
+    private final List<Entry> entries; 
+    private final Links links;
+    
+    public Feed(final Document document) {
+        NodeList nodes;
+
+        nodes = document.getElementsByTagName("entry");
+        entries = new ArrayList<Entry>();
+        if (nodes != null) {
+            for (int i = 0; i < nodes.getLength(); i++) {
+                entries.add(new Entry(nodes.item(i)));
+            }
+        }
+
+        nodes = document.getElementsByTagName("link");
+        links = new Links();
+        if (nodes != null) {
+            Node node;
+            for (int i = 0; i < nodes.getLength(); i++) {
+                node = nodes.item(i);
+                if ("feed".equals(node.getParentNode().getNodeName())) {
+                    setLink(node);    
+                }
+            }
+        }
+    }
+
+    public List<Entry> getEntries() {
+        return entries;
+    }
+
+    public Links getLinks() {
+        return links;
+    }
+
+    private void setLink(final Node node) {
+        final Node type = node.getAttributes().getNamedItem("rel");
+        final Node href = node.getAttributes().getNamedItem("href");
+        if (type != null && href != null) {
+            final String typeValue = type.getNodeValue();
+            final String hrefValue = href.getNodeValue();
+            if ("first".equals(typeValue)) {
+                links.setFirst(hrefValue);
+            } else if ("previous".equals(typeValue)) {
+                links.setPrevious(hrefValue);
+            } else if ("self".equals(typeValue)) {
+                links.setSelf(hrefValue);
+            } else if ("next".equals(typeValue)) {
+                links.setNext(hrefValue);
+            } else if ("last".equals(typeValue)) {
+                links.setLast(hrefValue);
+            }
+        }
+    }
 }

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Links.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Links.java?rev=960230&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Links.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/browser/Links.java Sat Jul  3 15:56:26 2010
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.management.web.logging.browser.client.browser;
+
+public class Links {
+    private String first;
+    private String previous;
+    private String self;
+    private String next;
+    private String last;
+
+    public boolean firstAvailable() {
+        return available(first);
+    }
+
+    public boolean previousAvailable() {
+        return available(previous);
+    }
+
+    public boolean selfAvailable() {
+        return available(self);
+    }
+
+    public boolean nextAvailable() {
+        return available(next);
+    }
+
+    public boolean lastAvailable() {
+        return available(last);
+    }
+
+    public String getFirst() {
+        return first;
+    }
+
+    public void setFirst(String first) {
+        this.first = first;
+    }
+
+    public String getPrevious() {
+        return previous;
+    }
+
+    public void setPrevious(String previous) {
+        this.previous = previous;
+    }
+
+    public String getSelf() {
+        return self;
+    }
+
+    public void setSelf(String self) {
+        this.self = self;
+    }
+
+    public String getNext() {
+        return next;
+    }
+
+    public void setNext(String next) {
+        this.next = next;
+    }
+
+    public String getLast() {
+        return last;
+    }
+
+    public void setLast(String last) {
+        this.last = last;
+    }
+
+    private boolean available(final String link) {
+        return link != null && !"".equals(link);
+    }
+}
\ No newline at end of file

Copied: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/AbstractCallback.java (from r959377, cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/AbstractCallback.java?p2=cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/AbstractCallback.java&p1=cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java&r1=959377&r2=960230&rev=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/AbstractCallback.java Sat Jul  3 15:56:26 2010
@@ -17,46 +17,23 @@
  * under the License.
  */
 
-package org.apache.cxf.management.web.logging.browser.client.settings;
+package org.apache.cxf.management.web.logging.browser.client.helper;
 
-import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.http.client.Request;
 import com.google.gwt.http.client.RequestCallback;
 import com.google.gwt.http.client.Response;
-import com.google.gwt.json.client.JSONObject;
-import com.google.gwt.json.client.JSONValue;
 
-public abstract class AbstractCallback implements RequestCallback {
+public abstract class AbstractCallback<T> implements RequestCallback {
     private static final int OK = 200;
     private static final int UNAUTHORIZED = 401;
 
-    protected String key;
-
-    public AbstractCallback(String key) {
-        this.key = key;
-    }
-
-    public abstract void onAccessDenied();
-
-    public abstract void onSuccess(Object obj);
-
-    protected abstract Object createResult(JavaScriptObject obj);
-
     public void onResponseReceived(Request request, Response response) {
         if (OK == response.getStatusCode()) {
-            JavaScriptObject result = null;
-            if (response.getText() != null && !"".equals(response.getText())) {
-                result = parse(response.getText());
-                if (key != null && result != null) { // unwrap
-                    JSONObject wrapper = new JSONObject(result);
-                    result = getValue(wrapper.get(key));
-                }
-            }
-            onSuccess(createResult(result));
+            onSuccess(parse(response));
         } else if (UNAUTHORIZED == response.getStatusCode()) {
             onAccessDenied();
         } else {
-            new RuntimeException("Undefined remote service error");
+            onError(request, new RuntimeException("Undefined remote service error"));
         }
     }
 
@@ -64,15 +41,9 @@ public abstract class AbstractCallback i
         throw new RuntimeException(ex);
     }
 
-    private JavaScriptObject getValue(JSONValue value) {
-        if (value.isObject() != null) {
-            return value.isObject().getJavaScriptObject();
-        } else {
-            return null;
-        }
-    }
+    public abstract void onAccessDenied();
+
+    public abstract void onSuccess(T obj);
 
-    public final native JavaScriptObject parse(String json) /*-{
-                                                            return $wnd.JSON.parse(json);
-                                                            }-*/;
+    protected abstract T parse(Response response);    
 }

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/JSONCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/JSONCallback.java?rev=960230&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/JSONCallback.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/JSONCallback.java Sat Jul  3 15:56:26 2010
@@ -0,0 +1,59 @@
+// CHECKSTYLE:OFF
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.management.web.logging.browser.client.helper;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+
+public abstract class JSONCallback extends AbstractCallback<JavaScriptObject> {
+
+    @Override
+    protected JavaScriptObject parse(Response response) {
+        JavaScriptObject result = null;
+        if (response.getText() != null && !"".equals(response.getText())) {
+            result = parse(response.getText());
+            if (getRootElement() != null && result != null) { // unwrap
+                JSONObject wrapper = new JSONObject(result);
+                result = getValue(wrapper.get(getRootElement()));
+            }
+        }
+        return result;
+    }
+
+    private JavaScriptObject getValue(JSONValue value) {
+        if (value.isObject() != null) {
+            return value.isObject().getJavaScriptObject();
+        } else {
+            return null;
+        }
+    }
+
+    protected String getRootElement() {
+        return null;
+    }
+
+    private final native JavaScriptObject parse(String json) /*-{
+        return $wnd.JSON.parse(json);
+    }-*/;
+}

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/XmlCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/XmlCallback.java?rev=960230&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/XmlCallback.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/helper/XmlCallback.java Sat Jul  3 15:56:26 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.management.web.logging.browser.client.helper;
+
+import com.google.gwt.http.client.Response;
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.XMLParser;
+
+public abstract class XmlCallback extends AbstractCallback<Document> {
+
+    @Override
+    protected Document parse(Response response) {
+        return XMLParser.parse(response.getText());
+    }
+}

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java Sat Jul  3 15:56:26 2010
@@ -19,28 +19,30 @@
 
 package org.apache.cxf.management.web.logging.browser.client.presenter;
 
-import com.google.gwt.core.client.JavaScriptObject;
+import java.util.ArrayList;
+
+import com.google.gwt.http.client.Request;
 import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.gwt.xml.client.Document;
 import com.google.inject.Inject;
 
 import org.apache.cxf.management.web.logging.browser.client.browser.AtomPullServerProxy;
+import org.apache.cxf.management.web.logging.browser.client.browser.Entry;
 import org.apache.cxf.management.web.logging.browser.client.browser.Feed;
+import org.apache.cxf.management.web.logging.browser.client.browser.Links;
 import org.apache.cxf.management.web.logging.browser.client.event.SettingsEvent;
 import org.apache.cxf.management.web.logging.browser.client.event.SignOutEvent;
 import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.helper.XmlCallback;
 import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
-import org.apache.cxf.management.web.logging.browser.client.settings.AbstractCallback;
 import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager;
 import org.apache.cxf.management.web.logging.browser.client.view.BrowseView;
 
-/**
- *
- */
 public class BrowsePresenter extends BasePresenter implements BrowseView.Presenter {
     private final BrowseView view;
     private final AtomPullServerProxy proxy;
     private Subscription subscription;
-    private int currentPage;
+    private Feed page;
 
     @Inject
     public BrowsePresenter(final EventBus eventBus, final BrowseView view,
@@ -68,45 +70,53 @@ public class BrowsePresenter extends Bas
 
     public void onSubcriptionTreeItemClicked(Subscription s) {
         this.subscription = s;
-        getFeed(s);
+        getFeed(s, s.getUrl());
     }
 
     public void onNewerButtonClicked() {
-        if (currentPage == 0) {
-            return;
-        }
-        currentPage--;
-        getFeed(subscription);
+        getFeed(subscription, page.getLinks().getNext());
     }
 
-    public void onOlderButtonClicked() {
-        currentPage++;
-        getFeed(subscription);
+    public void onLastButtonClicked() {
+        getFeed(subscription, page.getLinks().getLast());
     }
 
-    private String getUrl(Subscription s) {
-        return s.getUrl() + currentPage;
+    public void onFirstButtonClicked() {
+        getFeed(subscription, page.getLinks().getFirst());
+    }
+
+    public void onRefreshButtonClicked() {
+        getFeed(subscription, page.getLinks().getSelf());
+    }
 
+    public void onOlderButtonClicked() {
+        getFeed(subscription, page.getLinks().getPrevious());
     }
 
-    private void getFeed(Subscription s) {
-        proxy.getFeed(getUrl(s), s.getCredentials(), new AbstractCallback(null) {
+    private void getFeed(Subscription s, String url) {
+        proxy.getFeed(url, s.getCredentials(), new XmlCallback() {
 
             @Override
-            public void onSuccess(Object obj) {
-                Feed result = (Feed)obj;
-                if (result != null) {
-                    view.setLogEntries(result.getEntries());
-                }
+            public void onAccessDenied() {
+                empty();
             }
 
             @Override
-            public void onAccessDenied() {
+            public void onError(final Request request, final Throwable ex) {
+                empty();
+                super.onError(request, ex);
             }
 
             @Override
-            protected Object createResult(JavaScriptObject obj) {
-                return obj;
+            public void onSuccess(Document document) {
+                page = new Feed(document);
+                view.setEntries(page.getEntries());
+                view.setLinks(page.getLinks());
+            }
+
+            private void empty() {
+                view.setEntries(new ArrayList<Entry>());
+                view.setLinks(new Links());
             }
         });
     }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java Sat Jul  3 15:56:26 2010
@@ -30,6 +30,7 @@ import org.apache.cxf.management.web.log
 import org.apache.cxf.management.web.logging.browser.client.event.BrowseEvent;
 import org.apache.cxf.management.web.logging.browser.client.exception.SettingsUnavailableException;
 import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.helper.JSONCallback;
 import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
 import org.apache.cxf.management.web.logging.browser.client.model.Settings;
 import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
@@ -117,17 +118,7 @@ public class SettingsManager {
     }
 
     public void fetchRemotely(final Credentials credentials) {
-        remoteStorage.getSettings(credentials, new AbstractCallback("settings") {
-
-            @Override
-            public void onSuccess(Object result) {
-                settings = result != null ? (Settings)result : new Settings();
-                settings.setCredentials(credentials);
-                if (strategy == StorageStrategy.STORE_LOCALLY_AND_REMOTELY && localStorage.isAvailable()) {
-                    localStorage.set(SETTINGS_KEY, JSOConverter.convert(settings));
-                }
-                eventBus.fireEvent(new BrowseEvent());
-            }
+        remoteStorage.getSettings(credentials, new JSONCallback() {
 
             @Override
             public void onAccessDenied() {
@@ -135,8 +126,14 @@ public class SettingsManager {
             }
 
             @Override
-            protected Object createResult(JavaScriptObject obj) {
-                return JOConverter.convert((JSOSettings)obj);
+            public void onSuccess(JavaScriptObject obj) {
+                Settings result = JOConverter.convert((JSOSettings) obj);
+                settings = result != null ? result : new Settings();
+                settings.setCredentials(credentials);
+                if (strategy == StorageStrategy.STORE_LOCALLY_AND_REMOTELY && localStorage.isAvailable()) {
+                    localStorage.set(SETTINGS_KEY, JSOConverter.convert(settings));
+                }
+                eventBus.fireEvent(new BrowseEvent());
             }
         });
     }
@@ -145,19 +142,16 @@ public class SettingsManager {
         if (strategy == StorageStrategy.STORE_LOCALLY_AND_REMOTELY && localStorage.isAvailable()) {
             localStorage.set(SETTINGS_KEY, JSOConverter.convert(settings));
         }
-        remoteStorage.setSettings(settings.getCredentials(), settings, new AbstractCallback(null) {
-
-            @Override
-            public void onSuccess(Object result) {
-            }
+        remoteStorage.setSettings(settings.getCredentials(), settings, new JSONCallback() {
 
             @Override
             public void onAccessDenied() {
+
             }
 
             @Override
-            protected Object createResult(JavaScriptObject obj) {
-                return obj;
+            public void onSuccess(JavaScriptObject obj) {
+                
             }
         });
     }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java Sat Jul  3 15:56:26 2010
@@ -22,6 +22,7 @@ package org.apache.cxf.management.web.lo
 import java.util.List;
 
 import org.apache.cxf.management.web.logging.browser.client.browser.Entry;
+import org.apache.cxf.management.web.logging.browser.client.browser.Links;
 import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
 
 public interface BrowseView extends View {
@@ -35,9 +36,17 @@ public interface BrowseView extends View
         void onOlderButtonClicked();
 
         void onNewerButtonClicked();
+
+        void onLastButtonClicked();
+
+        void onFirstButtonClicked();
+
+        void onRefreshButtonClicked();
     }
 
-    void setLogEntries(List<Entry> entries);
+    void setEntries(List<Entry> entries);
+
+    void setLinks(Links links);
 
     void setSubscription(List<Subscription> subscriptions);
 

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml Sat Jul  3 15:56:26 2010
@@ -46,7 +46,7 @@
         .manageSubscriptions {
         font-size: 11px;
         color: #3366CC;
-        margin-left: 0.4em;
+        margin-left: 0.7em;
         }
 
         .outer {
@@ -81,25 +81,48 @@
         padding: 2px 0 2px 10px;
         }
 
-        .detail {
-        border: 1px solid #666;
-        background-color: white;
+        .noEntries {
+            color:grey;
+            font-size:large;
+            height:auto;
+            margin-top:1em;
+            text-align:center;
+        }
+
+        .endpoints {
+            background: #E3E8F3 url(./hborder.png) repeat-x scroll 0 -2003px;
+            border-bottom: 2px solid #BBCDF3;
+            border-top: 3px solid #BBCDF3;
+            padding-left:0.7em;
+            padding-top:0.25em;
+            padding-bottom:0.2em;
+        }
+
+        .loading {
+            background-image:url(./loader.gif);
+            background-repeat:no-repeat;
+            background-position:left;
+            color:grey;
+            font-size:large;
+            margin-top:1em;
+            text-align:right;
+            margin-left:auto;
+            margin-right:auto;
+            width:5.7em;
         }
 
-        .detailHeader {
-        background: #eee;
-        border-bottom: 1px solid #666;
-        padding: 0.5em;
+        .endpointsWrapper {
+        border-right: 1px solid #999999;
         }
 
-        .detailHeaderItem {
-        margin-bottom:0.5em;
+        .entryDetailsWrapper {
+            border: 1px solid #999999;
         }
-
         .body {
-        line-height: 150%;
-        padding: 20px 40px 20px 10px;
-        font-family: 'Times New Roman', Times, serif;
+            white-space:pre;
+            line-height: 150%;
+            padding: 20px 40px 20px 10px;
+            font-family: monospace, serif;
         }
     </ui:style>
 	<g:RootLayoutPanel>
@@ -114,16 +137,21 @@
 				<g:center>
 					<g:SplitLayoutPanel>
 						<g:west size='192'>
-							<g:DockLayoutPanel unit="EM">
-								<g:north size="20">
-									<g:ScrollPanel>
-										<g:Tree ui:field="subscriptionsTree" />
-									</g:ScrollPanel>
-								</g:north>
+							<g:DockLayoutPanel unit="EM" styleName="{style.endpointsWrapper}">
+                                <g:north size="2.2">
+                                    <g:HTMLPanel><div class="{style.endpoints}">Endpoints</div></g:HTMLPanel>
+                                </g:north>
+								<g:center>
+                                    <g:ScrollPanel>
+                                        <g:HTMLPanel>
+                                            <g:FlexTable ui:field='subscriptionsTable' styleName='{style.table}'
+                                                cellSpacing='0' cellPadding='0' />
+                                        </g:HTMLPanel>
+                                    </g:ScrollPanel>
+								</g:center>
 								<g:south size="2">
 									<g:Hyperlink ui:field="manageSubscriptionsHyperlink"
-										addStyleNames="{style.manageSubscriptions}">Manage endpoints
-										»
+										addStyleNames="{style.manageSubscriptions}">Manage endpoints &#187;
                                     </g:Hyperlink>
 								</g:south>
 							</g:DockLayoutPanel>
@@ -133,39 +161,31 @@
 							<g:DockLayoutPanel styleName='{style.outer}'
 								unit='EM'>
 								<g:north size='2.2'>
-									<g:FlexTable ui:field='header' styleName='{style.header}'
+									<g:FlexTable ui:field='entriesHeader' styleName='{style.header}'
 										cellSpacing='0' cellPadding='0' />
 								</g:north>
 
 								<g:center>
-									<g:FlexTable ui:field='table' styleName='{style.table}'
-										cellSpacing='0' cellPadding='0' />
+                                    <g:ScrollPanel>
+                                        <g:HTMLPanel>
+                                            <g:Label ui:field="noEntries" styleName='{style.noEntries}'>No entries</g:Label>
+                                            <g:Label ui:field="loading" styleName="{style.loading}">Loading...</g:Label>
+                                            <g:FlexTable ui:field='entriesTable' styleName='{style.table}'
+                                                cellSpacing='0' cellPadding='0' />
+                                        </g:HTMLPanel>
+                                    </g:ScrollPanel>
 								</g:center>
 							</g:DockLayoutPanel>
 						</g:north>
 
 						<g:center>
-							<g:DockLayoutPanel unit='EM' styleName='{style.detail}'>
-								<g:north size='6'>
-									<g:HTMLPanel styleName='{style.detailHeader}'>
-										<div class='{style.detailHeaderItem}'>
-											<b>Date:</b>
-											<span ui:field='dateElement' />
-										</div>
-										<div class='{style.detailHeaderItem}'>
-											<b>Level:</b>
-											<span ui:field='levelElement' />
-										</div>
-									</g:HTMLPanel>
-								</g:north>
-
-								<g:center>
-									<g:ScrollPanel>
-										<g:HTML styleName='{style.body}' ui:field='bodyHTML'
-											wordWrap='true' />
-									</g:ScrollPanel>
-								</g:center>
-							</g:DockLayoutPanel>
+                            <g:DockLayoutPanel styleName='{style.entryDetailsWrapper}' unit='EM'>
+                                <g:center>
+                                    <g:ScrollPanel>
+                                        <g:HTML styleName='{style.body}' ui:field='entryDetails'/>
+                                    </g:ScrollPanel>
+                                </g:center>
+                            </g:DockLayoutPanel>
 						</g:center>
 					</g:SplitLayoutPanel>
 				</g:center>

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java Sat Jul  3 15:56:26 2010
@@ -22,10 +22,7 @@ package org.apache.cxf.management.web.lo
 import java.util.List;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.SpanElement;
 import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
@@ -38,14 +35,16 @@ import com.google.gwt.user.client.ui.HTM
 import com.google.gwt.user.client.ui.HTMLTable.Cell;
 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
 import com.google.gwt.user.client.ui.Hyperlink;
-import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.Widget;
 
 import org.apache.cxf.management.web.logging.browser.client.browser.Entry;
+import org.apache.cxf.management.web.logging.browser.client.browser.Links;
 import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
 
 public class BrowseViewImpl extends Composite implements BrowseView {
+    private static final DateTimeFormat DT_FORMATTER =
+        DateTimeFormat.getFormat("HH:mm:ss dd.MM.yyyy");
 
     @UiTemplate("BrowseView.ui.xml")
     interface BrowseViewUiBinder extends UiBinder<Widget, BrowseViewImpl> {
@@ -62,49 +61,70 @@ public class BrowseViewImpl extends Comp
     @UiField
     Hyperlink manageSubscriptionsHyperlink;
     @UiField
-    Tree subscriptionsTree;
+    FlexTable subscriptionsTable;
     @UiField
-    FlexTable header;
+    FlexTable entriesHeader;
     @UiField
-    FlexTable table;
+    FlexTable entriesTable;
     @UiField
     SelectionStyle selectionStyle;
     @UiField
-    SpanElement dateElement;
+    Label noEntries;
     @UiField
-    SpanElement levelElement;
+    Label loading;
     @UiField
-    HTML bodyHTML;
+    HTML entryDetails;
 
-    private List<Entry> logEntries;
+    private List<Subscription> subscriptions;
+    private List<Entry> entries;
+    
     private NavBar navBar = new NavBar(this);
 
     private Presenter presenter;
 
-    private int startIndex;
-    private int selectedRow = -1;
+    private int subscriptionSelectedRow = -1;
+    private int entrySelectedRow = -1;
 
 
     public BrowseViewImpl() {
         initWidget(uiBinder.createAndBindUi(this));
 
-        subscriptionsTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
+        initTable();
 
-            public void onSelection(SelectionEvent<TreeItem> event) {
-                if (presenter != null) {
-                    presenter.onSubcriptionTreeItemClicked((Subscription)event.getSelectedItem()
-                        .getUserObject());
-                }
-            }
-        });
+        setNoEntriesLayout();
+    }
 
-        initTable();
+    private void setNoEntriesLayout() {
+        entriesTable.setVisible(false);
+        noEntries.setVisible(true);
+        loading.setVisible(false);
+        navBar.hideAll();
+        unselectEntry();
+    }
+
+    private void setLoadingLayout() {
+        entriesTable.setVisible(false);
+        noEntries.setVisible(false);
+        loading.setVisible(true);
+        navBar.hideAll();
+        unselectEntry();
     }
 
-    public void setSubscription(List<Subscription> subscriptions) {
-        TreeItem root = subscriptionsTree.addItem("Endpoints");
-        for (Subscription subscription : subscriptions) {
-            root.addItem(subscription.getName()).setUserObject(subscription);
+    private void setEntriesLayout() {
+        entriesTable.setVisible(true);
+        noEntries.setVisible(false);
+        loading.setVisible(false);
+    }
+
+    public void setSubscription(List<Subscription> s) {
+        subscriptionsTable.clear();
+        subscriptions = s;
+        subscriptionsTable.getColumnFormatter().setWidth(0, "160px");
+
+        int row = 0;
+        for (Subscription subscription : s) {
+            subscriptionsTable.setText(row, 0, subscription.getName());
+            row++;
         }
     }
 
@@ -130,104 +150,166 @@ public class BrowseViewImpl extends Comp
         this.presenter = presenter;
     }
 
-    @UiHandler("table")
+    @UiHandler("entriesTable")
     void onTableClicked(ClickEvent event) {
-        Cell cell = table.getCellForEvent(event);
+        Cell cell = entriesTable.getCellForEvent(event);
         if (cell != null) {
             int row = cell.getRowIndex();
-            selectRow(row);
+            selectEntry(row);
         }
     }
 
-    private void selectRow(int row) {
-        if (logEntries == null) {
+    @UiHandler("subscriptionsTable")
+    void onSubscriptionsTableClicked(ClickEvent event) {
+        Cell cell = subscriptionsTable.getCellForEvent(event);
+        if (cell != null) {
+            int row = cell.getRowIndex();
+            selectSubscription(row);
+            setLoadingLayout();
+            presenter.onSubcriptionTreeItemClicked(subscriptions.get(row));
+        }
+    }
+
+    private void selectSubscription(int row) {
+        styleRow(subscriptionSelectedRow, subscriptionsTable, false);
+        styleRow(row, subscriptionsTable, true);
+        subscriptionSelectedRow = row;        
+    }
+
+    private void unselectEntry(int row) {
+        styleRow(entrySelectedRow, entriesTable, false);
+        entrySelectedRow = -1;
+        entryDetails.setHTML("");
+    }
+
+    private void unselectEntry() {
+        unselectEntry(entrySelectedRow);
+    }
+
+    private void selectEntry(int row) {
+        if (entries == null) {
             return;
         }
-        Entry entry = logEntries.get(startIndex + row);
+        Entry entry = entries.get(row);
         if (entry == null) {
             return;
         }
 
-        styleRow(selectedRow, false);
-        styleRow(row, true);
+        styleRow(entrySelectedRow, entriesTable, false);
+        styleRow(row, entriesTable, true);
 
-        selectedRow = row;
+        entrySelectedRow = row;
 
-        setDetailsSection(entry);
+        setEntryDetails(entry);
     }
 
-    private void styleRow(int row, boolean selected) {
+    private void styleRow(int row, FlexTable t, boolean selected) {
         if (row != -1) {
             String style = selectionStyle.selectedRow();
 
             if (selected) {
-                table.getRowFormatter().addStyleName(row, style);
+                t.getRowFormatter().addStyleName(row, style);
             } else {
-                table.getRowFormatter().removeStyleName(row, style);
+                t.getRowFormatter().removeStyleName(row, style);
             }
         }
     }
 
     private void initTable() {
         // Initialize the header.
-        header.getColumnFormatter().setWidth(0, "160px");
-        header.getColumnFormatter().setWidth(1, "128px");
-        header.getColumnFormatter().setWidth(3, "256px");
+        entriesHeader.getColumnFormatter().setWidth(0, "160px");
+        entriesHeader.getColumnFormatter().setWidth(1, "128px");
+        entriesHeader.getColumnFormatter().setWidth(3, "300px");
 
-        header.setText(0, 0, "Date");
-        header.setText(0, 1, "Level");
-        header.setText(0, 2, "Message");
-        header.setWidget(0, 3, navBar);
-        header.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
+        entriesHeader.setText(0, 0, "Date");
+        entriesHeader.setText(0, 1, "Level");
+        entriesHeader.setText(0, 2, "Message");
+        entriesHeader.setWidget(0, 3, navBar);
+        entriesHeader.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
 
-        // Initialize the table.
-        table.getColumnFormatter().setWidth(0, "160px");
-        table.getColumnFormatter().setWidth(1, "128px");
+        // Initialize the entriesTable.
+        entriesTable.getColumnFormatter().setWidth(0, "160px");
+        entriesTable.getColumnFormatter().setWidth(1, "128px");
 
     }
 
-    public void setLogEntries(List<Entry> entries) {
-        table.clear();
-
-        this.logEntries = entries;
-
-        DateTimeFormat fmt = DateTimeFormat.getFormat("HH:mm:ss dd.MM.yyyy");
+    public void setEntries(List<Entry> entries) {
+        if (entries == null || entries.isEmpty()) {
+            setNoEntriesLayout();
+            return;
+        } else {
+            entriesTable.clear();
+            setEntriesLayout();
+        }
+        
+        this.entries = entries;
 
         int row = 0;
         for (Entry entry : entries) {
             if (entry.getEventTimestamp() != null) {
-                table.setText(row, 0, fmt.format(entry.getEventTimestamp()));
+                entriesTable.setText(row, 0, DT_FORMATTER.format(entry.getEventTimestamp()));
             }
-            table.setText(row, 1, entry.getLevel());
-            table.setText(row, 2, entry.getMessage());
+            entriesTable.setText(row, 1, entry.getLevel());
+            entriesTable.setText(row, 2, entry.getMessage());
             row++;
         }
+    }
 
-        // Total mock
-        navBar.update(100, 1050, 130);
-
+    public void setLinks(Links links) {
+        navBar.olderButton.setVisible(links.previousAvailable());
+        navBar.newerButton.setVisible(links.nextAvailable());
+        navBar.refreshButton.setVisible(links.selfAvailable());
+        navBar.lastButton.setVisible(links.lastAvailable());
+        navBar.firstButton.setVisible(links.firstAvailable());
     }
 
     protected void older() {
         if (presenter != null) {
+            setLoadingLayout();
             presenter.onOlderButtonClicked();
         }
     }
 
     protected void newer() {
         if (presenter != null) {
+            setLoadingLayout();
             presenter.onNewerButtonClicked();
         }
     }
 
-    private void setDetailsSection(Entry entry) {
+    protected void last() {
+        if (presenter != null) {
+            setLoadingLayout();
+            presenter.onLastButtonClicked();
+        }
+    }
+
+    protected void first() {
+        if (presenter != null) {
+            setLoadingLayout();
+            presenter.onFirstButtonClicked();
+        }
+    }
+
+    protected void refresh() {
+        if (presenter != null) {
+            setLoadingLayout();
+            presenter.onRefreshButtonClicked();
+        }
+    }
+
+    private void setEntryDetails(Entry entry) {
         if (entry == null) {
             return;
         }
-        if (entry.getEventTimestamp() != null) {
-            dateElement.setInnerText(entry.getEventTimestamp().toString());
-        }
-        levelElement.setInnerText(entry.getLevel());
-        bodyHTML.setHTML(entry.getMessage());
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("[").append(DT_FORMATTER.format(entry.getEventTimestamp())).append("]");
+        sb.append("[").append(entry.getLevel()).append("]");
+        sb.append("[").append(entry.getThreadName()).append("]");
+        sb.append(entry.getMessage()).append("\n");
+        sb.append(entry.getThrowable());
+
+        entryDetails.setHTML(sb.toString());
     }
 }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java Sat Jul  3 15:56:26 2010
@@ -20,7 +20,6 @@
 package org.apache.cxf.management.web.logging.browser.client.view;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
@@ -39,14 +38,18 @@ class NavBar extends Composite {
     }
 
     private static final Binder BINDER = GWT.create(Binder.class);
-
+    
     @UiField
-    Element countLabel;
+    Anchor refreshButton;
     @UiField
     Anchor newerButton;
     @UiField
     Anchor olderButton;
-
+    @UiField
+    Anchor lastButton;
+    @UiField
+    Anchor firstButton;
+    
     private final BrowseViewImpl outer;
 
     public NavBar(BrowseViewImpl outer) {
@@ -54,8 +57,12 @@ class NavBar extends Composite {
         this.outer = outer;
     }
 
-    public void update(int startIndex, int count, int max) {
-
+    protected void hideAll() {
+        newerButton.setVisible(false);
+        olderButton.setVisible(false);
+        lastButton.setVisible(false);
+        refreshButton.setVisible(false);
+        firstButton.setVisible(false);
     }
 
     @UiHandler("newerButton")
@@ -67,4 +74,19 @@ class NavBar extends Composite {
     void onOlderClicked(ClickEvent event) {
         outer.older();
     }
+
+    @UiHandler("lastButton")
+    void onLastClicked(ClickEvent event) {
+        outer.last();
+    }
+
+    @UiHandler("firstButton")
+    void onFirstClicked(ClickEvent event) {
+        outer.first();
+    }
+
+    @UiHandler("refreshButton")
+    void onRefreshClicked(ClickEvent event) {
+        outer.refresh();
+    }
 }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml Sat Jul  3 15:56:26 2010
@@ -27,13 +27,26 @@
     </ui:style>
 
 	<g:HTMLPanel>
-		<g:Anchor styleName='{style.anchor}' ui:field='newerButton'
+
+		<g:Anchor styleName='{style.anchor}' ui:field='firstButton'
 			href='javascript:;'>
-			&lt; newer
+			&#171; first
         </g:Anchor>
-		<span ui:field='countLabel' />
 		<g:Anchor styleName='{style.anchor}' ui:field='olderButton'
 			href='javascript:;'>
-			older &gt; </g:Anchor>
+			&#8249; previous
+        </g:Anchor>
+		<g:Anchor styleName='{style.anchor}' ui:field='refreshButton'
+			href='javascript:;'>
+			refresh
+        </g:Anchor>
+		<g:Anchor styleName='{style.anchor}' ui:field='newerButton'
+			href='javascript:;'>
+			next  &#8250;
+        </g:Anchor>
+		<g:Anchor styleName='{style.anchor}' ui:field='lastButton'
+			href='javascript:;'>
+			last &#187;
+        </g:Anchor>
 	</g:HTMLPanel>
 </ui:UiBinder>

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml Sat Jul  3 15:56:26 2010
@@ -69,13 +69,29 @@
 					barUnit="EM" barHeight="2" height="300px">
 					<g:tab>
 						<g:header>Endpoints</g:header>
-						<g:HTMLPanel>
+							<g:DockLayoutPanel unit="EM">
+								<g:north size="2">
+                                    <g:Button ui:field="addSubscriptionButton">
+                                        Add endpoint
+                                    </g:Button>
+								</g:north>
+
+								<g:center>
+                                    <g:ScrollPanel>
+                                        <g:FlexTable ui:field="subscriptionsFlexTable"
+                                            addStyleNames="{style.subscriptions}" />
+                                    </g:ScrollPanel>
+								</g:center>
+							</g:DockLayoutPanel>
+						<!--<g:HTMLPanel>
 							<g:Button ui:field="addSubscriptionButton">
 								Add endpoint
                             </g:Button>
-							<g:FlexTable ui:field="subscriptionsFlexTable"
-								addStyleNames="{style.subscriptions}" />
-						</g:HTMLPanel>
+                            <g:ScrollPanel>
+                                <g:FlexTable ui:field="subscriptionsFlexTable"
+                                    addStyleNames="{style.subscriptions}" />
+                            </g:ScrollPanel>
+						</g:HTMLPanel>-->
 					</g:tab>
 				</g:TabLayoutPanel>
 			</g:VerticalPanel>

Modified: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java?rev=960230&r1=960229&r2=960230&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java (original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java Sat Jul  3 15:56:26 2010
@@ -34,20 +34,14 @@ public class MockReadableLogStorage impl
     }
 
     public int getSize() {
-        return -1;
+        return 100;
     }
 
     public void load(List<LogRecord> list, SearchCondition<LogRecord> condition, int loadFrom,
                      int maxNumberOfRecords) {
-        list.add(getLog("1"));
-        list.add(getLog("2"));
-        list.add(getLog("3"));
-        list.add(getLog("4"));
-        list.add(getLog("5"));
-        list.add(getLog("6"));
-        list.add(getLog("7"));
-        list.add(getLog("8"));
-        list.add(getLog("9"));
+        for (int i = 0; i < 100; i++) {
+            list.add(getLog(String.valueOf(i)));
+        }
     }
 
     private LogRecord getLog(String id) {
@@ -55,6 +49,9 @@ public class MockReadableLogStorage impl
         result.setMessage("log message" + id);
         result.setLevel(LogLevel.ERROR);
         result.setEventTimestamp(new Date());
+        result.setThreadName("thread" + id);
+        result.setThrowable(new RuntimeException("ex" + id,
+            new RuntimeException("ex2", new RuntimeException("ex3"))));
         return result;
     }
 



Mime
View raw message