Implemented appview url tabbing

This commit is contained in:
F43nd1r 2017-05-20 02:33:17 +02:00
parent 2d43278851
commit f41e8fa6b2
7 changed files with 28 additions and 5 deletions

View file

@ -18,7 +18,7 @@ apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group 'com.faendir'
version = '0.0.1-SNAPSHOT'
version = '0.1.0-SNAPSHOT'
sourceCompatibility = 1.8
ext.debug = true;

View file

@ -48,6 +48,8 @@ public final class ReportUtils {
FileUtils.writeStringToFile(file, mapping.getMappings());
StringWriter writer = new StringWriter();
new ReTrace(ReTrace.STACK_TRACE_EXPRESSION, false, file).retrace(new LineNumberReader(new StringReader(stacktrace)), new PrintWriter(writer));
//noinspection ResultOfMethodCallIgnored
file.delete();
return writer.toString();
}

View file

@ -54,7 +54,8 @@ public class NavigationManager {
}
public void navigateTo(Class<? extends NamedView> namedView, String contentId) {
String target = applicationContext.getBean(namedView).getName() + (contentId == null ? "" : "/" + contentId);
NamedView view = applicationContext.getBean(namedView);
String target = view.getName() + (contentId == null ? "" : "/" + contentId) + view.fragmentSuffix();
backStack.add(0, target);
navigator.navigateTo(target);
}

View file

@ -37,9 +37,15 @@ public class AppView extends NamedView {
return "app";
}
@Override
public String fragmentSuffix() {
return "/" + BugTab.CAPTION;
}
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
App app = appManager.getApp(event.getParameters());
String[] parameters = event.getParameters().split("/");
App app = appManager.getApp(parameters[0]);
VerticalLayout statistics = new VerticalLayout(new Label("Coming soon"));
statistics.setCaption("Statistics");
statistics.setSizeFull();
@ -52,5 +58,14 @@ public class AppView extends NamedView {
Style.apply(content, Style.NO_PADDING, Style.PADDING_LEFT, Style.PADDING_RIGHT, Style.PADDING_BOTTOM);
setCompositionRoot(content);
setSizeFull();
if (parameters.length >= 2) {
for (com.vaadin.ui.Component component : tabSheet) {
if (component.getCaption().equals(parameters[1])) {
tabSheet.setSelectedTab(component);
break;
}
}
}
tabSheet.addSelectedTabChangeListener(e -> getUI().getPage().setUriFragment(getName() + "/" + app.getId() + "/" + tabSheet.getSelectedTab().getCaption(), false));
}
}

View file

@ -15,6 +15,7 @@ import com.vaadin.ui.VerticalLayout;
* @since 17.05.2017
*/
public class BugTab extends CustomComponent implements ReportManager.ChangeListener {
public static final String CAPTION = "Bugs";
private final VerticalLayout root;
private final String app;
private final NavigationManager navigationManager;
@ -37,7 +38,7 @@ public class BugTab extends CustomComponent implements ReportManager.ChangeListe
root.setSizeFull();
setCompositionRoot(root);
setSizeFull();
setCaption("Bugs");
setCaption(CAPTION);
addAttachListener(e -> reportManager.addListener(this));
addDetachListener(e -> reportManager.removeListener(this));
}

View file

@ -19,6 +19,10 @@ public abstract class NamedView extends CustomComponent implements View {
public abstract String getName();
public String fragmentSuffix(){
return "";
}
NavigationManager getNavigationManager() {
return navigationManager;
}

View file

@ -27,7 +27,7 @@
}
.v-panel-content>.v-gridlayout>.v-gridlayout-slot:last-child {
box-shadow: inset 0px 0px 0px 0px black;
box-shadow: none;
}
.no-padding {