Package: EntityBrowserDisplayable
EntityBrowserDisplayable
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EntityBrowserDisplayable(EntityBrowser) |
|
|
|
|
|
||||||||||||||||||||
getDisplayName() |
|
|
|
|
|
||||||||||||||||||||
static {...} |
|
|
|
|
|
||||||||||||||||||||
toString() |
|
|
|
|
|
Coverage
1: /*
2: * *********************************************************************************************************************
3: *
4: * blueMarine II: Semantic Media Centre
5: * http://tidalwave.it/projects/bluemarine2
6: *
7: * Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/bluemarine2-src
23: * git clone https://github.com/tidalwave-it/bluemarine2-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.bluemarine2.mediaserver.impl;
28:
29: import javax.annotation.Nonnull;
30: import javax.annotation.concurrent.Immutable;
31: import java.util.HashMap;
32: import java.util.Map;
33: import it.tidalwave.role.ui.Displayable;
34: import it.tidalwave.dci.annotation.DciRole;
35: import it.tidalwave.bluemarine2.model.role.EntityBrowser;
36: import lombok.RequiredArgsConstructor;
37:
38: /***********************************************************************************************************************
39: *
40: * The {@link Displayable} role for all {@link EntityBrowser}s.
41: *
42: * @stereotype Role
43: *
44: * @author Fabrizio Giudici
45: *
46: **********************************************************************************************************************/
47: @RequiredArgsConstructor
48: @Immutable @DciRole(datumType = EntityBrowser.class)
49: public class EntityBrowserDisplayable implements Displayable
50: {
51: // FIXME: use a real bundle
52: private static final Map<String, String> BUNDLE = new HashMap<>();
53:
54: static
55: {
56: BUNDLE.put("RepositoryBrowserByArtistThenRecord", "By artist & record");
57: BUNDLE.put("RepositoryBrowserByArtistThenTrack", "By artist & track");
58: BUNDLE.put("RepositoryBrowserByRecordThenTrack", "By record & track");
59: BUNDLE.put("RepositoryBrowserByTrack", "By track");
60: BUNDLE.put("DefaultMediaFileSystem", "By file");
61: }
62:
63: @Nonnull
64: private final EntityBrowser owner;
65:
66: @Override @Nonnull
67: public String getDisplayName()
68: {
69: final String className = owner.getClass().getSimpleName();
70: return BUNDLE.getOrDefault(className, className);
71: }
72:
73: @Override @Nonnull
74: public String toString()
75: {
76: return String.format("%s(%s)", getClass().getSimpleName(), getDisplayName());
77: }
78: }