Skip to content

Commit

Permalink
Merge pull request #193 from saw-leipzig/issue33
Browse files Browse the repository at this point in the history
Issue33
  • Loading branch information
alingnau authored Jan 30, 2019
2 parents 0bc7e1a + 4e1af69 commit 8bd8e86
Show file tree
Hide file tree
Showing 21 changed files with 329 additions and 185 deletions.
2 changes: 2 additions & 0 deletions src/de/cses/client/DatabaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,6 @@ public interface DatabaseService extends RemoteService {
ArrayList<CollectionEntry> getRelatedCollectionNames(String sessionID) throws IllegalArgumentException;

ArrayList<AbstractEntry> loadCollectedEntries(CollectionEntry value) throws IllegalArgumentException;

int addPreservationClassification(PreservationClassificationEntry pcEntry) throws IllegalArgumentException;
}
2 changes: 2 additions & 0 deletions src/de/cses/client/DatabaseServiceAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,6 @@ void insertPreservationAttributeEntry(PreservationAttributeEntry paEntry, AsyncC

void loadCollectedEntries(CollectionEntry value, AsyncCallback<ArrayList<AbstractEntry>> asyncCallback) throws IllegalArgumentException;

void addPreservationClassification(PreservationClassificationEntry pcEntry, AsyncCallback<Integer> asyncCallback) throws IllegalArgumentException;

}
146 changes: 28 additions & 118 deletions src/de/cses/client/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@
*/
package de.cses.client;

import java.util.ArrayList;
import java.util.Iterator;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.i18n.client.Messages.Select;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
Expand Down Expand Up @@ -62,21 +56,24 @@
import de.cses.client.ornamentic.OrnamenticFilter;
import de.cses.client.ornamentic.OrnamenticResultView;
import de.cses.client.ornamentic.OrnamenticSearchController;
import de.cses.client.ui.AbstractSearchController;
import de.cses.client.ui.DataViewPortalLayoutContainer;
import de.cses.client.user.UserLogin;
import de.cses.shared.AbstractEntry;
import de.cses.shared.UserEntry;
import javafx.scene.image.Image;

/**
* @author alingnau
*
*/
public class MainView implements IsWidget {

interface Resources extends ClientBundle {
@Source("kucha_logo_homepage.png")
ImageResource logo();
}

// this footer will be shown at the bottom of the WebApp
private static final String FOOTER_TEXT = "\u00A9 2019 Sächsische Akademie der Wissenschaften zu Leipzig (Version 0.9.3)";
private static final String FOOTER_TEXT = "\u00A9 2019 Sächsische Akademie der Wissenschaften zu Leipzig (Version 1.0 RC1)";

private BorderLayoutContainer view = null;
private CaveSearchController caveSearchController;
Expand Down Expand Up @@ -136,21 +133,6 @@ public void onSelect(SelectEvent event) {
}
});
caveSearchController = new CaveSearchController("Caves", new CaveFilter("Caves"), new CaveResultView("Caves"), caveInactiveTB, caveActiveTB);
// caveSearchController.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//
// @Override
// public void onValueChange(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// filterView.add(caveSearchController.getFilter(), 0);
// resultView.add(caveSearchController.getResultView(), 0);
// caveSearchController.setIcon(res.cave_active());
// } else {
// caveSearchController.getResultView().removeFromParent();
// caveSearchController.getFilter().asWidget().removeFromParent();
// caveSearchController.setIcon(res.cave());
// }
// }
// });

ToolButton depictionInactiveTB = new ToolButton(new IconConfig("depictionButton", "depictionButtonOver"));
depictionInactiveTB.addSelectHandler(new SelectHandler() {
Expand All @@ -171,19 +153,6 @@ public void onSelect(SelectEvent event) {
}
});
depictionSearchController = new DepictionSearchController("Painted Representation", new DepictionFilter("Painted Representations"), new DepictionResultView("Painted Representation"), depictionInactiveTB, depictionActiveTB);
// depictionSearchController.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//
// @Override
// public void onValueChange(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// filterView.add(depictionSearchController.getFilter(), 0);
// resultView.add(depictionSearchController.getResultView(), 0);
// } else {
// depictionSearchController.getFilter().asWidget().removeFromParent();
// depictionSearchController.getResultView().removeFromParent();
// }
// }
// });

ToolButton imageInactiveTB = new ToolButton(new IconConfig("imagePoolButton", "imagePoolButtonOver"));
imageInactiveTB.addSelectHandler(new SelectHandler() {
Expand All @@ -204,20 +173,6 @@ public void onSelect(SelectEvent event) {
}
});
imageSearchController = new ImageSearchController("Image Pool", new ImageFilter("Image Filter"), new ImageResultView("Image Pool"), imageInactiveTB, imageActiveTB);
// imageSearchController.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//
// @Override
// public void onValueChange(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// filterView.add(imageSearchController.getFilter(), 0);
// resultView.add(imageSearchController.getResultView(), 0);
// } else {
// imageSearchController.getFilter().asWidget().removeFromParent();
// imageSearchController.getResultView().removeFromParent();
// }
// }
//
// });

