2 * Copyright (C) 2011 Openismus GmbH
4 * This file is part of GWT-Glom.
6 * GWT-Glom is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
11 * GWT-Glom is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with GWT-Glom. If not, see <http://www.gnu.org/licenses/>.
20 package org.glom.web.client.ui;
22 import org.glom.web.client.place.OnlineGlomPlace;
24 import com.google.gwt.core.client.GWT;
25 import com.google.gwt.event.dom.client.ClickEvent;
26 import com.google.gwt.event.dom.client.ClickHandler;
27 import com.google.gwt.uibinder.client.UiBinder;
28 import com.google.gwt.uibinder.client.UiField;
29 import com.google.gwt.user.client.ui.Anchor;
30 import com.google.gwt.user.client.ui.Composite;
31 import com.google.gwt.user.client.ui.Label;
32 import com.google.gwt.user.client.ui.VerticalPanel;
33 import com.google.gwt.user.client.ui.Widget;
35 public class DocumentSelectionViewImpl extends Composite implements DocumentSelectionView {
37 interface DocumentSelectionViewImplUiBinder extends UiBinder<Widget, DocumentSelectionViewImpl> {
40 private static DocumentSelectionViewImplUiBinder uiBinder = GWT.create(DocumentSelectionViewImplUiBinder.class);
42 VerticalPanel documentLinks;
43 private Presenter presenter;
45 public DocumentSelectionViewImpl() {
46 initWidget(uiBinder.createAndBindUi(this));
49 public void addDocumentLink(final String documentTitle) {
50 Anchor link = new Anchor(documentTitle);
51 link.addClickHandler(new ClickHandler() {
53 public void onClick(ClickEvent event) {
54 presenter.goTo(new OnlineGlomPlace(documentTitle));
57 documentLinks.add(link);
60 public void clearHyperLinks() {
61 documentLinks.clear();
67 * @see org.glom.web.client.ui.DocumentSelectionView#setErrorMessage(java.lang.String)
69 public void setErrorMessage(String message) {
71 Label label = new Label(message);
72 label.getElement().getStyle().setColor("Red");
73 documentLinks.add(label);
77 public void setPresenter(Presenter presenter) {
78 this.presenter = presenter;