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

Commit

Permalink
Work in progress: menu template for worksapce
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng authored and alex-sl-eng committed Aug 17, 2012
1 parent ce014a8 commit 2a728d2
Show file tree
Hide file tree
Showing 16 changed files with 688 additions and 53 deletions.
Expand Up @@ -10,9 +10,9 @@
import org.zanata.webtrans.shared.model.ProjectIterationId;
import org.zanata.webtrans.shared.model.UserWorkspaceContext;
import org.zanata.webtrans.shared.model.WorkspaceId;
import org.zanata.webtrans.shared.rpc.EventServiceConnectedAction;
import org.zanata.webtrans.shared.rpc.ActivateWorkspaceAction;
import org.zanata.webtrans.shared.rpc.ActivateWorkspaceResult;
import org.zanata.webtrans.shared.rpc.EventServiceConnectedAction;
import org.zanata.webtrans.shared.rpc.ExitWorkspaceAction;
import org.zanata.webtrans.shared.rpc.ExitWorkspaceResult;
import org.zanata.webtrans.shared.rpc.NoOpResult;
Expand All @@ -31,6 +31,7 @@
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.RootPanel;

/**
* Entry point classes define <code>onModuleLoad()</code>.
Expand Down Expand Up @@ -159,7 +160,8 @@ public void onFailure(Throwable e)
private void delayedStartApp()
{
final AppPresenter appPresenter = injector.getAppPresenter();
RootLayoutPanel.get().add(appPresenter.getDisplay().asWidget());
RootPanel.get("test").add(appPresenter.getDisplay().asWidget());
// RootLayoutPanel.get().add(appPresenter.getDisplay().asWidget());
appPresenter.bind();
}

Expand Down Expand Up @@ -199,11 +201,40 @@ public static void redirectToZanataProjectHome(WorkspaceId workspaceId)
{
redirectToUrl(getModuleParentBaseUrl() + "project/view/" + workspaceId.getProjectIterationId().getProjectSlug());
}

public static void redirectToZanataProject()
{
redirectToUrl(getModuleParentBaseUrl() + "project");
}

public static void redirectToZanataGroup()
{
redirectToUrl(getModuleParentBaseUrl() + "version-group");
}

public static void redirectToZanataLanguage()
{
redirectToUrl(getModuleParentBaseUrl() + "language");
}

public static void redirectToZanataHelp()
{
redirectToUrl(getModuleParentBaseUrl() + "help");
}

public static void redirectToZanataHome()
{
redirectToUrl(getModuleParentBaseUrl());
}

public static native void redirectToUrl(String url)/*-{
$wnd.location = url;
}-*/;

public static native void openNewWindowToUrl(String url)/*-{
$wnd.open(url);
}-*/;

public static native void closeWindow()/*-{
$wnd.close();
}-*/;
Expand Down
Expand Up @@ -49,6 +49,7 @@
import org.zanata.webtrans.client.presenter.DocumentListPresenter;
import org.zanata.webtrans.client.presenter.GlossaryDetailsPresenter;
import org.zanata.webtrans.client.presenter.GlossaryPresenter;
import org.zanata.webtrans.client.presenter.HeaderPresenter;
import org.zanata.webtrans.client.presenter.KeyShortcutPresenter;
import org.zanata.webtrans.client.presenter.LayoutSelectorPresenter;
import org.zanata.webtrans.client.presenter.NotificationPresenter;
Expand Down Expand Up @@ -77,6 +78,7 @@
import org.zanata.webtrans.client.view.DocumentListView;
import org.zanata.webtrans.client.view.GlossaryDetailsView;
import org.zanata.webtrans.client.view.GlossaryView;
import org.zanata.webtrans.client.view.HeaderView;
import org.zanata.webtrans.client.view.KeyShortcutView;
import org.zanata.webtrans.client.view.LayoutSelectorView;
import org.zanata.webtrans.client.view.NotificationView;
Expand Down Expand Up @@ -129,6 +131,7 @@ protected void configure()
bindPresenter(ValidationOptionsPresenter.class, ValidationOptionsPresenter.Display.class, ValidationOptionsView.class);
bindPresenter(NotificationPresenter.class, NotificationPresenter.Display.class, NotificationView.class);
bindPresenter(LayoutSelectorPresenter.class, LayoutSelectorPresenter.Display.class, LayoutSelectorView.class);
bindPresenter(HeaderPresenter.class, HeaderPresenter.Display.class, HeaderView.class);

bind(SourceContentsPresenter.class).in(Singleton.class);
bind(TargetContentsDisplay.class).to(TargetContentsView.class);
Expand Down
Expand Up @@ -92,7 +92,6 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg
void cancelNotificationAlert();

void initMenuList(String userLabel, Command helpMenuCommand, Command reportProblemMenuCommand, Command leaveWorkspaceMenuCommand, Command signOutMenuCommand, Command layoutMenuCommand);

}

private final KeyShortcutPresenter keyShortcutPresenter;
Expand All @@ -101,6 +100,7 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg
private final SearchResultsPresenter searchResultsPresenter;
private final NotificationPresenter notificationPresenter;
private final LayoutSelectorPresenter layoutSelectorPresenter;
private final HeaderPresenter headerPresenter;

