Skip to contentPackage: MutableDisplayable
MutableDisplayable
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * SteelBlue: DCI User Interfaces
5: * http://tidalwave.it/projects/steelblue
6: *
7: * Copyright (C) 2015 - 2025 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 the License.
12: * 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/steelblue-src
22: * git clone https://github.com/tidalwave-it/steelblue-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.ui.core.role;
27:
28: import jakarta.annotation.Nonnull;
29: import java.util.Locale;
30: import java.util.Map;
31: import it.tidalwave.ui.core.Mutable;
32: import it.tidalwave.ui.core.role.impl.DefaultMutableDisplayable;
33:
34: /***************************************************************************************************************************************************************
35: *
36: * A specialized {@link it.tidalwave.ui.core.role.Displayable} which is mutable (that is, its display name can be changed)
37: * and fires {@code PropertyChangeEvent}s.
38: *
39: * @stereotype Role
40: *
41: * @since 2.0-ALPHA-1
42: * @author Fabrizio Giudici
43: * @it.tidalwave.javadoc.stable
44: *
45: **************************************************************************************************************************************************************/
46: public interface MutableDisplayable extends Displayable, Mutable
47: {
48: /** Shortcut for {@link it.tidalwave.util.As}. */
49: public static final Class<MutableDisplayable> _MutableDisplayable_ = MutableDisplayable.class;
50:
51: /** The property name for displayName */
52: public static final String PROP_DISPLAY_NAME = "displayName";
53:
54: /** The property name for displayNames */
55: public static final String PROP_DISPLAY_NAMES = "displayNames";
56:
57: /***********************************************************************************************************************************************************
58: * Sets the display name in {@code Locale.ENGLISH}.
59: *
60: * @param displayName the display name
61: **********************************************************************************************************************************************************/
62: public void setDisplayName (@Nonnull String displayName);
63:
64: /***********************************************************************************************************************************************************
65: * Sets the display name in the given {@code Locale}.
66: *
67: * @param displayName the display name
68: * @param locale the locale
69: **********************************************************************************************************************************************************/
70: public void setDisplayName (@Nonnull String displayName, @Nonnull Locale locale);
71:
72: /***********************************************************************************************************************************************************
73: * Sets a bag of display names for a number of {@code Locale}s.
74: *
75: * @param displayNames the display names
76: **********************************************************************************************************************************************************/
77: public void setDisplayNames (@Nonnull Map<Locale, String> displayNames);
78:
79: /***********************************************************************************************************************************************************
80: * Creates an instance with an initial given display name in {@code Locale.ENGLISH}.
81: *
82: * @param displayName the display name
83: * @return the new instance
84: * @since 3.2-ALPHA-1
85: **********************************************************************************************************************************************************/
86: @Nonnull
87: public static MutableDisplayable of (@Nonnull final String displayName)
88: {
89: return of(displayName, "???");
90: }
91:
92: /***********************************************************************************************************************************************************
93: * Creates an instance with an initial given display name in {@code Locale.ENGLISH} and an explicit identifier for
94: * {@code toString()}.
95: *
96: * @param displayName the display name
97: * @param toStringName the name to be rendered when {@code toString()} is called
98: * @return the new instance
99: * @since 3.2-ALPHA-1
100: **********************************************************************************************************************************************************/
101: @Nonnull
102: public static MutableDisplayable of (@Nonnull final String displayName, @Nonnull final String toStringName)
103: {
104: return new DefaultMutableDisplayable(displayName, toStringName);
105: }
106: }