ToolButton ornamenticInactiveTB = new ToolButton(new IconConfig("ornamentationButton", "ornamentationButtonOver"));
ornamenticInactiveTB.addSelectHandler(new SelectHandler() {
Expand All @@ -238,22 +193,8 @@ public void onSelect(SelectEvent event) {
}
});
ornamenticSearchController = new OrnamenticSearchController("Ornamentation", new OrnamenticFilter("Ornamentation"), new OrnamenticResultView("Ornamentation"), ornamenticInactiveTB, ornamenticActiveTB);
// ornamenticSearchController.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//
// @Override
// public void onValueChange(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// filterView.add(ornamenticSearchController.getFilter(), 0);
// resultView.add(ornamenticSearchController.getResultView(), 0);
// } else {
// ornamenticSearchController.getFilter().asWidget().removeFromParent();
// ornamenticSearchController.getResultView().removeFromParent();
// }
// }
// });

// annotated bibliography

ToolButton bibInactiveTB = new ToolButton(new IconConfig("bibButton", "bibButtonOver"));
bibInactiveTB.addSelectHandler(new SelectHandler() {

Expand All @@ -263,7 +204,7 @@ public void onSelect(SelectEvent event) {
resultView.add(annotatedBiblographySearchController.getResultView(), 0);
}
});
ToolButton bibActiveTB = new ToolButton(new IconConfig("bibButtonActive", "bibButtonOver"));
ToolButton bibActiveTB = new ToolButton(new IconConfig("bibButtonActive", "bibButtonOver2"));
bibActiveTB.addSelectHandler(new SelectHandler() {

@Override
Expand All @@ -273,29 +214,19 @@ public void onSelect(SelectEvent event) {
}
});
annotatedBiblographySearchController = new AnnotatedBiblographySearchController("Annotated Biblography", new AnnotatedBibliographyFilter("Bibliography"), new AnnotatedBiblographyResultView("Annotated Biblography"), bibInactiveTB, bibActiveTB);
// annotatedBiblographySearchController.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//
// @Override
// public void onValueChange(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// filterView.add(annotatedBiblographySearchController.getFilter(), 0);
// resultView.add(annotatedBiblographySearchController.getResultView(), 0);
// } else {
// annotatedBiblographySearchController.getFilter().asWidget().removeFromParent();
// annotatedBiblographySearchController.getResultView().removeFromParent();
// }
// }
// });

Resources res = GWT.create(Resources.class);
Image kuchaLogo = new Image(res.logo());

// ----------------------------------- assembling the menu bar ---------------------------------------------

selectorLayoutContainer = new HorizontalLayoutContainer();
selectorLayoutContainer.add(caveSearchController, new HorizontalLayoutData(75, 75, new Margins(5, 0, 5, 5)));
selectorLayoutContainer.add(depictionSearchController, new HorizontalLayoutData(75, 75, new Margins(5, 0, 5, 5)));
selectorLayoutContainer.add(ornamenticSearchController, new HorizontalLayoutData(75, 75, new Margins(5, 0, 5, 5)));
selectorLayoutContainer.add(annotatedBiblographySearchController, new HorizontalLayoutData(75, 75, new Margins(5, 0, 5, 5)));
selectorLayoutContainer.add(imageSearchController, new HorizontalLayoutData(75, 75, new Margins(5, 0, 5, 5)));
selectorLayoutContainer.add(kuchaLogo, new HorizontalLayoutData(159, 100, new Margins(5, 0, 5, 0)));
selectorLayoutContainer.add(caveSearchController, new HorizontalLayoutData(130, 90, new Margins(10, 10, 10, 50)));
selectorLayoutContainer.add(depictionSearchController, new HorizontalLayoutData(90, 90, new Margins(10)));
selectorLayoutContainer.add(ornamenticSearchController, new HorizontalLayoutData(90, 90, new Margins(10)));
selectorLayoutContainer.add(annotatedBiblographySearchController, new HorizontalLayoutData(90, 90, new Margins(10)));
selectorLayoutContainer.add(imageSearchController, new HorizontalLayoutData(90, 90, new Margins(10)));

