CWidgetSetId

A widget set consists of a group of UI widgets.
The widget set ID is used to identify such a widget set.

A widget set ID consists of any name plus an instance ID. The instance ID is used to distinguish widget sets when multiple widget sets of the same ID exist on the client. This can certainly happen. The instance ID can be empty; however, usually you will just number it.

Creation

The easiest way is to create a widget set ID from the components.

@NotNull
public static CWidgetSetId create(@Nullable final String aName,
                                  @Nullable final String aInstance);

The string form of a widget set ID is Name.InstanceId. Conversely, there is a factory method that generates the widget set ID from such a string.

@Nullable
public static CWidgetSetId valueFromString(@Nullable final String aValue);

From a DataInput stream you can read the widget set ID as follows:

@Nullable
public static CWidgetSetId fromStream(@NotNull final DataInput aStream) throws IOException;

Convert to string

A widget set ID can be easily converted to a string.

// returns null if the argument is null
@NotNull
public static String valueToString(@Nullable final CWidgetSetId aValue);

// or
public String valueToString();

Write to a DataOutput stream

The counterpart to reading from a DataInput stream is writing to a DataOutput stream.

public static void toStream(@NotNull final DataOutput aStream,
                            @Nullable final CWidgetSetId aValue) throws IOException;

Getter

Name and instance ID can be fetched via getter. If the instance ID is missing, an empty string is returned.

@NotNull
public String getName();

@NotNull
public String getInstance();

Check

The following method returns true if the name is not empty.

public boolean isValid();

Widget set ID and widget ID

The following method creates a widget ID from a widget name and a widget set ID.

@NotNull
public CWidgetId createWidgetId(@NotNull final String aWidgetName);

Notice

The class supports the equals(), the hashCode() and the toString() methods.