Skip to content

Commit

Permalink
remove back button and add on geturl method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdichmann committed Oct 11, 2018
1 parent 843199f commit fda33f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
* Entry point for portlet projectbrowser-portlet. This class derives from {@link QBiCPortletUI},
* which is found in the {@code portal-utils-lib} library.
*
* @see https://github.com/qbicsoftware/portal-utils-lib
*
*/

@Theme("mytheme")
Expand Down Expand Up @@ -329,7 +329,7 @@ public GridLayout buildMainLayout(DataHandler datahandler, VaadinRequest request
w.setSizeFull();
}

mainLayout = new GridLayout(5, 3);
mainLayout = new GridLayout(3, 3);
mainLayout.setResponsive(true);
mainLayout.setWidth(100, Unit.PERCENTAGE);

Expand Down Expand Up @@ -394,78 +394,7 @@ public void buttonClick(ClickEvent event) {
header.setStyleName(ValoTheme.BUTTON_LARGE);
// header.addStyleName(ValoTheme.BUTTON_BORDERLESS);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//EINGEFÜGT VON MARC


Button backButton = new Button("Back");
backButton.setStyleName(ValoTheme.BUTTON_LARGE);
backButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

backButton.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {

String url = UI.getCurrent().getPage().getLocation().toString();
String[] urlSplitted = url.split("!");
if(urlSplitted.length > 1) {
String level = url.split("!")[1].split("/")[0];
// LOG.info(url);
// LOG.info(level);
// LOG.info(url.split("!")[1]);
// LOG.info(url.split("!")[1].split("/")[0]);

String[] urlSplits = url.split("/");
String lastSplit = urlSplits[urlSplits.length - 1];

String last = url.substring(url.lastIndexOf("/") + 1);

if (level.equals("experiment")) {

LOG.info("experiment if");
LOG.info(last + ": " + lastSplit);

navigator.navigateTo(ProjectView.navigateToLabel);
} else if (level.equals("project")) {
LOG.info("project if");
LOG.info(last + ": " + lastSplit);

navigator.navigateTo("");
} else {
LOG.info("not experiment or project");
}
}
else {
Notification.show("You are in the home screen\n" + url);
}

}
});


mainLayout.addComponent(backButton, 3, 0);


Button infoButton = new Button("Info");
infoButton.setStyleName(ValoTheme.BUTTON_LARGE);
infoButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

infoButton.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
String url = UI.getCurrent().getPage().getLocation().toString();
LOG.info(url);
Enumeration attributes = getPortletSession().getAttributeNames();
LOG.info("Session Attributes");
for (Object s : Collections.list(attributes))
LOG.info(s);
}
});


mainLayout.addComponent(infoButton, 4, 0);
// if()
// Button header2 = new Button(String.format("Current Project"))

SearchEngineView searchBarView = new SearchEngineView(datahandler);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ public void updateUI(final String type, final String id, final String filterFor)
final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(samples);
gpc.removeContainerProperty("id");
gpc.removeContainerProperty("type");
// Check if remove all coloumns fixes the result sample problem
sampleGrid.removeAllColumns();
sampleGrid.setContainerDataSource(gpc);
sampleGrid.setColumnReorderingAllowed(true);

Expand All @@ -292,7 +294,7 @@ public void itemClick(ItemClickEvent event) {
TestSampleBean selectedExp = (TestSampleBean) selected.getBean();

State state = (State) UI.getCurrent().getSession().getAttribute("state");
ArrayList<String> message = new ArrayList<String>();
ArrayList<String> message = new ArrayList< String>();
message.add("clicked");
message.add(selectedExp.getId());
message.add("sample");
Expand Down

0 comments on commit fda33f4

Please sign in to comment.