public static class ViewSettings.Builder extends Object
View settings builder allows to construct instances of ViewSettings and serialize them
into JSON format.
Builder is not thread-safe.
ViewSettings| Constructor and Description |
|---|
Builder()
Creates an empty builder
|
Builder(ViewSettings copyFrom)
Creates a builder that copies the contents of an already existing
ViewSettings instance. |
| Modifier and Type | Method and Description |
|---|---|
ViewSettings.Builder |
addView(int index,
long viewId,
Collection<StructurePage> menuPages,
Collection<StructurePage> defaultPages)
Adds specified view to the list of associated views, or inserts it as a specific position in the list.
|
ViewSettings.Builder |
addView(long viewId,
boolean defaultView)
Adds the specified view to the list of associated views, optionally making it the default
for all pages.
|
ViewSettings.Builder |
addViews(long... viewIds)
Adds specified views to the list of associated views.
|
ViewSettings |
build()
Constructs an instance of
ViewSettings. |
List<ViewSettings.AssociatedView.Builder> |
getViews() |
boolean |
isDefined() |
void |
makeDefined()
Makes this view settings instance defined, by making sure the views list is not
null. |
void |
setViews(List<ViewSettings.AssociatedView.Builder> views)
Sets a list of builders of associated views.
|
String |
toString() |
public Builder()
public Builder(@Nullable
ViewSettings copyFrom)
ViewSettings instance.copyFrom - view settings to copy@Nullable public List<ViewSettings.AssociatedView.Builder> getViews()
ViewSettings.AssociatedView.Builder, or null if no views have been added.
Each individual builder is not copied but referenced in the resulting list.public void setViews(List<ViewSettings.AssociatedView.Builder> views)
views - list of builders, or null to make the constructed view settings undefined.@NotNull public ViewSettings build()
ViewSettings. If a builder for any of the associated views
is invalid, that associated view record is ignored.ViewSettingspublic ViewSettings.Builder addViews(long... viewIds)
viewIds - a list of view IDspublic ViewSettings.Builder addView(long viewId, boolean defaultView)
defaultView parameter is true, the view is also marked as the default
for all pages ("default" marker is set for all pages).viewId - view IDdefaultView - if , the added view will be the defaultpublic ViewSettings.Builder addView(int index, long viewId, @Nullable Collection<StructurePage> menuPages, @Nullable Collection<StructurePage> defaultPages)
Adds specified view to the list of associated views, or inserts it as a specific position in the list.
The caller may specify on which pages the view is available in the drop-down list (via menuPages
parameter), and on which pages the view is the default (via defaultPages parameter.
Hint: to construct a collection of pages, use EnumSet.of(...).
index - the position in the list where to add the view, or -1 to add the view to the end of the listviewId - the ID of the viewmenuPages - a collection of pages on which this view is offered to the user, null or empty means all pagesdefaultPages - a collection of pages on which this view is the default, null or empty means no pagesIndexOutOfBoundsException - if the specified index is invalidpublic void makeDefined()
null.
Even if you don't add any views after that and build an instance of ViewSettings,
the instance will be defined and override the default settings.public boolean isDefined()
Copyright © 2019 ALM Works. All Rights Reserved.