public NamedEntity (final @Nonnull String displayName) { super(new DefaultDisplayable(displayName)); } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public String toString() { return String.format("DefaultGeoCoderEntity@%x[%s, %s]", System.identityHashCode(this), id, displayable.getDisplayName()); }
public Display (final @Nonnull String displayName, final @Nonnegative int screenDeviceIndex) { super(new Object[] { new DefaultDisplayable(displayName, displayName) }); this.displayName = displayName; this.screenDeviceIndex = screenDeviceIndex; }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public int compareTo (final @Nonnull GeoCoderEntity geoCoderEntity) { return displayable.getDisplayName().compareTo(geoCoderEntity.as(Displayable).getDisplayName()); }
public RepositoryMusicPerformerRole (final @Nonnull String s) { asSupport = new PriorityAsSupport(this, new DefaultDisplayable(s)); } }
public MessageSendingUserAction (final @Nonnull MessageBus messageBus, final @Nonnull String displayName, final @Nonnull Supplier<Object> messageSupplier) { super(new DefaultDisplayable(displayName)); this.messageBus = messageBus; this.messageSupplier = messageSupplier; }
public SimpleDciEntity (final @Nonnull String id, final int attribute1, final int attribute2) { this.name = id; this.attribute1 = attribute1; this.attribute2 = attribute2; asDelegate = new AsSupport(this, new DefaultDisplayable(name)); } }
@Nonnull public static GenericEntity namedEntity (final @Nonnull String displayName) { return new GenericEntity(new DefaultDisplayable(displayName, "GenericEntity")); }
public FileModel3 (final @Nonnull String path) { file = new File(path); //@bluebook-begin Displayable displayable = new DefaultDisplayable(file.getName()); //@bluebook-end Displayable lookup = Lookups.fixed(displayable, composite); }
private Adaptation (final @Nonnull Id id, final @Nonnull Map<Key<?>, Object> propertyMap, final @Nonnull Object[] capabilities) { super(id, propertyMap, capabilities); }
public FileModel2 (final @Nonnull String path) { file = new File(path); //@bluebook-begin Displayable displayable = new DefaultDisplayable(file.getName()); //@bluebook-end Displayable lookup = Lookups.fixed(displayable, iconProvider, composite); }
private Habitat (final @Nonnull Id id, final @Nonnull Map<Key<?>, Object> propertyMap, final @Nonnull Object[] capabilities) { super(id, propertyMap, capabilities); }
@Nonnull public static GenericEntity namedEntity (final @Nonnull Id id, final @Nonnull String displayName) { return new GenericEntity(new DefaultIdentifiable(id), new DefaultDisplayable(displayName, "GenericEntity")); } }
public ProfiledDisplay (final @Nonnull Display display, final @Nonnull String profileName) { super(new Object[] { new DefaultDisplayable(display.getDisplayName(), display.getDisplayName()) }); this.display = display; this.profileName = profileName; } }
private VirtualMediaFolder (final @Nonnull Optional<? extends MediaFolder> optionalParent, final @Nonnull Path pathSegment, final @Nonnull String displayName, final @Nonnull Optional<EntityCollectionFactory> childrenSupplier, final @Nonnull Optional<EntityFinderFactory> finderFactory) { super((Identifiable)() -> new Id(absolutePath(optionalParent, pathSegment).toString()), new DefaultDisplayable(displayName)); this.path = absolutePath(optionalParent, pathSegment); this.optionalParent = optionalParent; this.finderFactory = finderFactory.orElse(mediaFolder -> mediaFolder.finderOf(childrenSupplier.get())); }
/******************************************************************************************************************* * * Factory method for the PresentationModel of SimpleEntity instances. * * It aggregates a few extra roles into the PresentationModel that are used by the control, such as callbacks * for action associated to the context menu. Also a Displayable role is usually injected to control the rendering * of entities. * ******************************************************************************************************************/ @Nonnull private PresentationModel pmFor (final @Nonnull SimpleEntity entity) { final Selectable selectable = () -> onSelected(entity); final UserAction action1 = new UserActionSupport8(() -> action1(entity), new DefaultDisplayable("Action 1")); final UserAction action2 = new UserActionSupport8(() -> action2(entity), new DefaultDisplayable("Action 2")); final UserAction action3 = new UserActionSupport8(() -> action3(entity), new DefaultDisplayable("Action 3")); return new DefaultPresentationModel(entity, new DefaultDisplayable("Item #" + entity.getName()), selectable, UserActionProvider.of(action1, action2, action3)); }
@Nonnull private static MediaFolder createMediaFolder (final @Nonnull MediaFolder parent, final @Nonnull EntityBrowser browser) { final String fallBack = browser.getClass().getSimpleName(); final String pathSegment = browser.asOptional(Identifiable).map(i -> i.getId().stringValue()).orElse(fallBack); final Displayable displayable = browser.asOptional(Displayable).orElse(new DefaultDisplayable(fallBack)); log.trace("createMediaFolder({}, {}) - path: {} displayable: {}", parent, browser, pathSegment, displayable); return new PathAwareMediaFolderDecorator(browser.getRoot(), parent, Paths.get(pathSegment), displayable); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public DefaultGeoCoderEntity (final @Nonnull GeoCoder geoCoder, final @CheckForNull GeoCoderEntity parent, final @Nonnull String id, final @Nonnull String displayName, final @Nonnull Coordinate coordinate, final @Nonnull String code, final @Nonnull String typeAsString, final @Nonnull Serializable[] capabilities) { Parameters.notNull("id", id); this.geoCoder = geoCoder; this.parent = parent; this.id = id; this.displayable = new DefaultDisplayable(displayName, "DefaultGeoCoderEntity"); this.coordinate = coordinate; this.code = code; this.typeAsString = typeAsString; this.geoCoderName = geoCoder.getName(); this.capabilities.addAll(Arrays.asList(capabilities)); this.capabilities.addAll(Arrays.asList(coordinate, displayable, new QName(geoCoder.getId() + id + "/"))); }
@Override @Nonnull public As unmarshal (final @Nonnull List<Statement> statements, final @Nonnull Context context) { // TODO: what about retrieving the observationSet and calling findOrCreate(?) // final List<Object> capabilities = new ArrayList<Object>(); // capabilities.add(new DefaultIdentifiable(statements.get(0).getSubject())); try { final String displayName = findStatementWithPredicate(statements, ObservationVocabulary.RDFS_LABEL).getObject().stringValue(); return new SimpleLocation(new DefaultDisplayable(displayName, "SimpleLocation")); } catch (NotFoundException e) { throw new RuntimeException(e); // ok. no Displayable } // return new SimpleLocation(capabilities.toArray()); } }
@Override @Nonnull public As unmarshal (final @Nonnull List<Statement> statements, final @Nonnull Context context) { // TODO: what about retrieving the observationSet and calling findOrCreate(?) final List<Object> capabilities = new ArrayList<Object>(); try { final String displayName = findStatementWithPredicate(statements, ObservationVocabulary.RDFS_LABEL).getObject().stringValue(); capabilities.add(new DefaultDisplayable(displayName, "SimpleObserver")); } catch (NotFoundException e) { // ok. no Displayable } return new SimpleObserver(capabilities.toArray()); } }