GUI -- Minor refactor of sample UI components (archetypes).
Change-Id: I80c8c699d9aff662bffd4c619f44e2079eddd1ce
Showing
3 changed files
with
12 additions
and
5 deletions
tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
| ... | @@ -39,6 +39,9 @@ import java.util.List; | ... | @@ -39,6 +39,9 @@ import java.util.List; |
| 39 | @Component(immediate = true) | 39 | @Component(immediate = true) |
| 40 | public class AppUiComponent { | 40 | public class AppUiComponent { |
| 41 | 41 | ||
| 42 | + private static final String VIEW_ID = "sampleCustom"; | ||
| 43 | + private static final String VIEW_TEXT = "Sample Custom"; | ||
| 44 | + | ||
| 42 | private final Logger log = LoggerFactory.getLogger(getClass()); | 45 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 43 | 46 | ||
| 44 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 47 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| ... | @@ -46,7 +49,7 @@ public class AppUiComponent { | ... | @@ -46,7 +49,7 @@ public class AppUiComponent { |
| 46 | 49 | ||
| 47 | // List of application views | 50 | // List of application views |
| 48 | private final List<UiView> uiViews = ImmutableList.of( | 51 | private final List<UiView> uiViews = ImmutableList.of( |
| 49 | - new UiView(UiView.Category.OTHER, "sampleCustom", "Sample Custom") | 52 | + new UiView(UiView.Category.OTHER, VIEW_ID, VIEW_TEXT) |
| 50 | ); | 53 | ); |
| 51 | 54 | ||
| 52 | // Factory for UI message handlers | 55 | // Factory for UI message handlers | ... | ... |
| ... | @@ -39,6 +39,9 @@ import java.util.List; | ... | @@ -39,6 +39,9 @@ import java.util.List; |
| 39 | @Component(immediate = true) | 39 | @Component(immediate = true) |
| 40 | public class AppUiTableComponent { | 40 | public class AppUiTableComponent { |
| 41 | 41 | ||
| 42 | + private static final String VIEW_ID = "sampleTable"; | ||
| 43 | + private static final String VIEW_TEXT = "Sample Table"; | ||
| 44 | + | ||
| 42 | private final Logger log = LoggerFactory.getLogger(getClass()); | 45 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 43 | 46 | ||
| 44 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 47 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| ... | @@ -46,7 +49,7 @@ public class AppUiTableComponent { | ... | @@ -46,7 +49,7 @@ public class AppUiTableComponent { |
| 46 | 49 | ||
| 47 | // List of application views | 50 | // List of application views |
| 48 | private final List<UiView> uiViews = ImmutableList.of( | 51 | private final List<UiView> uiViews = ImmutableList.of( |
| 49 | - new UiView(UiView.Category.OTHER, "sampleTable", "Sample Table") | 52 | + new UiView(UiView.Category.OTHER, VIEW_ID, VIEW_TEXT) |
| 50 | ); | 53 | ); |
| 51 | 54 | ||
| 52 | // Factory for UI message handlers | 55 | // Factory for UI message handlers |
| ... | @@ -58,7 +61,7 @@ public class AppUiTableComponent { | ... | @@ -58,7 +61,7 @@ public class AppUiTableComponent { |
| 58 | // Application UI extension | 61 | // Application UI extension |
| 59 | protected UiExtension extension = | 62 | protected UiExtension extension = |
| 60 | new UiExtension.Builder(getClass().getClassLoader(), uiViews) | 63 | new UiExtension.Builder(getClass().getClassLoader(), uiViews) |
| 61 | - .resourcePath("sampleTable") | 64 | + .resourcePath(VIEW_ID) |
| 62 | .messageHandlerFactory(messageHandlerFactory) | 65 | .messageHandlerFactory(messageHandlerFactory) |
| 63 | .build(); | 66 | .build(); |
| 64 | 67 | ... | ... |
| ... | @@ -42,6 +42,7 @@ import java.util.List; | ... | @@ -42,6 +42,7 @@ import java.util.List; |
| 42 | public class AppUiTopovComponent { | 42 | public class AppUiTopovComponent { |
| 43 | 43 | ||
| 44 | private static final ClassLoader CL = AppUiTopovComponent.class.getClassLoader(); | 44 | private static final ClassLoader CL = AppUiTopovComponent.class.getClassLoader(); |
| 45 | + private static final String VIEW_ID = "sampleTopov"; | ||
| 45 | 46 | ||
| 46 | private final Logger log = LoggerFactory.getLogger(getClass()); | 47 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 47 | 48 | ||
| ... | @@ -50,7 +51,7 @@ public class AppUiTopovComponent { | ... | @@ -50,7 +51,7 @@ public class AppUiTopovComponent { |
| 50 | 51 | ||
| 51 | // List of application views | 52 | // List of application views |
| 52 | private final List<UiView> uiViews = ImmutableList.of( | 53 | private final List<UiView> uiViews = ImmutableList.of( |
| 53 | - new UiViewHidden("sampleTopov") | 54 | + new UiViewHidden(VIEW_ID) |
| 54 | ); | 55 | ); |
| 55 | 56 | ||
| 56 | // Factory for UI message handlers | 57 | // Factory for UI message handlers |
| ... | @@ -68,7 +69,7 @@ public class AppUiTopovComponent { | ... | @@ -68,7 +69,7 @@ public class AppUiTopovComponent { |
| 68 | // Application UI extension | 69 | // Application UI extension |
| 69 | protected UiExtension extension = | 70 | protected UiExtension extension = |
| 70 | new UiExtension.Builder(CL, uiViews) | 71 | new UiExtension.Builder(CL, uiViews) |
| 71 | - .resourcePath("sampleTopov") | 72 | + .resourcePath(VIEW_ID) |
| 72 | .messageHandlerFactory(messageHandlerFactory) | 73 | .messageHandlerFactory(messageHandlerFactory) |
| 73 | .topoOverlayFactory(topoOverlayFactory) | 74 | .topoOverlayFactory(topoOverlayFactory) |
| 74 | .build(); | 75 | .build(); | ... | ... |
-
Please register or login to post a comment