TAMAYA-150: Renamed component view. Enabled more i18n related entries. Improved UI.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/1379095a Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/1379095a Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/1379095a Branch: refs/heads/master Commit: 1379095afa50bd095baa172e66a86cb8ddd3ed5a Parents: 776fdc6 Author: anatole <anat...@apache.org> Authored: Tue Apr 19 15:52:38 2016 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Apr 19 15:52:38 2016 +0200 ---------------------------------------------------------------------- .../mutableconfig/ui/ConfigUpdaterView.java | 21 ++- .../main/resources/ui/lang/tamaya.properties | 23 +++ .../org/apache/tamaya/ui/ApplicationLayout.java | 4 +- .../main/java/org/apache/tamaya/ui/NavBar.java | 3 +- .../java/org/apache/tamaya/ui/VadiinApp.java | 4 +- .../tamaya/ui/components/LazyProvider.java | 2 +- .../ConfigurationBasedMessageProvider.java | 2 +- .../apache/tamaya/ui/views/ComponentView.java | 187 ------------------- .../org/apache/tamaya/ui/views/HomeView.java | 2 +- .../org/apache/tamaya/ui/views/SystemView.java | 187 +++++++++++++++++++ .../services/org.apache.tamaya.ui.ViewProvider | 2 +- ui/src/main/resources/ui/lang/tamaya.properties | 4 +- 12 files changed, 234 insertions(+), 207 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java ---------------------------------------------------------------------- diff --git a/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java b/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java index 7a4956c..81dfc3f 100644 --- a/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java +++ b/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java @@ -43,7 +43,7 @@ public class ConfigUpdaterView extends VerticalSpacedLayout implements View { /** * Provider to register the view. */ - @Priority(20) + @Priority(50) public static final class Provider implements ViewProvider{ @Override @@ -58,7 +58,8 @@ public class ConfigUpdaterView extends VerticalSpacedLayout implements View { @Override public String getDisplayName() { - return "view.update.name"; + return ServiceContextManager.getServiceContext().getService(MessageProvider.class) + .getMessage("view.edit.name"); } @Override @@ -67,26 +68,32 @@ public class ConfigUpdaterView extends VerticalSpacedLayout implements View { } } - private ComboBox changePropagationPolicy = new ComboBox("view.update.select.propagationPolicy", + private ComboBox changePropagationPolicy = new ComboBox(ServiceContextManager.getServiceContext() + .getService(MessageProvider.class).getMessage("view.edit.select.propagationPolicy"), Arrays.asList(new String[]{"ALL", "MOST_SIGNIFICANT_ONLY", "SELECTIVE", "NONE"})); - private TextField changePropagationPolicyOther = new TextField("view.update.text.propagationPolicyOther", + private TextField changePropagationPolicyOther = new TextField( + ServiceContextManager.getServiceContext().getService(MessageProvider.class) + .getMessage("view.edit.text.propagationPolicyOther"), MutableConfigurationProvider.getApplyAllChangePolicy().getClass().getName()); private TextArea generalInfo = new TextArea(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.update.textArea.general")); + .getService(MessageProvider.class).getMessage("view.edit.textArea.general")); public ConfigUpdaterView() { Label caption = new Label(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.update.name")); + .getService(MessageProvider.class).getMessage("view.edit.name")); Label description = new Label(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.update.description"), + .getService(MessageProvider.class).getMessage("view.edit.description"), ContentMode.HTML); caption.addStyleName(UIConstants.LABEL_HUGE); description.addStyleName(UIConstants.LABEL_LARGE); + changePropagationPolicy.setWidth(300, Unit.PIXELS); + changePropagationPolicyOther.setWidth(600, Unit.PIXELS); + generalInfo.setWidth(100, Unit.PERCENTAGE); addComponents(caption, description,changePropagationPolicy,changePropagationPolicyOther,generalInfo); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/mutable-config/src/main/resources/ui/lang/tamaya.properties ---------------------------------------------------------------------- diff --git a/mutable-config/src/main/resources/ui/lang/tamaya.properties b/mutable-config/src/main/resources/ui/lang/tamaya.properties new file mode 100644 index 0000000..8f7d227 --- /dev/null +++ b/mutable-config/src/main/resources/ui/lang/tamaya.properties @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy current the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +view.edit.name=Edit Configuration +view.edit.description=This is a simple Tamaya configuration editor for changing configuration values. +view.edit.select.propagationPolicy=Change Propagation Policy +view.edit.text.propagationPolicyOther=Custom Change Propagation Policy (Class) +view.edit.textArea.general=General Infos \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java index 3c3b68e..01df605 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java +++ b/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java @@ -79,8 +79,6 @@ public class ApplicationLayout extends HorizontalLayout { switch (provider.getLifecycle()) { case CREATE: - navigator.addView(provider.getUrlPattern(), provider.createView()); - break; case EAGER: try { navigator.addView(provider.getUrlPattern(), provider.createView()); @@ -93,6 +91,6 @@ public class ApplicationLayout extends HorizontalLayout { navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider)); break; } - navBar.addView(provider.getUrlPattern(), provider.getDisplayName()); + navBar.addViewButton(provider.getUrlPattern(), provider.getDisplayName()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/NavBar.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/ui/src/main/java/org/apache/tamaya/ui/NavBar.java index 464bcd6..efc13a5 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/NavBar.java +++ b/ui/src/main/java/org/apache/tamaya/ui/NavBar.java @@ -71,7 +71,7 @@ public class NavBar extends CssLayout implements ViewChangeListener { logout.setIcon(FontAwesome.SIGN_OUT); } - public void addView(final String uri, String displayName) { + public void addViewButton(final String uri, String displayName) { Button viewButton = new Button(displayName, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { @@ -81,7 +81,6 @@ public class NavBar extends CssLayout implements ViewChangeListener { viewButton.addStyleName(UIConstants.MENU_ITEM); viewButton.addStyleName(UIConstants.BUTTON_BORDERLESS); buttonMap.put(uri, viewButton); - addComponent(viewButton, components.size() - 1); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java index d763930..9f8b37c 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java +++ b/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java @@ -67,8 +67,8 @@ public class VadiinApp extends UI { } @Subscribe - public void navigateTo(NavigationEvent view) { - getNavigator().navigateTo(view.getViewName()); + public void navigateTo(NavigationEvent evt) { + getNavigator().navigateTo(evt.getViewName()); } public static VadiinApp getCurrent() { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java index 867b802..5bc69cf 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java +++ b/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java @@ -37,7 +37,7 @@ public class LazyProvider implements com.vaadin.navigator.ViewProvider { @Override public String getViewName(String s) { - return provider.getDisplayName(); + return provider.getUrlPattern(); } @Override http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java index 78d6167..6f0baf1 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java +++ b/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java @@ -85,7 +85,7 @@ public final class ConfigurationBasedMessageProvider implements MessageProvider{ return value; } } - return null; + return key; } private Map<String, String> loadEntries(String bundleID) { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java deleted file mode 100644 index a751e02..0000000 --- a/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.ui.views; - -import com.vaadin.navigator.View; -import com.vaadin.navigator.ViewChangeListener; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.Label; -import com.vaadin.ui.Tree; -import org.apache.tamaya.Configuration; -import org.apache.tamaya.ConfigurationProvider; -import org.apache.tamaya.TypeLiteral; -import org.apache.tamaya.spi.PropertyConverter; -import org.apache.tamaya.spi.PropertyFilter; -import org.apache.tamaya.spi.PropertySource; -import org.apache.tamaya.spi.PropertyValueCombinationPolicy; -import org.apache.tamaya.spi.ServiceContextManager; -import org.apache.tamaya.ui.UIConstants; -import org.apache.tamaya.ui.ViewProvider; -import org.apache.tamaya.ui.components.VerticalSpacedLayout; -import org.apache.tamaya.ui.services.MessageProvider; - -import javax.annotation.Priority; -import java.util.List; -import java.util.Map; - -/** - * View showing the current loaded system components. - */ -public class ComponentView extends VerticalSpacedLayout implements View { - - - /** - * Provider to register this view. - */ - @Priority(20) - public static final class Provider implements ViewProvider{ - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.CREATE; - } - - @Override - public String getUrlPattern() { - return "/components"; - } - - @Override - public String getDisplayName() { - return ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage("view.components.name"); - } - - @Override - public View createView(){ - return new ComponentView(); - } - } - - - private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage("default.label.components")); - - - public ComponentView() { - Label caption = new Label("Components"); - Label description = new Label( - "This view shows the components currently active. This information may be useful when checking if an" + - "configuration extension is loaded and for inspection of the configuration and property sources" + - "invovlved.", - ContentMode.HTML); - - fillComponentTree(); - - addComponents(caption, description, configTree); - - caption.addStyleName(UIConstants.LABEL_HUGE); - description.addStyleName(UIConstants.LABEL_LARGE); - - } - - private void fillComponentTree() { - configTree.removeAllItems(); - Configuration config = ConfigurationProvider.getConfiguration(); - - String currentParent = "General"; - configTree.addItem(currentParent); - configTree.addItem("Configuration.class"); - configTree.setItemCaption("Configuration.class", "Configuration class = " + config.getClass().getName()); - configTree.setParent("Configuration.class", currentParent); - configTree.setChildrenAllowed("Configuration.class", false); - - configTree.addItem("ConfigurationContext.class"); - configTree.setItemCaption("ConfigurationContext.class", "ConfigurationContext class = " + - config.getContext().getClass().getName()); - configTree.setParent("ConfigurationContext.class", currentParent); - configTree.setChildrenAllowed("ConfigurationContext.class", false); - - configTree.addItem("PropertyValueCombinationPolicy.class"); - configTree.setItemCaption("PropertyValueCombinationPolicy.class", - PropertyValueCombinationPolicy.class.getSimpleName() + " class = " + - config.getContext().getPropertyValueCombinationPolicy().getClass().getName()); - configTree.setParent("PropertyValueCombinationPolicy.class", currentParent); - configTree.setChildrenAllowed("PropertyValueCombinationPolicy.class", false); - - configTree.addItem("ConfigurationContext.types"); - configTree.setItemCaption("ConfigurationContext.types", "Configurable types"); - configTree.setParent("ConfigurationContext.types", currentParent); - for(Map.Entry<TypeLiteral<?>,List<PropertyConverter<?>>> en:config.getContext().getPropertyConverters().entrySet()){ - configTree.addItem(en.getKey()); - configTree.setItemCaption(en.getKey(), "Type = " + en.getKey().toString()); - configTree.setParent(en.getKey(), "ConfigurationContext.types"); - for(PropertyConverter conv: en.getValue()){ - configTree.addItem(conv); - configTree.setItemCaption(conv, conv.getClass().getName()); - configTree.setChildrenAllowed(conv, false); - configTree.setParent(conv, en.getKey()); - } - } - configTree.addItem("ConfigurationContext.filters"); - configTree.setItemCaption("ConfigurationContext.filters", "Property Filters"); - for(PropertyFilter filter: config.getContext().getPropertyFilters()){ - configTree.addItem(filter); - configTree.setItemCaption(filter, filter.getClass().getName()); - configTree.setChildrenAllowed(filter, false); - configTree.setParent(filter, "ConfigurationContext.filters"); - } - configTree.addItem("ConfigurationContext.sources"); - configTree.setItemCaption("ConfigurationContext.sources", "Property Sources"); - for(PropertySource source: config.getContext().getPropertySources()){ - configTree.addItem(source); - configTree.setItemCaption(source, "name = "+source.getName()); - configTree.setParent(source, "ConfigurationContext.sources"); - - configTree.addItem(source.toString() + ".ordinal"); - configTree.setItemCaption(source.toString() + ".ordinal", "ordinal = "+source.getOrdinal()); - configTree.setParent(source.toString() + ".ordinal", source); - configTree.setChildrenAllowed(source.toString() + ".ordinal", false); - configTree.addItem(source.toString() + ".class"); - configTree.setItemCaption(source.toString() + ".class", "class = "+source.getClass().getName()); - configTree.setChildrenAllowed(source.toString() + ".class", false); - configTree.setParent(source.toString() + ".class", source); - Map<String,String> props = source.getProperties(); - configTree.addItem(props); - configTree.setItemCaption(props, "properties:"); - configTree.setParent(props, source); - for(Map.Entry propEn:props.entrySet()){ - String entryKey = props.hashCode() + propEn.getKey().toString(); - configTree.addItem(entryKey); - configTree.setChildrenAllowed(entryKey, false); - configTree.setItemCaption(entryKey, propEn.getKey() + "=" + propEn.getValue()); - configTree.setParent(entryKey, props); - } - } - } - - private String getCaption(String key, String value) { - int index = key.lastIndexOf('.'); - if(index<0){ - return key + " = " + value; - }else{ - return key.substring(index+1) + " = " + value; - } - } - - @Override - public void enter(ViewChangeListener.ViewChangeEvent event) { - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java index d3154b9..9ce88ef 100644 --- a/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java +++ b/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java @@ -44,7 +44,7 @@ public class HomeView extends VerticalSpacedLayout implements View { @Override public ViewLifecycle getLifecycle() { - return ViewLifecycle.CREATE; + return ViewLifecycle.LAZY; } @Override http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/java/org/apache/tamaya/ui/views/SystemView.java ---------------------------------------------------------------------- diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/SystemView.java b/ui/src/main/java/org/apache/tamaya/ui/views/SystemView.java new file mode 100644 index 0000000..4b76edb --- /dev/null +++ b/ui/src/main/java/org/apache/tamaya/ui/views/SystemView.java @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.ui.views; + +import com.vaadin.navigator.View; +import com.vaadin.navigator.ViewChangeListener; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.Label; +import com.vaadin.ui.Tree; +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.TypeLiteral; +import org.apache.tamaya.spi.PropertyConverter; +import org.apache.tamaya.spi.PropertyFilter; +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValueCombinationPolicy; +import org.apache.tamaya.spi.ServiceContextManager; +import org.apache.tamaya.ui.UIConstants; +import org.apache.tamaya.ui.ViewProvider; +import org.apache.tamaya.ui.components.VerticalSpacedLayout; +import org.apache.tamaya.ui.services.MessageProvider; + +import javax.annotation.Priority; +import java.util.List; +import java.util.Map; + +/** + * View showing the current loaded system components. + */ +public class SystemView extends VerticalSpacedLayout implements View { + + + /** + * Provider to register this view. + */ + @Priority(20) + public static final class Provider implements ViewProvider{ + + @Override + public ViewLifecycle getLifecycle() { + return ViewLifecycle.CREATE; + } + + @Override + public String getUrlPattern() { + return "/system"; + } + + @Override + public String getDisplayName() { + return ServiceContextManager.getServiceContext().getService(MessageProvider.class) + .getMessage("view.system.name"); + } + + @Override + public View createView(){ + return new SystemView(); + } + } + + + private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class) + .getMessage("default.label.system")); + + + public SystemView() { + Label caption = new Label("Tamaya Runtime"); + Label description = new Label( + "This view shows the system components currently active. This information may be useful when checking if an" + + "configuration extension is loaded and for inspection of the configuration and property sources" + + "invovlved.", + ContentMode.HTML); + + fillComponentTree(); + + addComponents(caption, description, configTree); + + caption.addStyleName(UIConstants.LABEL_HUGE); + description.addStyleName(UIConstants.LABEL_LARGE); + + } + + private void fillComponentTree() { + configTree.removeAllItems(); + Configuration config = ConfigurationProvider.getConfiguration(); + + String currentParent = "General"; + configTree.addItem(currentParent); + configTree.addItem("Configuration.class"); + configTree.setItemCaption("Configuration.class", "Configuration class = " + config.getClass().getName()); + configTree.setParent("Configuration.class", currentParent); + configTree.setChildrenAllowed("Configuration.class", false); + + configTree.addItem("ConfigurationContext.class"); + configTree.setItemCaption("ConfigurationContext.class", "ConfigurationContext class = " + + config.getContext().getClass().getName()); + configTree.setParent("ConfigurationContext.class", currentParent); + configTree.setChildrenAllowed("ConfigurationContext.class", false); + + configTree.addItem("PropertyValueCombinationPolicy.class"); + configTree.setItemCaption("PropertyValueCombinationPolicy.class", + PropertyValueCombinationPolicy.class.getSimpleName() + " class = " + + config.getContext().getPropertyValueCombinationPolicy().getClass().getName()); + configTree.setParent("PropertyValueCombinationPolicy.class", currentParent); + configTree.setChildrenAllowed("PropertyValueCombinationPolicy.class", false); + + configTree.addItem("ConfigurationContext.types"); + configTree.setItemCaption("ConfigurationContext.types", "Configurable types"); + configTree.setParent("ConfigurationContext.types", currentParent); + for(Map.Entry<TypeLiteral<?>,List<PropertyConverter<?>>> en:config.getContext().getPropertyConverters().entrySet()){ + configTree.addItem(en.getKey()); + configTree.setItemCaption(en.getKey(), "Type = " + en.getKey().toString()); + configTree.setParent(en.getKey(), "ConfigurationContext.types"); + for(PropertyConverter conv: en.getValue()){ + configTree.addItem(conv); + configTree.setItemCaption(conv, conv.getClass().getName()); + configTree.setChildrenAllowed(conv, false); + configTree.setParent(conv, en.getKey()); + } + } + configTree.addItem("ConfigurationContext.filters"); + configTree.setItemCaption("ConfigurationContext.filters", "Property Filters"); + for(PropertyFilter filter: config.getContext().getPropertyFilters()){ + configTree.addItem(filter); + configTree.setItemCaption(filter, filter.getClass().getName()); + configTree.setChildrenAllowed(filter, false); + configTree.setParent(filter, "ConfigurationContext.filters"); + } + configTree.addItem("ConfigurationContext.sources"); + configTree.setItemCaption("ConfigurationContext.sources", "Property Sources"); + for(PropertySource source: config.getContext().getPropertySources()){ + configTree.addItem(source); + configTree.setItemCaption(source, "name = "+source.getName()); + configTree.setParent(source, "ConfigurationContext.sources"); + + configTree.addItem(source.toString() + ".ordinal"); + configTree.setItemCaption(source.toString() + ".ordinal", "ordinal = "+source.getOrdinal()); + configTree.setParent(source.toString() + ".ordinal", source); + configTree.setChildrenAllowed(source.toString() + ".ordinal", false); + configTree.addItem(source.toString() + ".class"); + configTree.setItemCaption(source.toString() + ".class", "class = "+source.getClass().getName()); + configTree.setChildrenAllowed(source.toString() + ".class", false); + configTree.setParent(source.toString() + ".class", source); + Map<String,String> props = source.getProperties(); + configTree.addItem(props); + configTree.setItemCaption(props, "properties:"); + configTree.setParent(props, source); + for(Map.Entry propEn:props.entrySet()){ + String entryKey = props.hashCode() + propEn.getKey().toString(); + configTree.addItem(entryKey); + configTree.setChildrenAllowed(entryKey, false); + configTree.setItemCaption(entryKey, propEn.getKey() + "=" + propEn.getValue()); + configTree.setParent(entryKey, props); + } + } + } + + private String getCaption(String key, String value) { + int index = key.lastIndexOf('.'); + if(index<0){ + return key + " = " + value; + }else{ + return key.substring(index+1) + " = " + value; + } + } + + @Override + public void enter(ViewChangeListener.ViewChangeEvent event) { + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider ---------------------------------------------------------------------- diff --git a/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider index eeb467b..5650c5f 100644 --- a/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider +++ b/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider @@ -18,4 +18,4 @@ # org.apache.tamaya.ui.views.HomeView$Provider org.apache.tamaya.ui.views.ConfigView$Provider -org.apache.tamaya.ui.views.ComponentView$Provider \ No newline at end of file +org.apache.tamaya.ui.views.SystemView$Provider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1379095a/ui/src/main/resources/ui/lang/tamaya.properties ---------------------------------------------------------------------- diff --git a/ui/src/main/resources/ui/lang/tamaya.properties b/ui/src/main/resources/ui/lang/tamaya.properties index 16880d4..ba458de 100644 --- a/ui/src/main/resources/ui/lang/tamaya.properties +++ b/ui/src/main/resources/ui/lang/tamaya.properties @@ -21,8 +21,8 @@ default.label.logout=Log out default.label.unknown=<unknown> default.label.username=Username default.label.password=Password -default.label.components=Components +default.label.system=Runtime view.config.name=Configuration view.home.name=Home -view.components.name=Components +view.system.name=System Runtime