ContentPanel centerPanel = new ContentPanel();
centerPanel.setHeading("Search Results");
Expand All @@ -308,26 +239,26 @@ public void onSelect(SelectEvent event) {
resultView.setColumnWidth(0, 1.0);
centerPanel.add(resultView);

ContentPanel north = new ContentPanel();
north.addStyleName("transparent");
north.getHeader().setStylePrimaryName("frame-header");
north.add(selectorLayoutContainer);
ContentPanel northContentPanel = new ContentPanel();
northContentPanel.addStyleName("transparent");
northContentPanel.getHeader().setStylePrimaryName("frame-header");
northContentPanel.add(selectorLayoutContainer);

// updating heading when user is logged in / out
UserLogin.getInstance().addCloseHandler(new CloseHandler<PopupPanel>() {

@Override
public void onClose(CloseEvent<PopupPanel> event) {
if (UserLogin.isLoggedIn()) {
north.setHeading("Welcome back, " + UserLogin.getInstance().getUsername());
northContentPanel.setHeading("Welcome back, " + UserLogin.getInstance().getUsername());
// imageSearchController.setVisible(true);
imageSearchController.setEnabled(true);
if (UserLogin.getInstance().getAccessRights() >= UserEntry.ASSOCIATED) {
loadWorkspaceToolButton.setEnabled(true);
saveWorkspaceToolButton.setEnabled(true);
}
} else {
north.setHeading("Welcome! Your are currently here as a guest!");
northContentPanel.setHeading("Welcome! Your are currently here as a guest!");
imageSearchController.setEnabled(false);
// imageSearchController.setVisible(false);
loadWorkspaceToolButton.setEnabled(false);
Expand All @@ -346,7 +277,7 @@ public void onSelect(SelectEvent event) {
}
});
loginTB.setToolTip("login");
north.addTool(loginTB);
northContentPanel.addTool(loginTB);
// northPanel.add(north, new VerticalLayoutData(1.0, .6));

filterView = new PortalLayoutContainer(1);
Expand Down Expand Up @@ -418,8 +349,8 @@ protected void onDragDrop(DndDropEvent event) {
Label footerLabel = new Label(FOOTER_TEXT);
footerLabel.setStyleName("footer");

BorderLayoutData northData = new BorderLayoutData(100);
northData.setMinSize(100);
BorderLayoutData northData = new BorderLayoutData(120);
northData.setMinSize(120);
northData.setMargins(new Margins(5, 5, 0, 5));

BorderLayoutData southData = new BorderLayoutData(20);
Expand All @@ -444,43 +375,22 @@ protected void onDragDrop(DndDropEvent event) {

view = new BorderLayoutContainer();
view.setBorders(borders);
view.setNorthWidget(north, northData);
view.setNorthWidget(northContentPanel, northData);
view.setWestWidget(filterPanel, westData);
view.setEastWidget(dataViewPanel, eastData);
view.setSouthWidget(footerLabel, southData);
view.setCenterWidget(centerPanel, centerData);
view.setStyleName("");

if (UserLogin.isLoggedIn()) {
north.setHeading("Welcome back, " + UserLogin.getInstance().getUsername());
northContentPanel.setHeading("Welcome back, " + UserLogin.getInstance().getUsername());
} else {
north.setHeading("Welcome! Your are currently here as a guest!");
northContentPanel.setHeading("Welcome! Your are currently here as a guest!");
// imageSearchController.setVisible(false);
imageSearchController.setEnabled(false);
saveWorkspaceToolButton.setEnabled(false);
loadWorkspaceToolButton.setEnabled(false);
}
}

/**
*
*/
// protected ArrayList<AbstractSearchController> getActiveFilters() {
// ArrayList<AbstractSearchController> activeSelectors = new ArrayList<AbstractSearchController>();
// Widget w;
// Iterator<Widget> it;
// AbstractSearchController selector;
// it = selectorLayoutContainer.iterator();
// while (it.hasNext()) {
// w = it.next();
// if (w instanceof AbstractSearchController) {
// selector = ((AbstractSearchController) w);
// if (selector.getValue()) {
// activeSelectors.add(selector);
// }
// }
// }
// return activeSelectors;
// }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package de.cses.client.bibliography;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.HTML;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.widget.core.client.container.MarginData;

import de.cses.client.ui.AbstractDataDisplay;
import de.cses.shared.AbstractEntry;
import de.cses.shared.AnnotatedBibliographyEntry;

public class AnnotatedBibliographyDataDisplay extends AbstractDataDisplay {

AnnotatedBibliographyEntry bibEntry;


interface AnnotatedBibliographyViewTemplates extends XTemplates {

@XTemplate(source = "AnnotatedBibliographyDisplay.html")
SafeHtml display(AnnotatedBibliographyEntry bibEntry);
}

public AnnotatedBibliographyDataDisplay(AnnotatedBibliographyEntry bibEntry) {
this.bibEntry = bibEntry;

AnnotatedBibliographyViewTemplates view = GWT.create(AnnotatedBibliographyViewTemplates.class);
HTML htmlWidget = new HTML(view.display(bibEntry));
htmlWidget.addStyleName("html-data-display");
add(htmlWidget, new MarginData(0));
setHeading(bibEntry.getTitleORG());
}

@Override
public String getUniqueID() {
return null;
}

@Override
public AbstractEntry getEntry() {
return bibEntry;
}

}
Loading

0 comments on commit 8bd8e86

Please sign in to comment.