Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add empty dashboard view
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jul 10, 2012
1 parent 60d974e commit 0fd8d79
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 1 deletion.
Expand Up @@ -44,6 +44,7 @@
import org.zanata.webtrans.client.history.WindowImpl;
import org.zanata.webtrans.client.history.WindowLocationImpl;
import org.zanata.webtrans.client.presenter.AppPresenter;
import org.zanata.webtrans.client.presenter.DashboardPresenter;
import org.zanata.webtrans.client.presenter.DocumentListPresenter;
import org.zanata.webtrans.client.presenter.GlossaryDetailsPresenter;
import org.zanata.webtrans.client.presenter.GlossaryPresenter;
Expand Down Expand Up @@ -72,6 +73,7 @@
import org.zanata.webtrans.client.ui.ValidationMessagePanelDisplay;
import org.zanata.webtrans.client.ui.ValidationMessagePanelView;
import org.zanata.webtrans.client.view.AppView;
import org.zanata.webtrans.client.view.DashboardView;
import org.zanata.webtrans.client.view.DocumentListView;
import org.zanata.webtrans.client.view.GlossaryDetailsView;
import org.zanata.webtrans.client.view.GlossaryView;
Expand Down Expand Up @@ -110,6 +112,7 @@ protected void configure()
bind(ValidationService.class).in(Singleton.class);

bindPresenter(AppPresenter.class, AppPresenter.Display.class, AppView.class);
bindPresenter(DashboardPresenter.class, DashboardPresenter.Display.class, DashboardView.class);
bindPresenter(KeyShortcutPresenter.class, KeyShortcutPresenter.Display.class, KeyShortcutView.class);
bindPresenter(DocumentListPresenter.class, DocumentListPresenter.Display.class, DocumentListView.class);
bindPresenter(SearchResultsPresenter.class, SearchResultsPresenter.Display.class, SearchResultsView.class);
Expand Down
Expand Up @@ -89,6 +89,7 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg

}

private final DashboardPresenter dashboardPresenter;
private final KeyShortcutPresenter keyShortcutPresenter;
private final DocumentListPresenter documentListPresenter;
private final TranslationPresenter translationPresenter;
Expand All @@ -115,6 +116,7 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg

@Inject
public AppPresenter(Display display, EventBus eventBus,
final DashboardPresenter dashboardPresenter,
final KeyShortcutPresenter keyShortcutPresenter,
final TranslationPresenter translationPresenter,
final DocumentListPresenter documentListPresenter,
Expand All @@ -130,6 +132,7 @@ public AppPresenter(Display display, EventBus eventBus,
{
super(display, eventBus);
this.keyShortcutPresenter = keyShortcutPresenter;
this.dashboardPresenter = dashboardPresenter;
this.history = history;
this.identity = identity;
this.messages = messages;
Expand All @@ -152,6 +155,7 @@ public void setNotificationLabel(int count, Severity severity)
@Override
protected void onBind()
{
dashboardPresenter.bind();
keyShortcutPresenter.bind();
documentListPresenter.bind();
translationPresenter.bind();
Expand Down Expand Up @@ -434,6 +438,13 @@ private void showView(MainView viewToShow)
searchResultsPresenter.concealDisplay();
display.setLayoutMenuVisible(true);
break;
case Dashboard:
display.setDocumentLabel("", messages.dashboard());
currentDisplayStats = projectStats;
translationPresenter.concealDisplay();
searchResultsPresenter.concealDisplay();
display.setLayoutMenuVisible(false);
break;
case Search:
// these two lines temporarily here until PresenterRevealedHandler is
// fully functional
Expand Down
@@ -0,0 +1,78 @@
/*
* Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.webtrans.client.presenter;

import net.customware.gwt.dispatch.client.DispatchAsync;
import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetDisplay;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
import org.zanata.webtrans.shared.model.WorkspaceContext;

import com.google.inject.Inject;

/**
*
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
*/
public class DashboardPresenter extends WidgetPresenter<DashboardPresenter.Display>
{

public interface Display extends WidgetDisplay
{

}

private final DispatchAsync dispatcher;




@Inject
public DashboardPresenter(final Display display, EventBus eventBus, WorkspaceContext workspaceContext, CachingDispatchAsync dispatcher, final WebTransMessages messages)
{
super(display, eventBus);
this.dispatcher = dispatcher;
}

@Override
protected void onBind()
{

}

@Override
protected void onUnbind()
{
// TODO Auto-generated method stub

}
@Override
protected void onRevealDisplay()
{
// TODO Auto-generated method stub

}

}
Expand Up @@ -2,5 +2,5 @@

public enum MainView
{
Documents, Editor, Search;
Dashboard, Documents, Editor, Search;
}
Expand Up @@ -358,4 +358,7 @@ public interface WebTransMessages extends Messages

@DefaultMessage("Close keyboard shortcuts list")
String closeShortcutView();

@DefaultMessage("Dashboard")
String dashboard();
}
@@ -0,0 +1,63 @@
/*
* Copyright 2012, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.zanata.webtrans.client.view;

import org.zanata.webtrans.client.presenter.DashboardPresenter;
import org.zanata.webtrans.client.resources.Resources;
import org.zanata.webtrans.client.resources.UiMessages;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

/**
*
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
*/
public class DashboardView extends Composite implements DashboardPresenter.Display
{
private static DashboardViewUiBinder uiBinder = GWT.create(DashboardViewUiBinder.class);

@UiField
FlexTable rootTable;

interface DashboardViewUiBinder extends UiBinder<Widget, DashboardView>
{
}

@Inject
public DashboardView(final UiMessages messages, Resources resources)
{
initWidget(uiBinder.createAndBindUi(this));
}

@Override
public Widget asWidget()
{
return this;
}

}
@@ -0,0 +1,18 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">

<ui:with field='resources' type="org.zanata.webtrans.client.resources.Resources"/>

<ui:style>
.rootTable
{
}
</ui:style>


<g:FlexTable ui:field="rootTable" styleName="rootTable" cellPadding="10px">

</g:FlexTable>

</ui:UiBinder>

0 comments on commit 0fd8d79

Please sign in to comment.