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: prototyping layout selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed May 24, 2012
1 parent 8b2be9d commit 9b7ddd6
Show file tree
Hide file tree
Showing 12 changed files with 647 additions and 9 deletions.
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.LayoutSelectorPresenter;
import org.zanata.webtrans.client.presenter.NotificationPresenter;
import org.zanata.webtrans.client.presenter.OptionsPanelPresenter;
import org.zanata.webtrans.client.presenter.SearchResultsPresenter;
Expand All @@ -65,14 +66,15 @@
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
import org.zanata.webtrans.client.rpc.DelegatingDispatchAsync;
import org.zanata.webtrans.client.service.ValidationService;
import org.zanata.webtrans.client.ui.OptionsPanelView;
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.DocumentListView;
import org.zanata.webtrans.client.view.GlossaryDetailsView;
import org.zanata.webtrans.client.view.GlossaryView;
import org.zanata.webtrans.client.view.LayoutSelectorView;
import org.zanata.webtrans.client.view.NotificationView;
import org.zanata.webtrans.client.view.OptionsPanelView;
import org.zanata.webtrans.client.view.SearchResultsView;
import org.zanata.webtrans.client.view.TransMemoryDetailsView;
import org.zanata.webtrans.client.view.TransMemoryView;
Expand Down Expand Up @@ -118,6 +120,7 @@ protected void configure()
bindPresenter(TranslationEditorPresenter.class, TranslationEditorPresenter.Display.class, TranslationEditorView.class);
bindPresenter(ValidationOptionsPresenter.class, ValidationOptionsPresenter.Display.class, ValidationOptionsView.class);
bindPresenter(NotificationPresenter.class, NotificationPresenter.Display.class, NotificationView.class);
bindPresenter(LayoutSelectorPresenter.class, LayoutSelectorPresenter.Display.class, LayoutSelectorView.class);

bind(SourceContentsPresenter.class).in(Singleton.class);
bind(TargetContentsDisplay.class).to(TargetContentsView.class);
Expand Down
Expand Up @@ -98,6 +98,8 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg
private final TranslationPresenter translationPresenter;
private final SearchResultsPresenter searchResultsPresenter;
private final NotificationPresenter notificationPresenter;
private final LayoutSelectorPresenter layoutSelectorPresenter;

private final History history;
private final Identity identity;
private final Window window;
Expand All @@ -116,7 +118,7 @@ public interface Display extends net.customware.gwt.presenter.client.widget.Widg
private static final String WORKSPACE_TITLE_QUERY_PARAMETER_KEY = "title";

@Inject
public AppPresenter(Display display, EventBus eventBus, final TranslationPresenter translationPresenter, final DocumentListPresenter documentListPresenter, final SearchResultsPresenter searchResultsPresenter, final NotificationPresenter notificationPresenter, final Identity identity, final WorkspaceContext workspaceContext, final WebTransMessages messages, final History history, final Window window, final Window.Location windowLocation)
public AppPresenter(Display display, EventBus eventBus, final TranslationPresenter translationPresenter, final DocumentListPresenter documentListPresenter, final SearchResultsPresenter searchResultsPresenter, final NotificationPresenter notificationPresenter, final LayoutSelectorPresenter layoutSelectorPresenter, final Identity identity, final WorkspaceContext workspaceContext, final WebTransMessages messages, final History history, final Window window, final Window.Location windowLocation)
{
super(display, eventBus);
this.history = history;
Expand All @@ -126,6 +128,7 @@ public AppPresenter(Display display, EventBus eventBus, final TranslationPresent
this.translationPresenter = translationPresenter;
this.searchResultsPresenter = searchResultsPresenter;
this.notificationPresenter =notificationPresenter;
this.layoutSelectorPresenter = layoutSelectorPresenter;
this.window = window;
this.windowLocation = windowLocation;
this.workspaceContext = workspaceContext;
Expand All @@ -144,6 +147,7 @@ protected void onBind()
translationPresenter.bind();
searchResultsPresenter.bind();
notificationPresenter.bind();
layoutSelectorPresenter.bind();

notificationPresenter.setErrorLabelListener(this);

Expand Down Expand Up @@ -378,6 +382,7 @@ private void showView(MainView viewToShow)
currentDisplayStats = projectStats;
break;
case Documents:
layoutSelectorPresenter.show();
default:
display.setDocumentLabel("", messages.noDocumentSelected());
currentDisplayStats = projectStats;
Expand Down
@@ -0,0 +1,65 @@
/*
* 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.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetDisplay;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

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

public LayoutSelectionPresenter(Display display, EventBus eventBus)
{
super(display, eventBus);
// TODO Auto-generated constructor stub
}

public interface Display extends WidgetDisplay
{

}

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

}

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

}

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

}
}
@@ -0,0 +1,94 @@
/*
* 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 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;

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

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
*/
public class LayoutSelectorPresenter extends WidgetPresenter<LayoutSelectorPresenter.Display>
{
@Inject
public LayoutSelectorPresenter(Display display, EventBus eventBus)
{
super(display, eventBus);
}

public interface Display extends WidgetDisplay
{
void show();

void showLayoutList(boolean isShowLayoutList);

HasClickHandlers getConfigButton();

void toggleView();

void hide();
}


@Override
protected void onBind()
{
display.showLayoutList(false);

registerHandler(display.getConfigButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
display.toggleView();
}
}));
}

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

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

public void show()
{
display.show();
}

public void hide()
{
display.hide();
}
}
Expand Up @@ -20,6 +20,11 @@
*/
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.editor.CheckKey;
import org.zanata.webtrans.client.editor.CheckKeyImpl;
import org.zanata.webtrans.client.editor.table.TargetContentsPresenter;
Expand All @@ -37,6 +42,7 @@
import org.zanata.webtrans.shared.model.WorkspaceContext;
import org.zanata.webtrans.shared.rpc.GetTranslatorList;
import org.zanata.webtrans.shared.rpc.GetTranslatorListResult;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
Expand All @@ -46,11 +52,6 @@
import com.google.gwt.user.client.ui.HasValue;
import com.google.inject.Inject;

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;

public class TranslationPresenter extends WidgetPresenter<TranslationPresenter.Display>
{
public interface Display extends WidgetDisplay
Expand Down Expand Up @@ -91,6 +92,7 @@ public interface Display extends WidgetDisplay
private final GlossaryPresenter glossaryPresenter;
private final WorkspaceUsersPresenter workspaceUsersPresenter;
private final TargetContentsPresenter targetContentsPresenter;

private WorkspaceContext workspaceContext;

private final WebTransMessages messages;
Expand Down Expand Up @@ -148,6 +150,7 @@ protected void onBind()
translationEditorPresenter.bind();
optionsPanelPresenter.bind();


registerHandler(eventBus.addHandler(ExitWorkspaceEvent.getType(), new ExitWorkspaceEventHandler()
{
@Override
Expand Down Expand Up @@ -315,7 +318,6 @@ else if (checkKey.isNextEntryKey())
}
}
});

}

@Override
Expand Down
Expand Up @@ -104,4 +104,7 @@ public interface Resources extends ClientBundle

@Source("images/msgwarn.png")
ImageResource warnMsg();

@Source("images/crystal_project/_24x24/actions/run.png")
ImageResource config();
}

0 comments on commit 9b7ddd6

Please sign in to comment.