Author: tomekopo
Date: Sun Nov 7 13:08:59 2010
New Revision: 1032270
URL: http://svn.apache.org/viewvc?rev=1032270&view=rev
Log:
Refactoring of user interface (not yet finished):
- splited code into several widgets;
- fixed broken functionality in runtime;
What's missing?
- there is broken layout (need CSS fixes);
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEvent.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEventHandler.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerPresenter.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.ui.xml
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowsePresenter.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.ui.xml
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/EditCriteriaViewImpl.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarPresenter.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/LogBrowserCss.java
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/logbrowser.css
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
Sun Nov 7 13:08:59 2010
@@ -28,6 +28,7 @@ import org.apache.cxf.management.web.log
import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.RemoteStorageProxy;
import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.RemoteStorageProxyImpl;
import org.apache.cxf.management.web.logging.logbrowser.client.ui.BindStrategy;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.DialogBindStrategyImpl;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.WidgetBindStrategyImpl;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.accesscontroler.AccessControlView;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.accesscontroler.AccessControlViewImpl;
@@ -37,6 +38,8 @@ import org.apache.cxf.management.web.log
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser.EditCriteriaViewImpl;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser.NavigationSidebarView;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser.NavigationSidebarViewImpl;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser.ViewerView;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser.ViewerViewImpl;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.common.NavigationHeaderView;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.common.NavigationHeaderViewImpl;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.settings.SettingsView;
@@ -57,6 +60,7 @@ public class Module extends AbstractGinM
bind(NavigationHeaderView.class).to(NavigationHeaderViewImpl.class);
bind(NavigationSidebarView.class).to(NavigationSidebarViewImpl.class);
bind(EditCriteriaView.class).to(EditCriteriaViewImpl.class);
+ bind(ViewerView.class).to(ViewerViewImpl.class);
bind(RemoteStorageProxy.class).to(RemoteStorageProxyImpl.class);
bind(LocalStorage.class).to(LocalStorageImpl.class);
@@ -75,8 +79,8 @@ public class Module extends AbstractGinM
.to(WidgetBindStrategyImpl.class);
bind(BindStrategy.class)
- .annotatedWith(Names.named("BindStrategyForNavigationHeader"))
- .to(WidgetBindStrategyImpl.class);
+ .annotatedWith(Names.named("BindStrategyForEditCriteria"))
+ .to(DialogBindStrategyImpl.class);
bind(BindStrategy.class)
.annotatedWith(Names.named("BindStrategyForNavigationSidebar"))
@@ -84,7 +88,12 @@ public class Module extends AbstractGinM
bind(BindStrategy.class)
.annotatedWith(Names.named("BindStrategyForSettings"))
- .to(WidgetBindStrategyImpl.class);
+ .to(WidgetBindStrategyImpl.class);
+
+ bind(BindStrategy.class)
+ .annotatedWith(Names.named("BindStrategyForViewer"))
+ .to(WidgetBindStrategyImpl.class);
+
}
}
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEvent.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEvent.java?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEvent.java
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEvent.java
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.logbrowser.client.event;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+public class SelectedSubscriptionEvent extends
GwtEvent<SelectedSubscriptionEventHandler> {
+ public static final Type<SelectedSubscriptionEventHandler> TYPE =
+ new Type<SelectedSubscriptionEventHandler>();
+
+ private final String url;
+
+ public SelectedSubscriptionEvent(String url) {
+ this.url = url;
+ }
+
+ @Override
+ @Nonnull
+ public Type<SelectedSubscriptionEventHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(@Nonnull final SelectedSubscriptionEventHandler
handler) {
+ handler.onSelectedSubscription(this);
+ }
+
+ public String getUrl() {
+ return url;
+ }
+}
\ No newline at end of file
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEventHandler.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEventHandler.java?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEventHandler.java
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/event/SelectedSubscriptionEventHandler.java
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,26 @@
+/**
+ * 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.logbrowser.client.event;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface SelectedSubscriptionEventHandler extends EventHandler {
+ void onSelectedSubscription(SelectedSubscriptionEvent event);
+}
\ No newline at end of file
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowsePresenter.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowsePresenter.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowsePresenter.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowsePresenter.java
Sun Nov 7 13:08:59 2010
@@ -19,151 +19,28 @@
package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
-import java.util.List;
import javax.annotation.Nonnull;
-import com.google.gwt.http.client.Request;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import org.apache.cxf.management.web.logging.logbrowser.client.EventBus;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Feed;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.FeedProxyImpl;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.SettingsFacade;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.Subscription;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.BasePresenter;
import org.apache.cxf.management.web.logging.logbrowser.client.ui.BindStrategy;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.common.NavigationHeaderPresenter;
-import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserConstans;
-import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources;
public class BrowsePresenter extends BasePresenter implements
BrowseView.Presenter {
- @Nonnull
- private final BrowseView view;
-
- @Nonnull
- private final FeedProxyImpl proxy;
-
- @Nonnull
- private final SettingsFacade settingsManager;
-
- private List<Subscription> subscriptions;
-
- @Nonnull
- private final LogBrowserConstans constans;
-
- @Nonnull
- private final LogBrowserResources resources;
-
- @Nonnull
- private Feed feed;
-
- // CHECKSTYLE:OFF
@Inject
- public BrowsePresenter(@Nonnull final EventBus eventBus,
- @Nonnull final BrowseView view,
+ public BrowsePresenter(@Nonnull EventBus eventBus,
+ @Nonnull BrowseView view,
@Nonnull @Named("BindStrategyForBrowser") final
BindStrategy bindStrategy,
- @Nonnull final NavigationHeaderPresenter
navigationHeaderPresenter,
- @Nonnull final SettingsFacade settingsManager,
- @Nonnull final FeedProxyImpl proxy,
- @Nonnull final LogBrowserConstans constans,
- @Nonnull final LogBrowserResources resources) {
+ @Nonnull NavigationHeaderPresenter
navigationHeaderPresenter,
+ @Nonnull NavigationSidebarPresenter
navigationSidebarPresenter,
+ @Nonnull ViewerPresenter viewerPresenter) {
super(eventBus, view, bindStrategy);
- this.view = view;
- this.proxy = proxy;
- this.settingsManager = settingsManager;
- this.constans = constans;
- this.resources = resources;
-
- this.view.setPresenter(this);
-
- setFeed(Feed.EMPTY);
- updateSubscriptions();
-
navigationHeaderPresenter.go(view.getNaviagationHeaderSlot());
- }
- // CHECKSTYLE:ON
-
- private void updateSubscriptions() {
- subscriptions = settingsManager.getSubscriptions();
-// view.setSubscriptions(subscriptions);
- }
-
- public void onSubcriptionItemClicked(final int row) {
- assert row >= 0 && row < subscriptions.size();
- Subscription selectedSubscription = subscriptions.get(row);
- getFeed(selectedSubscription.getUrl());
- }
-
- public void onEntryItemClicked(final int row) {
- assert row >= 0 && row < feed.getEntries().size();
- view.setEntryDetails(feed.getEntries().get(row));
- }
-
- public void onNewerButtonClicked() {
- getFeed(feed.getLinks().getNext());
- }
-
- public void onLastButtonClicked() {
- getFeed(feed.getLinks().getLast());
- }
-
- public void onFirstButtonClicked() {
- getFeed(feed.getLinks().getFirst());
- }
-
- public void onRefreshButtonClicked() {
- getFeed(feed.getLinks().getSelf());
- }
-
- public void onOlderButtonClicked() {
- getFeed(feed.getLinks().getPrevious());
- }
-
- private void setFeed(@Nonnull final Feed newFeed) {
- feed = newFeed;
-
- view.setEntryDetails(null);
- view.setLinks(feed.getLinks());
-
- if (feed.getEntries().isEmpty()) {
- setNoEntriesMessage();
- } else {
- view.setEntries(feed.getEntries());
- }
- }
-
- private void setNoEntriesMessage() {
- view.setMessageInsteadOfEntries(constans.browserTabNoEntries(),
- resources.css().browserTabNoEntriesMessage());
- }
-
- private void setLoadingMessage() {
- view.setMessageInsteadOfEntries(constans.browserTabLoading(),
- resources.css().browserTabLoadingMessage());
- }
-
- private void getFeed(@Nonnull final String url) {
- setLoadingMessage();
- proxy.getFeed(url, new FeedProxyImpl.Callback() {
-
- @Override
- public void onAccessDenied() {
- setFeed(Feed.EMPTY);
- }
-
- @Override
- public void onSuccess(@Nonnull final Feed newFeed) {
- setFeed(newFeed);
- }
-
- @Override
- public void onError(@Nonnull final Request request, @Nonnull final
Throwable ex) {
- setFeed(Feed.EMPTY);
- super.onError(request, ex);
- }
-
- });
+ navigationSidebarPresenter.go(view.getNaviagationSidebarSlot());
+ viewerPresenter.go(view.getViewerSlot());
}
}
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.java
Sun Nov 7 13:08:59 2010
@@ -19,39 +19,17 @@
package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
-import java.util.List;
-
import com.google.gwt.user.client.ui.HasWidgets;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Entry;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Links;
import org.apache.cxf.management.web.logging.logbrowser.client.ui.View;
public interface BrowseView extends View {
public interface Presenter {
-
- void onEntryItemClicked(int row);
-
- void onOlderButtonClicked();
-
- void onNewerButtonClicked();
-
- void onLastButtonClicked();
-
- void onFirstButtonClicked();
-
- void onRefreshButtonClicked();
}
HasWidgets getNaviagationHeaderSlot();
- void setMessageInsteadOfEntries(String message, String styleName);
-
- void setEntries(List<Entry> entries);
-
- void setEntryDetails(Entry entry);
-
- void setLinks(Links links);
+ HasWidgets getNaviagationSidebarSlot();
- void setPresenter(Presenter presenter);
+ HasWidgets getViewerSlot();
}
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.ui.xml
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.ui.xml?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.ui.xml
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseView.ui.xml
Sun Nov 7 13:08:59 2010
@@ -19,11 +19,10 @@
-->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
-
xmlns:logbrowser='urn:import:org.apache.cxf.management.web.logging.logbrowser.client.ui.browser'>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field='res'
-
type='org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources'/>
+
type='org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources'/>
<g:RootLayoutPanel>
<g:layer>
@@ -35,37 +34,15 @@
<g:center>
<g:SplitLayoutPanel>
<g:west size='192'>
- <g:FlowPanel ui:field="navigationSidebarSlot"/>
+ <g:FlowPanel
styleName="{res.css.navigationSidebarSlot}"
+ ui:field="navigationSidebarSlot"/>
</g:west>
-
- <g:north size='200'>
- <g:DockLayoutPanel
styleName='{res.css.browserTabToolBar}'
- unit='EM'>
- <g:north
size='2.2'>
-
<g:FlexTable ui:field='entryTableHeader'
-
styleName='{res.css.browserTabEntryTableHeaders}'
- cellSpacing='0'
- cellPadding='0' />
- </g:north>
-
- <g:center>
- <logbrowser:EntryTable
ui:field='entryTable'
-
styleName='{res.css.browserTabEntrySelectableTable}'/>
- </g:center>
- </g:DockLayoutPanel>
- </g:north>
-
- <g:center>
- <g:DockLayoutPanel
styleName='{res.css.browserTabEntryDetailsSection}'
- unit='EM'>
- <g:center>
- <g:ScrollPanel>
- <g:HTML ui:field='entryDetails'
-
styleName='{res.css.browserTabEntryDetailsContent}'/>
- </g:ScrollPanel>
- </g:center>
- </g:DockLayoutPanel>
- </g:center>
+
+ <g:center>
+ <g:VerticalPanel>
+ <g:FlowPanel styleName="{res.css.viewerSlot}"
ui:field="viewerSlot"/>
+ </g:VerticalPanel>
+ </g:center>
</g:SplitLayoutPanel>
</g:center>
</g:DockLayoutPanel>
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
Sun Nov 7 13:08:59 2010
@@ -19,38 +19,19 @@
package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
-import java.util.ArrayList;
-import java.util.List;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Entry;
-import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Links;
-import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserConstans;
-
-import static
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser
- .SelectableTable.SelectRowHandler;
-import static
org.apache.cxf.management.web.logging.logbrowser.client.ui.browser
- .SubscriptionTable.ColumnDefinition;
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> { }
@@ -58,186 +39,34 @@ public class BrowseViewImpl extends Comp
private static final BrowseViewUiBinder UI_BINDER =
GWT.create(BrowseViewUiBinder.class);
@UiField @Nonnull
- FlexTable entryTableHeader;
-
- @UiField @Nonnull
- EntryTable entryTable;
-
- @UiField @Nonnull
- HTML entryDetails;
-
- @UiField @Nonnull
FlowPanel navigationHeaderSlot;
@UiField @Nonnull
FlowPanel navigationSidebarSlot;
- @Nonnull
- private NavigationLinks navigationLinks;
-
- @Nullable
- private Presenter presenter;
-
- @Nonnull
- private final LogBrowserConstans constans;
+ @UiField @Nonnull
+ FlowPanel viewerSlot;
@Inject
- public BrowseViewImpl(@Nonnull final LogBrowserConstans constans) {
- this.constans = constans;
-
+ public BrowseViewImpl() {
initWidget(UI_BINDER.createAndBindUi(this));
- initNavigationLinks();
- initEntryTableHeader();
-
- initEntryTable();
- }
-
- public void setEntries(@Nonnull final List<Entry> entries) {
- entryTable.setData(entries);
}
public HasWidgets getNaviagationHeaderSlot() {
return navigationHeaderSlot;
}
- public void setMessageInsteadOfEntries(@Nonnull final String message,
@Nullable final String styleName) {
- entryTable.setMessageInsteadOfData(message, styleName);
+ public HasWidgets getNaviagationSidebarSlot() {
+ return navigationSidebarSlot;
}
- public void setEntryDetails(@Nullable final Entry entry) {
- if (entry == null) {
- entryDetails.setHTML("");
- return;
- }
-
- StringBuilder sb = new StringBuilder();
-
- if (entry.getMessage() != null) {
- sb.append(entry.getMessage()).append("\n");
- }
- if (entry.getThrowable() != null) {
- sb.append(entry.getThrowable());
- }
-
- entryDetails.setHTML(sb.toString());
- }
-
- public void setLinks(@Nonnull final Links links) {
- navigationLinks.olderButton.setVisible(links.previousAvailable());
- navigationLinks.newerButton.setVisible(links.nextAvailable());
- navigationLinks.refreshButton.setVisible(links.selfAvailable());
- navigationLinks.lastButton.setVisible(links.lastAvailable());
- navigationLinks.firstButton.setVisible(links.firstAvailable());
- }
-
- public void setPresenter(@Nonnull final Presenter presenter) {
- this.presenter = presenter;
+ public HasWidgets getViewerSlot() {
+ return viewerSlot;
}
@Nonnull
public Widget asWidget() {
return this;
}
-
- private void initNavigationLinks() {
- navigationLinks = new NavigationLinks();
-
- navigationLinks.firstButton.addClickHandler(new ClickHandler() {
-
- public void onClick(@Nonnull final ClickEvent clickEvent) {
- assert presenter != null;
- presenter.onFirstButtonClicked();
- }
- });
- navigationLinks.newerButton.addClickHandler(new ClickHandler() {
-
- public void onClick(@Nonnull final ClickEvent clickEvent) {
- assert presenter != null;
- presenter.onNewerButtonClicked();
- }
- });
- navigationLinks.refreshButton.addClickHandler(new ClickHandler() {
-
- public void onClick(@Nonnull final ClickEvent clickEvent) {
- assert presenter != null;
- presenter.onRefreshButtonClicked();
- }
- });
- navigationLinks.olderButton.addClickHandler(new ClickHandler() {
-
- public void onClick(@Nonnull final ClickEvent clickEvent) {
- assert presenter != null;
- presenter.onOlderButtonClicked();
- }
- });
- navigationLinks.lastButton.addClickHandler(new ClickHandler() {
-
- public void onClick(@Nonnull final ClickEvent clickEvent) {
- assert presenter != null;
- presenter.onLastButtonClicked();
- }
- });
- }
-
- private void initEntryTableHeader() {
- assert navigationLinks != null;
-
- entryTableHeader.getColumnFormatter().setWidth(0,
constans.browseTabDatatimeColumnWidth());
- entryTableHeader.getColumnFormatter().setWidth(1,
constans.browseTabLevelColumnWidth());
- entryTableHeader.getColumnFormatter().setWidth(3,
constans.browseTabNavigationLinksColumnWidth());
-
- entryTableHeader.setText(0, 0, constans.browseTabDatatimeHeader());
- entryTableHeader.setText(0, 1, constans.browseTabLevelHeader());
- entryTableHeader.setText(0, 2, constans.browseTabMessageHeader());
- entryTableHeader.setWidget(0, 3, navigationLinks);
-
- entryTableHeader.getCellFormatter().setHorizontalAlignment(0, 3,
HasHorizontalAlignment.ALIGN_RIGHT);
- }
-
- private void initEntryTable() {
- List<ColumnDefinition<Entry>> columnDefinitions =
- new ArrayList<ColumnDefinition<Entry>>();
-
- columnDefinitions.add(new ColumnDefinition<Entry>() {
-
- public String getContent(Entry entry) {
- return DT_FORMATTER.format(entry.getEventTimestamp());
- }
-
- public String getWidth() {
- return constans.browseTabDatatimeColumnWidth();
- }
- });
- columnDefinitions.add(new ColumnDefinition<Entry>() {
-
- public String getContent(Entry entry) {
- return entry.getLevel();
- }
-
- public String getWidth() {
- return constans.browseTabLevelColumnWidth();
- }
- });
- columnDefinitions.add(new ColumnDefinition<Entry>() {
-
- public String getContent(Entry entry) {
- return entry.getTitle();
- }
-
- public String getWidth() {
- return null;
- }
- });
-
- entryTable.setColumnDefinitions(columnDefinitions);
-
- entryTable.addSelectRowHandler(new SelectRowHandler() {
-
- public void onSelectRow(int row) {
- assert presenter != null;
- presenter.onEntryItemClicked(row);
- }
- });
- }
}
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/EditCriteriaViewImpl.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/EditCriteriaViewImpl.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/EditCriteriaViewImpl.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/EditCriteriaViewImpl.java
Sun Nov 7 13:08:59 2010
@@ -50,6 +50,7 @@ public class EditCriteriaViewImpl extend
//TODO implement
}
+ //TODO remove this internal class - information about how to render view
should in BindStrategy
protected static class Form extends Composite {
@UiTemplate("EditCriteriaView.ui.xml")
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarPresenter.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarPresenter.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarPresenter.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarPresenter.java
Sun Nov 7 13:08:59 2010
@@ -19,6 +19,7 @@
package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
+import java.util.List;
import javax.annotation.Nonnull;
import com.google.inject.Inject;
@@ -27,6 +28,9 @@ import com.google.inject.name.Named;
import org.apache.cxf.management.web.logging.logbrowser.client.EventBus;
import
org.apache.cxf.management.web.logging.logbrowser.client.event.GoToEditCriteriaEvent;
import
org.apache.cxf.management.web.logging.logbrowser.client.event.GoToSettingsEvent;
+import
org.apache.cxf.management.web.logging.logbrowser.client.event.SelectedSubscriptionEvent;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.SettingsFacade;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.settings.Subscription;
import
org.apache.cxf.management.web.logging.logbrowser.client.ui.BasePresenter;
import org.apache.cxf.management.web.logging.logbrowser.client.ui.BindStrategy;
@@ -36,20 +40,30 @@ public class NavigationSidebarPresenter
@Nonnull
private final NavigationSidebarView view;
+ @Nonnull
+ private final SettingsFacade settingsManager;
+
+ private List<Subscription> subscriptions;
+
@Inject
public NavigationSidebarPresenter(@Nonnull final EventBus eventBus,
@Nonnull final NavigationSidebarView view,
- @Nonnull @Named("BindStrategyForNavigationSidebar") final
BindStrategy bindStrategy) {
+ @Nonnull @Named("BindStrategyForNavigationSidebar") final
BindStrategy bindStrategy,
+ @Nonnull final SettingsFacade settingsManager) {
super(eventBus, view, bindStrategy);
this.view = view;
this.view.setPresenter(this);
+
+ this.settingsManager = settingsManager;
+
+ updateSubscriptions();
}
public void onSubcriptionItemClicked(final int row) {
-// assert row >= 0 && row < subscriptions.size();
-// Subscription selectedSubscription = subscriptions.get(row);
-// getFeed(selectedSubscription.getUrl());
+ assert row >= 0 && row < subscriptions.size();
+ Subscription selectedSubscription = subscriptions.get(row);
+ eventBus.fireEvent(new
SelectedSubscriptionEvent(selectedSubscription.getUrl()));
}
public void onManageSubscriptionsButtonClicked() {
@@ -58,6 +72,10 @@ public class NavigationSidebarPresenter
public void onEditCriteriaHyperinkClicked() {
eventBus.fireEvent(new GoToEditCriteriaEvent());
- }
+ }
+ private void updateSubscriptions() {
+ subscriptions = settingsManager.getSubscriptions();
+ view.setSubscriptions(subscriptions);
+ }
}
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerPresenter.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerPresenter.java?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerPresenter.java
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerPresenter.java
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,155 @@
+/**
+ * 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.logbrowser.client.ui.browser;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.http.client.Request;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.cxf.management.web.logging.logbrowser.client.EventBus;
+import
org.apache.cxf.management.web.logging.logbrowser.client.event.SelectedSubscriptionEvent;
+import
org.apache.cxf.management.web.logging.logbrowser.client.event.SelectedSubscriptionEventHandler;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Feed;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.FeedProxyImpl;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.BasePresenter;
+import org.apache.cxf.management.web.logging.logbrowser.client.ui.BindStrategy;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserConstans;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources;
+
+public class ViewerPresenter extends BasePresenter implements
ViewerView.Presenter {
+
+ @Nonnull
+ private final FeedProxyImpl proxy;
+
+ @Nonnull
+ private Feed feed;
+
+ @Nonnull
+ private final ViewerView view;
+
+ @Nonnull
+ private final LogBrowserConstans constans;
+
+ @Nonnull
+ private final LogBrowserResources resources;
+
+ @Inject
+ public ViewerPresenter(@Nonnull final EventBus eventBus,
+ @Nonnull final ViewerView view,
+ @Nonnull @Named("BindStrategyForViewer") final BindStrategy
bindStrategy,
+ @Nonnull final FeedProxyImpl proxy,
+ @Nonnull final LogBrowserConstans constans,
+ @Nonnull final LogBrowserResources resources) {
+ super(eventBus, view, bindStrategy);
+
+ this.view = view;
+ this.view.setPresenter(this);
+
+ this.proxy = proxy;
+ this.constans = constans;
+ this.resources = resources;
+
+ setFeed(Feed.EMPTY);
+
+ bind();
+ }
+
+ private void bind() {
+ eventBus.addHandler(SelectedSubscriptionEvent.TYPE, new
SelectedSubscriptionEventHandler() {
+
+ public void onSelectedSubscription(SelectedSubscriptionEvent
event) {
+ getFeed(event.getUrl());
+ }
+ });
+
+ }
+
+ public void onEntryItemClicked(final int row) {
+ assert row >= 0 && row < feed.getEntries().size();
+ view.setEntryDetails(feed.getEntries().get(row));
+ }
+
+ public void onNewerButtonClicked() {
+ getFeed(feed.getLinks().getNext());
+ }
+
+ public void onLastButtonClicked() {
+ getFeed(feed.getLinks().getLast());
+ }
+
+ public void onFirstButtonClicked() {
+ getFeed(feed.getLinks().getFirst());
+ }
+
+ public void onRefreshButtonClicked() {
+ getFeed(feed.getLinks().getSelf());
+ }
+
+ public void onOlderButtonClicked() {
+ getFeed(feed.getLinks().getPrevious());
+ }
+
+ private void setFeed(@Nonnull final Feed newFeed) {
+ feed = newFeed;
+
+ view.setEntryDetails(null);
+ view.setLinks(feed.getLinks());
+
+ if (feed.getEntries().isEmpty()) {
+ setNoEntriesMessage();
+ } else {
+ view.setEntries(feed.getEntries());
+ }
+ }
+
+ private void setNoEntriesMessage() {
+ view.setMessageInsteadOfEntries(constans.browserTabNoEntries(),
+ resources.css().browserTabNoEntriesMessage());
+ }
+
+ private void setLoadingMessage() {
+ view.setMessageInsteadOfEntries(constans.browserTabLoading(),
+ resources.css().browserTabLoadingMessage());
+ }
+
+ private void getFeed(@Nonnull final String url) {
+ setLoadingMessage();
+ proxy.getFeed(url, new FeedProxyImpl.Callback() {
+
+ @Override
+ public void onAccessDenied() {
+ setFeed(Feed.EMPTY);
+ }
+
+ @Override
+ public void onSuccess(@Nonnull final Feed newFeed) {
+ setFeed(newFeed);
+ }
+
+ @Override
+ public void onError(@Nonnull final Request request, @Nonnull final
Throwable ex) {
+ setFeed(Feed.EMPTY);
+ super.onError(request, ex);
+ }
+
+ });
+ }
+}
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.java?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.java
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.java
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,53 @@
+/**
+ * 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.logbrowser.client.ui.browser;
+
+import java.util.List;
+
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Entry;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Links;
+import org.apache.cxf.management.web.logging.logbrowser.client.ui.View;
+
+public interface ViewerView extends View {
+
+ public interface Presenter {
+ void onEntryItemClicked(int row);
+
+ void onOlderButtonClicked();
+
+ void onNewerButtonClicked();
+
+ void onLastButtonClicked();
+
+ void onFirstButtonClicked();
+
+ void onRefreshButtonClicked();
+ }
+
+ void setMessageInsteadOfEntries(String message, String styleName);
+
+ void setEntries(List<Entry> entries);
+
+ void setEntryDetails(Entry entry);
+
+ void setLinks(Links links);
+
+ void setPresenter(Presenter presenter);
+}
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.ui.xml
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.ui.xml?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.ui.xml
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerView.ui.xml
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,57 @@
+<!--
+ 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.
+ -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'
+
xmlns:logbrowser='urn:import:org.apache.cxf.management.web.logging.logbrowser.client.ui.browser'>
+
+ <ui:with field='res'
+
type='org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources'/>
+
+ <g:SplitLayoutPanel>
+ <g:north size='200'>
+ <g:DockLayoutPanel styleName='{res.css.browserTabToolBar}'
+ unit='EM'>
+ <g:north size='2.2'>
+ <g:FlexTable ui:field='entryTableHeader'
+
styleName='{res.css.browserTabEntryTableHeaders}'
+ cellSpacing='0'
+ cellPadding='0' />
+ </g:north>
+
+ <g:center>
+ <logbrowser:EntryTable ui:field='entryTable'
+
styleName='{res.css.browserTabEntrySelectableTable}'/>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:north>
+
+ <g:center size='200'>
+ <g:DockLayoutPanel
styleName='{res.css.browserTabEntryDetailsSection}'
+ unit='EM'>
+ <g:center>
+ <g:ScrollPanel>
+ <g:HTML ui:field='entryDetails'
+
styleName='{res.css.browserTabEntryDetailsContent}'/>
+ </g:ScrollPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:center>
+ </g:SplitLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Added:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java?rev=1032270&view=auto
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
(added)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
Sun Nov 7 13:08:59 2010
@@ -0,0 +1,228 @@
+/**
+ * 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.logbrowser.client.ui.browser;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiTemplate;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Entry;
+import
org.apache.cxf.management.web.logging.logbrowser.client.service.browser.Links;
+import
org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserConstans;
+
+public class ViewerViewImpl extends Composite implements ViewerView {
+
+ private static final DateTimeFormat DT_FORMATTER =
+ DateTimeFormat.getFormat("HH:mm:ss dd.MM.yyyy");
+
+ @UiTemplate("ViewerView.ui.xml")
+ interface ViewerViewUiBinder extends UiBinder<Widget, ViewerViewImpl> { }
+
+ private static final ViewerViewUiBinder UI_BINDER =
+ GWT.create(ViewerViewUiBinder.class);
+
+ @UiField @Nonnull
+ FlexTable entryTableHeader;
+
+ @UiField @Nonnull
+ EntryTable entryTable;
+
+ @UiField @Nonnull
+ HTML entryDetails;
+
+ private Presenter presenter;
+
+ @Nonnull
+ private NavigationLinks navigationLinks;
+
+ @Nonnull
+ private final LogBrowserConstans constans;
+
+ @Inject
+ public ViewerViewImpl(@Nonnull final LogBrowserConstans constans) {
+ this.constans = constans;
+
+ initWidget(UI_BINDER.createAndBindUi(this));
+
+
+ initNavigationLinks();
+ initEntryTableHeader();
+
+ initEntryTable();
+ }
+
+ public void setEntries(@Nonnull final List<Entry> entries) {
+ entryTable.setData(entries);
+ }
+
+
+ public void setMessageInsteadOfEntries(@Nonnull final String message,
@Nullable final String styleName) {
+ entryTable.setMessageInsteadOfData(message, styleName);
+ }
+
+ public void setEntryDetails(@Nullable final Entry entry) {
+ if (entry == null) {
+ entryDetails.setHTML("");
+ return;
+ }
+
+ StringBuilder sb = new StringBuilder();
+
+ if (entry.getMessage() != null) {
+ sb.append(entry.getMessage()).append("\n");
+ }
+ if (entry.getThrowable() != null) {
+ sb.append(entry.getThrowable());
+ }
+
+ entryDetails.setHTML(sb.toString());
+ }
+
+ public void setLinks(@Nonnull final Links links) {
+ navigationLinks.olderButton.setVisible(links.previousAvailable());
+ navigationLinks.newerButton.setVisible(links.nextAvailable());
+ navigationLinks.refreshButton.setVisible(links.selfAvailable());
+ navigationLinks.lastButton.setVisible(links.lastAvailable());
+ navigationLinks.firstButton.setVisible(links.firstAvailable());
+ }
+
+ private void initNavigationLinks() {
+ navigationLinks = new NavigationLinks();
+
+ navigationLinks.firstButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(@Nonnull final ClickEvent clickEvent) {
+ assert presenter != null;
+ presenter.onFirstButtonClicked();
+ }
+ });
+ navigationLinks.newerButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(@Nonnull final ClickEvent clickEvent) {
+ assert presenter != null;
+ presenter.onNewerButtonClicked();
+ }
+ });
+ navigationLinks.refreshButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(@Nonnull final ClickEvent clickEvent) {
+ assert presenter != null;
+ presenter.onRefreshButtonClicked();
+ }
+ });
+ navigationLinks.olderButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(@Nonnull final ClickEvent clickEvent) {
+ assert presenter != null;
+ presenter.onOlderButtonClicked();
+ }
+ });
+ navigationLinks.lastButton.addClickHandler(new ClickHandler() {
+
+ public void onClick(@Nonnull final ClickEvent clickEvent) {
+ assert presenter != null;
+ presenter.onLastButtonClicked();
+ }
+ });
+ }
+
+ private void initEntryTableHeader() {
+ assert navigationLinks != null;
+
+ entryTableHeader.getColumnFormatter().setWidth(0,
constans.browseTabDatatimeColumnWidth());
+ entryTableHeader.getColumnFormatter().setWidth(1,
constans.browseTabLevelColumnWidth());
+ entryTableHeader.getColumnFormatter().setWidth(3,
constans.browseTabNavigationLinksColumnWidth());
+
+ entryTableHeader.setText(0, 0, constans.browseTabDatatimeHeader());
+ entryTableHeader.setText(0, 1, constans.browseTabLevelHeader());
+ entryTableHeader.setText(0, 2, constans.browseTabMessageHeader());
+ entryTableHeader.setWidget(0, 3, navigationLinks);
+
+ entryTableHeader.getCellFormatter().setHorizontalAlignment(0, 3,
HasHorizontalAlignment.ALIGN_RIGHT);
+ }
+
+ private void initEntryTable() {
+ List<SelectableTable.ColumnDefinition<Entry>> columnDefinitions =
+ new ArrayList<SelectableTable.ColumnDefinition<Entry>>();
+
+ columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
+
+ public String getContent(Entry entry) {
+ return DT_FORMATTER.format(entry.getEventTimestamp());
+ }
+
+ public String getWidth() {
+ return constans.browseTabDatatimeColumnWidth();
+ }
+ });
+ columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
+
+ public String getContent(Entry entry) {
+ return entry.getLevel();
+ }
+
+ public String getWidth() {
+ return constans.browseTabLevelColumnWidth();
+ }
+ });
+ columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
+
+ public String getContent(Entry entry) {
+ return entry.getTitle();
+ }
+
+ public String getWidth() {
+ return null;
+ }
+ });
+
+ entryTable.setColumnDefinitions(columnDefinitions);
+
+ entryTable.addSelectRowHandler(new SelectableTable.SelectRowHandler() {
+
+ public void onSelectRow(int row) {
+ assert presenter != null;
+ presenter.onEntryItemClicked(row);
+ }
+ });
+ }
+
+ public void setPresenter(Presenter presenter) {
+ this.presenter = presenter;
+ }
+
+ public Widget asWidget() {
+ return this;
+ }
+}
\ No newline at end of file
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/LogBrowserCss.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/LogBrowserCss.java?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/LogBrowserCss.java
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/LogBrowserCss.java
Sun Nov 7 13:08:59 2010
@@ -22,7 +22,10 @@ package org.apache.cxf.management.web.lo
import com.google.gwt.resources.client.CssResource;
public interface LogBrowserCss extends CssResource {
-
+
+ String navigationSidebarSlot();
+ String viewerSlot();
+
/* Error Dialog styles */
String errorDialog();
String errorDialogGlass();
Modified:
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/logbrowser.css
URL:
http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/logbrowser.css?rev=1032270&r1=1032269&r2=1032270&view=diff
==============================================================================
---
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/logbrowser.css
(original)
+++
cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/resources/logbrowser.css
Sun Nov 7 13:08:59 2010
@@ -1,3 +1,21 @@
+
+.navigationSidebarSlot > div {
+ position: absolute !important;
+ left: 0px;
+ top: 0px;
+ right: 0px;
+ bottom: 0px;
+}
+
+.viewerSlot > div {
+ position: absolute !important;
+ left: 0px;
+ top: 0px;
+ right: 0px;
+ bottom: 0px;
+}
+
+
/** Error Dialog **/
.errorDialog {