private final History history;
private final Identity identity;
Expand All @@ -120,7 +120,7 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg
private static final String REPORT_PROBLEM_LINK = "https://bugzilla.redhat.com/enter_bug.cgi?format=guided&product=Zanata";

@Inject
public AppPresenter(Display display, EventBus eventBus, final KeyShortcutPresenter keyShortcutPresenter, final TranslationPresenter translationPresenter, final DocumentListPresenter documentListPresenter, final SearchResultsPresenter searchResultsPresenter, final NotificationPresenter notificationPresenter, final LayoutSelectorPresenter layoutSelectorPresenter, final Identity identity, final UserWorkspaceContext userWorkspaceContext, final WebTransMessages messages, final History history, final Window window, final Window.Location windowLocation)
public AppPresenter(Display display, EventBus eventBus, final HeaderPresenter headerPresenter, final KeyShortcutPresenter keyShortcutPresenter, final TranslationPresenter translationPresenter, final DocumentListPresenter documentListPresenter, final SearchResultsPresenter searchResultsPresenter, final NotificationPresenter notificationPresenter, final LayoutSelectorPresenter layoutSelectorPresenter, final Identity identity, final UserWorkspaceContext userWorkspaceContext, final WebTransMessages messages, final History history, final Window window, final Window.Location windowLocation)
{
super(display, eventBus);
this.userWorkspaceContext = userWorkspaceContext;
Expand All @@ -133,6 +133,7 @@ public AppPresenter(Display display, EventBus eventBus, final KeyShortcutPresent
this.searchResultsPresenter = searchResultsPresenter;
this.notificationPresenter = notificationPresenter;
this.layoutSelectorPresenter = layoutSelectorPresenter;
this.headerPresenter = headerPresenter;
this.window = window;
this.windowLocation = windowLocation;
}
Expand All @@ -152,6 +153,7 @@ protected void onBind()
searchResultsPresenter.bind();
notificationPresenter.bind();
layoutSelectorPresenter.bind();
headerPresenter.bind();

layoutSelectorPresenter.setLayoutListener(translationPresenter);
notificationPresenter.setNotificationListener(this);
Expand Down
@@ -0,0 +1,140 @@
package org.zanata.webtrans.client.presenter;

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.Application;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.shared.model.UserWorkspaceContext;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.inject.Inject;

public class HeaderPresenter extends WidgetPresenter<HeaderPresenter.Display>
{
public interface Display extends WidgetDisplay
{
HasClickHandlers getLogo();

HasClickHandlers getProjects();

HasClickHandlers getGroups();

HasClickHandlers getLanguages();

HasClickHandlers getHelp();

HasClickHandlers getReportProblem();

HasClickHandlers getKnownIssues();
}

private final UserWorkspaceContext userWorkspaceContext;
private final WebTransMessages messages;

private final static String REPORT_PROBLEM_LINK = "https://bugzilla.redhat.com/enter_bug.cgi?format=guided&amp;product=Zanata";
private final static String KNOWN_PROBLEM_LINK = "https://bugzilla.redhat.com/buglist.cgi?product=Zanata&amp;bug_status=__open__";

@Inject
public HeaderPresenter(Display display, EventBus eventBus, final WebTransMessages messages, final UserWorkspaceContext userWorkspaceContext)
{
super(display, eventBus);

this.messages = messages;
this.userWorkspaceContext = userWorkspaceContext;
}

@Override
protected void onBind()
{
display.getLogo().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.exitWorkspace();
Application.redirectToZanataHome();
}
});

display.getProjects().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.exitWorkspace();
Application.redirectToZanataProject();

}
});

display.getGroups().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.exitWorkspace();
Application.redirectToZanataGroup();

}
});

display.getLanguages().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.exitWorkspace();
Application.redirectToZanataLanguage();

}
});

display.getHelp().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.exitWorkspace();
Application.redirectToZanataHelp();
}
});

display.getReportProblem().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.openNewWindowToUrl(REPORT_PROBLEM_LINK);
}
});

display.getKnownIssues().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
Application.openNewWindowToUrl(KNOWN_PROBLEM_LINK);
}
});

}

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

}

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

}

}
Expand Up @@ -39,6 +39,9 @@ public interface Resources extends ClientBundle
@Source("images/z-logo-16px.png")
ImageResource logo();

@Source("images/logo-small.png")
ImageResource logo2();

@Source("images/x.png")
ImageResource xButton();

Expand Down Expand Up @@ -114,6 +117,18 @@ public interface Resources extends ClientBundle
@Source("images/crystal_project/_16x16/actions/logout.png")
ImageResource logout();

@Source("images/crystal_project/_16x16/apps/kllckety.png")
ImageResource projects();

@Source("images/crystal_project/_16x16/apps/kdf.png")
ImageResource groups();

@Source("images/crystal_project/_16x16/apps/locale.png")
ImageResource languages();

@Source("images/crystal_project/_16x16/apps/error.png")
ImageResource error();

// @Source("images/crystal_project/_24x24/devices/Keyboard.png")
@Source("images/zanata-icon/24x24/keyboard.png")
ImageResource keyboard();
Expand All @@ -131,4 +146,7 @@ public interface Resources extends ClientBundle
@Source("images/zanata-icon/16x16/chevron-right.png")
ImageResource chevronRight();

@Source("images/zanata-icon/16x16/chevron-down.png")
ImageResource chevronDown();

}

0 comments on commit 2a728d2

Please sign in to comment.