public String getBaseViewKey() { if (view != null) { return view.getKey(); } else { return this.baseViewKey; } }
/** * Sets the view that should be shown by default. * * @param view a View object */ public void setDefaultView(View view) { if (view != null) { this.defaultView = view.getKey(); } }
/** * Finds the view with the specified key, or null if the view does not exist. * * @param key the key * @return a View object, or null if a view with the specified key could not be found */ View getViewWithKey(String key) { if (key == null) { throw new IllegalArgumentException("A key must be specified."); } Set<View> views = new HashSet<>(); views.addAll(systemLandscapeViews); views.addAll(systemContextViews); views.addAll(containerViews); views.addAll(componentViews); views.addAll(dynamicViews); views.addAll(deploymentViews); return views.stream().filter(v -> key.equals(v.getKey())).findFirst().orElse(null); }
private <T extends View> T findView(Collection<T> views, T sourceView) { for (T view : views) { if (view.getKey() != null && view.getKey().equals(sourceView.getKey())) { return view; } } for (T view : views) { if (view.getName().equals(sourceView.getName())) { if (view.getDescription() != null) { if (view.getDescription().equals(sourceView.getDescription())) { return view; } } else { return view; } } } return null; }
protected void writeHeader(View view, Writer writer) throws IOException { writer.write(format("@startuml(id=%s)", view.getKey().replace(' ', '_'))); writer.write(System.lineSeparator());