From 99d12dabc13db7f04f4c1602bfae825cb85764fc Mon Sep 17 00:00:00 2001 From: Miki Date: Sat, 4 Jul 2020 19:02:55 +0300 Subject: [PATCH] #174 done demo app now has views (each tab is its own view) --- demo-v14/frontend/styles/demo-styles.css | 4 + ...ainView.java => DemoComponentFactory.java} | 214 +++++++++--------- .../main/java/org/vaadin/miki/DemoPage.java | 43 ++++ .../main/java/org/vaadin/miki/InfoPage.java | 4 + .../main/java/org/vaadin/miki/MainLayout.java | 58 +++++ 5 files changed, 218 insertions(+), 105 deletions(-) rename demo-v14/src/main/java/org/vaadin/miki/{MainView.java => DemoComponentFactory.java} (87%) create mode 100644 demo-v14/src/main/java/org/vaadin/miki/DemoPage.java create mode 100644 demo-v14/src/main/java/org/vaadin/miki/MainLayout.java diff --git a/demo-v14/frontend/styles/demo-styles.css b/demo-v14/frontend/styles/demo-styles.css index a67ec115..4a6939ae 100644 --- a/demo-v14/frontend/styles/demo-styles.css +++ b/demo-v14/frontend/styles/demo-styles.css @@ -65,3 +65,7 @@ span.highlighted { padding: 1em; margin: 1em; } + +.tab-icon { + margin-right: 5px; +} \ No newline at end of file diff --git a/demo-v14/src/main/java/org/vaadin/miki/MainView.java b/demo-v14/src/main/java/org/vaadin/miki/DemoComponentFactory.java similarity index 87% rename from demo-v14/src/main/java/org/vaadin/miki/MainView.java rename to demo-v14/src/main/java/org/vaadin/miki/DemoComponentFactory.java index 58c9525a..32b75502 100644 --- a/demo-v14/src/main/java/org/vaadin/miki/MainView.java +++ b/demo-v14/src/main/java/org/vaadin/miki/DemoComponentFactory.java @@ -7,23 +7,20 @@ import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.checkbox.Checkbox; import com.vaadin.flow.component.combobox.ComboBox; -import com.vaadin.flow.component.dependency.CssImport; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Paragraph; import com.vaadin.flow.component.html.Span; import com.vaadin.flow.component.icon.Icon; import com.vaadin.flow.component.icon.VaadinIcon; import com.vaadin.flow.component.notification.Notification; +import com.vaadin.flow.component.orderedlayout.FlexComponent; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.radiobutton.RadioButtonGroup; -import com.vaadin.flow.component.tabs.Tab; import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.textfield.TextFieldVariant; import com.vaadin.flow.function.SerializableBiConsumer; import com.vaadin.flow.function.SerializableConsumer; -import com.vaadin.flow.router.PageTitle; -import com.vaadin.flow.router.Route; import org.slf4j.LoggerFactory; import org.vaadin.miki.events.text.TextSelectionNotifier; import org.vaadin.miki.markers.CanReceiveSelectionEventsFromClient; @@ -53,6 +50,8 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Locale; @@ -61,24 +60,20 @@ import java.util.function.Supplier; /** - * Demo app for various SuperFields and other components. + * Stores information about components to demo. + * This is a singleton. * @author miki - * @since 2020-04-07 + * @since 2020-07-04 */ -@CssImport("./styles/demo-styles.css") -@CssImport(value = "./styles/super-number-fields-styles.css", themeFor = "vaadin-text-field") -@CssImport(value = "./styles/super-tabs-styles.css", themeFor = "vaadin-tabs") -@Route -@PageTitle("SuperFields Demo") -public class MainView extends VerticalLayout { +public final class DemoComponentFactory { private static final int NOTIFICATION_TIME = 1500; - private final Map, Component> components = new LinkedHashMap<>(); + private static final DemoComponentFactory INSTANCE = new DemoComponentFactory(); - private final Map, SerializableConsumer> afterLocaleChange = new HashMap<>(); - - private final Map, SerializableBiConsumer>> contentBuilders = new LinkedHashMap<>(); + public static DemoComponentFactory get() { + return INSTANCE; + } private static Component generateParagraph(Class type, int row, int column) { Paragraph result = new Paragraph(type.getSimpleName()); @@ -100,6 +95,81 @@ private static Component generateDiv(Class type, int row, i }).withId(type.getSimpleName()+"-"+row+"-"+column); } + private final Map, Component> components = new LinkedHashMap<>(); + + private final Map, SerializableBiConsumer>> contentBuilders = new LinkedHashMap<>(); + + private final Map, SerializableConsumer> afterLocaleChange = new HashMap<>(); + + private DemoComponentFactory() { + this.components.put(SuperIntegerField.class, new SuperIntegerField("Integer (6 digits):").withMaximumIntegerDigits(6)); + this.components.put(SuperLongField.class, new SuperLongField("Long (11 digits):").withMaximumIntegerDigits(11).withId("long")); + this.components.put(SuperDoubleField.class, new SuperDoubleField("Double (8 + 4 digits):").withMaximumIntegerDigits(8).withMaximumFractionDigits(4)); + this.components.put(SuperBigDecimalField.class, new SuperBigDecimalField("Big decimal (12 + 3 digits):").withMaximumIntegerDigits(12).withMaximumFractionDigits(3).withMinimumFractionDigits(1).withId("big-decimal")); + this.components.put(SuperDatePicker.class, new SuperDatePicker("Pick a date:").withDatePattern(DatePatterns.YYYY_MM_DD).withValue(LocalDate.now())); + this.components.put(SuperDateTimePicker.class, new SuperDateTimePicker("Pick a date and time:").withDatePattern(DatePatterns.M_D_YYYY_SLASH).withValue(LocalDateTime.now())); + this.components.put(SuperTextField.class, new SuperTextField("Type something:").withPlaceholder("(nothing typed)").withId("super-text-field")); + this.components.put(SuperTextArea.class, new SuperTextArea("Type a lot of something:").withPlaceholder("(nothing typed)").withId("super-text-area")); + this.components.put(SuperTabs.class, new SuperTabs((Supplier) HorizontalLayout::new) + .withTabContentGenerator(s -> new Paragraph("Did you know? All SuperFields are "+s)) + .withItems( + "Java friendly", "Super-configurable", "Open source", + "Fun to use", "Reasonably well documented" + ).withId("super-tabs") + ); + this.components.put(ObservedField.class, new ObservedField()); + this.components.put(ComponentObserver.class, new ComponentObserver()); + this.components.put(UnloadObserver.class, UnloadObserver.get().withoutQueryingOnUnload()); + this.components.put(ItemGrid.class, new ItemGrid>( + null, + () -> { + VerticalLayout result = new VerticalLayout(); + result.setSpacing(true); + result.setPadding(true); + result.setAlignItems(FlexComponent.Alignment.STRETCH); + result.setWidthFull(); + return result; + }, + DemoComponentFactory::generateParagraph, + event -> { + if (event.isSelected()) + event.getCellInformation().getComponent().getElement().getClassList().add("selected"); + else event.getCellInformation().getComponent().getElement().getClassList().remove("selected"); + }, + SuperIntegerField.class, SuperLongField.class, SuperDoubleField.class, + SuperBigDecimalField.class, SuperDatePicker.class, SuperDateTimePicker.class, + SuperTabs.class, LazyLoad.class, ObservedField.class, + ComponentObserver.class, UnloadObserver.class, ItemGrid.class + ) + .withRowComponentGenerator(rowNumber -> { + HorizontalLayout result = new HorizontalLayout(); + result.setSpacing(true); + result.setAlignItems(FlexComponent.Alignment.CENTER); + result.setPadding(true); + return result; + }) + ); + + this.contentBuilders.put(CanSelectText.class, this::buildCanSelectText); + this.contentBuilders.put(HasValue.class, this::buildHasValue); + this.contentBuilders.put(AbstractSuperNumberField.class, this::buildAbstractSuperNumberField); + this.contentBuilders.put(WithNullValueOptionallyAllowed.class, this::buildNullValueOptionallyAllowed); + this.contentBuilders.put(HasLocale.class, this::buildHasLocale); + this.contentBuilders.put(ItemGrid.class, this::buildItemGrid); + this.contentBuilders.put(HasDatePattern.class, this::buildHasDatePattern); + this.contentBuilders.put(SuperTabs.class, this::buildSuperTabs); + this.contentBuilders.put(ObservedField.class, this::buildObservedField); + this.contentBuilders.put(ComponentObserver.class, this::buildIntersectionObserver); + this.contentBuilders.put(UnloadObserver.class, this::buildUnloadObserver); + this.contentBuilders.put(FocusNotifier.class, this::buildFocusNotifier); + this.contentBuilders.put(BlurNotifier.class, this::buildBlurNotifier); + + this.afterLocaleChange.put(SuperIntegerField.class, o -> ((SuperIntegerField)o).setMaximumIntegerDigits(6)); + this.afterLocaleChange.put(SuperLongField.class, o -> ((SuperLongField)o).setMaximumIntegerDigits(11)); + this.afterLocaleChange.put(SuperDoubleField.class, o -> ((SuperDoubleField)o).withMaximumIntegerDigits(8).setMaximumFractionDigits(4)); + this.afterLocaleChange.put(SuperBigDecimalField.class, o -> ((SuperBigDecimalField)o).withMaximumIntegerDigits(12).withMaximumFractionDigits(3).setMinimumFractionDigits(1)); + } + private void buildAbstractSuperNumberField(Component component, Consumer callback) { final Checkbox autoselect = new Checkbox("Select automatically on focus?"); autoselect.addValueChangeListener(event -> ((AbstractSuperNumberField) component).setAutoselect(event.getValue())); @@ -130,7 +200,7 @@ private void buildAbstractSuperNumberField(Component component, Consumer callback) { ((FocusNotifier)component).addFocusListener(event -> - Notification.show("Component "+component.getClass().getSimpleName()+" received focus.", NOTIFICATION_TIME, Notification.Position.BOTTOM_END) + Notification.show("Component "+component.getClass().getSimpleName()+" received focus.", NOTIFICATION_TIME, Notification.Position.BOTTOM_END) ); callback.accept(new Component[]{new Span("Focus the demo component to see a notification.")}); } @@ -169,7 +239,7 @@ private void buildCanSelectText(Component component, Consumer callb final Button selectAll = new Button("Select all", event -> ((CanSelectText)component).selectAll()); final Button selectNone = new Button("Select none", event -> ((CanSelectText)component).selectNone()); final HorizontalLayout layout = new HorizontalLayout(new Span("Type something in the field, then click one of the buttons:"), selectAll, selectNone); - layout.setAlignItems(Alignment.CENTER); + layout.setAlignItems(FlexComponent.Alignment.CENTER); callback.accept(new Component[]{ layout }); @@ -200,7 +270,7 @@ private void buildItemGrid(Component component, Consumer callback) final Checkbox alternate = new Checkbox("Display lazy loading cells?", event -> ((ItemGrid>)component).setCellGenerator( - event.getValue() ? MainView::generateDiv : MainView::generateParagraph + event.getValue() ? DemoComponentFactory::generateDiv : DemoComponentFactory::generateParagraph ) ); @@ -220,7 +290,7 @@ private void buildHasDatePattern(Component component, Consumer call icon.setColor("green"); icon.getElement().setAttribute("title", "Setting pattern does not work out of the box for SuperDateTimePicker if it is in an invisible layout. See issue #87, https://github.com/vaadin-miki/super-fields/issues/87."); clearPatternOrContainer = new HorizontalLayout(clearPattern, icon); - ((HorizontalLayout)clearPatternOrContainer).setAlignItems(Alignment.CENTER); + ((HorizontalLayout)clearPatternOrContainer).setAlignItems(FlexComponent.Alignment.CENTER); } patterns.addValueChangeListener(event -> { ((HasDatePattern) component).setDatePattern(event.getValue()); @@ -270,7 +340,7 @@ private void buildUnloadObserver(Component component, Consumer call ((UnloadObserver)component).addUnloadListener(event -> { if(event.isBecauseOfQuerying()) counter.setText(String.valueOf(Integer.parseInt(counter.getText()) + 1)); - LoggerFactory.getLogger(this.getClass()).info("Unload event; attempt? {}; captured in {} and UnloadObserver is inside {}", event.isBecauseOfQuerying(), this.getClass().getSimpleName(), event.getSource().getParent().orElse(this).getClass().getSimpleName()); + LoggerFactory.getLogger(this.getClass()).info("Unload event; attempt? {}; captured in {} and UnloadObserver is inside {}", event.isBecauseOfQuerying(), this.getClass().getSimpleName(), event.getSource().getParent().orElse(new Span()).getClass().getSimpleName()); }); callback.accept(new Component[]{query, description, new HorizontalLayout(counterText, counter)}); @@ -289,7 +359,24 @@ private void buildSuperTabs(Component component, Consumer callback) callback.accept(new Component[]{multilineTabs, tabHandlers}); } - private Component buildContentsFor(Class type) { + private void onAnyValueChanged(HasValue.ValueChangeEvent valueChangeEvent) { + Notification.show(String.format("%s changed value to %s", valueChangeEvent.getHasValue().getClass().getSimpleName(), valueChangeEvent.getValue())); + } + + /** + * Returns the collection of {@link Component} types. + * @return Unmodifiable collection of classes. + */ + public Collection> getDemoableComponentTypes() { + return Collections.unmodifiableCollection(this.components.keySet()); + } + + /** + * Builds the page for a given component type. + * @param type Type of component to build page for. + * @return A demo page. + */ + public Component buildDemoPageFor(Class type) { Component component = this.components.get(type); component.getElement().getClassList().add("demo"); Div result = new Div(); @@ -319,87 +406,4 @@ private Component buildContentsFor(Class type) { return result; } - private void onAnyValueChanged(HasValue.ValueChangeEvent valueChangeEvent) { - Notification.show(String.format("%s changed value to %s", valueChangeEvent.getHasValue().getClass().getSimpleName(), valueChangeEvent.getValue())); - } - - public MainView() { - this.components.put(SuperIntegerField.class, new SuperIntegerField("Integer (6 digits):").withMaximumIntegerDigits(6)); - this.components.put(SuperLongField.class, new SuperLongField("Long (11 digits):").withMaximumIntegerDigits(11).withId("long")); - this.components.put(SuperDoubleField.class, new SuperDoubleField("Double (8 + 4 digits):").withMaximumIntegerDigits(8).withMaximumFractionDigits(4)); - this.components.put(SuperBigDecimalField.class, new SuperBigDecimalField("Big decimal (12 + 3 digits):").withMaximumIntegerDigits(12).withMaximumFractionDigits(3).withMinimumFractionDigits(1).withId("big-decimal")); - this.components.put(SuperDatePicker.class, new SuperDatePicker("Pick a date:").withDatePattern(DatePatterns.YYYY_MM_DD).withValue(LocalDate.now())); - this.components.put(SuperDateTimePicker.class, new SuperDateTimePicker("Pick a date and time:").withDatePattern(DatePatterns.M_D_YYYY_SLASH).withValue(LocalDateTime.now())); - this.components.put(SuperTextField.class, new SuperTextField("Type something:").withPlaceholder("(nothing typed)").withId("super-text-field")); - this.components.put(SuperTextArea.class, new SuperTextArea("Type a lot of something:").withPlaceholder("(nothing typed)").withId("super-text-area")); - this.components.put(SuperTabs.class, new SuperTabs((Supplier) HorizontalLayout::new) - .withTabContentGenerator(s -> new Paragraph("Did you know? All SuperFields are "+s)) - .withItems( - "Java friendly", "Super-configurable", "Open source", - "Fun to use", "Reasonably well documented" - ).withId("super-tabs") - ); - this.components.put(ObservedField.class, new ObservedField()); - this.components.put(ComponentObserver.class, new ComponentObserver()); - this.components.put(UnloadObserver.class, UnloadObserver.get().withoutQueryingOnUnload()); - this.components.put(ItemGrid.class, new ItemGrid>( - null, - () -> { - VerticalLayout result = new VerticalLayout(); - result.setSpacing(true); - result.setPadding(true); - result.setAlignItems(Alignment.STRETCH); - result.setWidthFull(); - return result; - }, - MainView::generateParagraph, - event -> { - if (event.isSelected()) - event.getCellInformation().getComponent().getElement().getClassList().add("selected"); - else event.getCellInformation().getComponent().getElement().getClassList().remove("selected"); - }, - SuperIntegerField.class, SuperLongField.class, SuperDoubleField.class, - SuperBigDecimalField.class, SuperDatePicker.class, SuperDateTimePicker.class, - SuperTabs.class, LazyLoad.class, ObservedField.class, - ComponentObserver.class, UnloadObserver.class, ItemGrid.class - ) - .withRowComponentGenerator(rowNumber -> { - HorizontalLayout result = new HorizontalLayout(); - result.setSpacing(true); - result.setAlignItems(Alignment.CENTER); - result.setPadding(true); - return result; - }) - ); - - this.contentBuilders.put(CanSelectText.class, this::buildCanSelectText); - this.contentBuilders.put(HasValue.class, this::buildHasValue); - this.contentBuilders.put(AbstractSuperNumberField.class, this::buildAbstractSuperNumberField); - this.contentBuilders.put(WithNullValueOptionallyAllowed.class, this::buildNullValueOptionallyAllowed); - this.contentBuilders.put(HasLocale.class, this::buildHasLocale); - this.contentBuilders.put(ItemGrid.class, this::buildItemGrid); - this.contentBuilders.put(HasDatePattern.class, this::buildHasDatePattern); - this.contentBuilders.put(SuperTabs.class, this::buildSuperTabs); - this.contentBuilders.put(ObservedField.class, this::buildObservedField); - this.contentBuilders.put(ComponentObserver.class, this::buildIntersectionObserver); - this.contentBuilders.put(UnloadObserver.class, this::buildUnloadObserver); - this.contentBuilders.put(FocusNotifier.class, this::buildFocusNotifier); - this.contentBuilders.put(BlurNotifier.class, this::buildBlurNotifier); - - this.afterLocaleChange.put(SuperIntegerField.class, o -> ((SuperIntegerField)o).setMaximumIntegerDigits(6)); - this.afterLocaleChange.put(SuperLongField.class, o -> ((SuperLongField)o).setMaximumIntegerDigits(11)); - this.afterLocaleChange.put(SuperDoubleField.class, o -> ((SuperDoubleField)o).withMaximumIntegerDigits(8).setMaximumFractionDigits(4)); - this.afterLocaleChange.put(SuperBigDecimalField.class, o -> ((SuperBigDecimalField)o).withMaximumIntegerDigits(12).withMaximumFractionDigits(3).setMinimumFractionDigits(1)); - - final SuperTabs> tabs = new SuperTabs>( - type -> new Tab(type.getSimpleName()), - this::buildContentsFor - ); - - tabs.addTab(MainView.class, new Tab(new Icon(VaadinIcon.INFO_CIRCLE), new Span("SuperFields demo")), new InfoPage()); - - tabs.addTab(this.components.keySet().toArray(new Class[0])); - - this.add(tabs); - } } diff --git a/demo-v14/src/main/java/org/vaadin/miki/DemoPage.java b/demo-v14/src/main/java/org/vaadin/miki/DemoPage.java new file mode 100644 index 00000000..dab5c6e5 --- /dev/null +++ b/demo-v14/src/main/java/org/vaadin/miki/DemoPage.java @@ -0,0 +1,43 @@ +package org.vaadin.miki; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.html.Span; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.BeforeEvent; +import com.vaadin.flow.router.HasDynamicTitle; +import com.vaadin.flow.router.HasUrlParameter; +import com.vaadin.flow.router.Route; + +/** + * Page that shows a demo of a component. + * @author miki + * @since 2020-07-04 + */ +@Route(value = "demo", layout = MainLayout.class) +public class DemoPage extends VerticalLayout implements HasUrlParameter, HasDynamicTitle { + + private Class componentType; + + @Override + public void setParameter(BeforeEvent event, String parameter) { + this.removeAll(); + DemoComponentFactory.get().getDemoableComponentTypes().stream() + .filter(type -> type.getSimpleName().equalsIgnoreCase(parameter)) + .findFirst().ifPresentOrElse(this::buildDemoPageFor, this::buildErrorPage); + } + + private void buildDemoPageFor(Class type) { + this.componentType = type; + this.add(DemoComponentFactory.get().buildDemoPageFor(type)); + } + + private void buildErrorPage() { + this.componentType = null; + this.add(new Span("You are seeing this because there was a problem in navigating to the demo page for your selected component.")); + } + + @Override + public String getPageTitle() { + return this.componentType == null ? "SuperFields - Error page" : "SuperFields - Demo for "+this.componentType.getSimpleName(); + } +} diff --git a/demo-v14/src/main/java/org/vaadin/miki/InfoPage.java b/demo-v14/src/main/java/org/vaadin/miki/InfoPage.java index f1fa5589..1948ed25 100644 --- a/demo-v14/src/main/java/org/vaadin/miki/InfoPage.java +++ b/demo-v14/src/main/java/org/vaadin/miki/InfoPage.java @@ -3,12 +3,16 @@ import com.vaadin.flow.component.html.Anchor; import com.vaadin.flow.component.html.Span; import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; /** * Information about the demo, its organisation and components. * @author miki * @since 2020-06-03 */ +@Route(value = "", layout = MainLayout.class) +@PageTitle("SuperFields - Demo App") public class InfoPage extends VerticalLayout { public InfoPage() { diff --git a/demo-v14/src/main/java/org/vaadin/miki/MainLayout.java b/demo-v14/src/main/java/org/vaadin/miki/MainLayout.java new file mode 100644 index 00000000..0a22a5d6 --- /dev/null +++ b/demo-v14/src/main/java/org/vaadin/miki/MainLayout.java @@ -0,0 +1,58 @@ +package org.vaadin.miki; + +import com.vaadin.flow.component.dependency.CssImport; +import com.vaadin.flow.component.html.Span; +import com.vaadin.flow.component.icon.Icon; +import com.vaadin.flow.component.icon.VaadinIcon; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.component.tabs.Tab; +import com.vaadin.flow.component.tabs.Tabs; +import com.vaadin.flow.router.AfterNavigationEvent; +import com.vaadin.flow.router.AfterNavigationObserver; +import com.vaadin.flow.router.RouterLayout; +import com.vaadin.flow.router.RouterLink; + +import java.util.HashMap; +import java.util.Map; + +/** + * Main layout of the application. + * @author miki + * @since 2020-07-04 + */ +@CssImport("./styles/demo-styles.css") +@CssImport(value = "./styles/super-number-fields-styles.css", themeFor = "vaadin-text-field") +@CssImport(value = "./styles/super-tabs-styles.css", themeFor = "vaadin-tabs") +public class MainLayout extends VerticalLayout implements RouterLayout, AfterNavigationObserver { + + private final Tabs navigationTabs = new Tabs(); + + private final Map tabs = new HashMap<>(); + + public MainLayout() { + // set up tabs + this.navigationTabs.setWidthFull(); + final RouterLink infoLink = new RouterLink(); + infoLink.setRoute(InfoPage.class); + final Icon icon = new Icon(VaadinIcon.INFO_CIRCLE); + icon.setSize("16px"); + icon.setColor("blue"); + icon.addClassName("tab-icon"); + infoLink.add(icon, new Span("SuperFields demo")); + this.navigationTabs.add(new Tab(infoLink)); + DemoComponentFactory.get().getDemoableComponentTypes().stream().map(type -> { + Tab tab = new Tab(new RouterLink(type.getSimpleName(), DemoPage.class, type.getSimpleName().toLowerCase())); + this.tabs.put(type.getSimpleName().toLowerCase(), tab); + return tab; + }).forEach(this.navigationTabs::add); + this.add(this.navigationTabs); + } + + @Override + public void afterNavigation(AfterNavigationEvent event) { + if(event.getLocation().getPath().isEmpty()) + this.navigationTabs.setSelectedIndex(0); + else + this.navigationTabs.setSelectedTab(this.tabs.get(event.getLocation().getSegments().get(1))); + } +}