private Sitemap getSitemap(String sitemapName) { for (SitemapProvider provider : sitemapProviders) { Sitemap sitemap = provider.getSitemap(sitemapName); if (sitemap != null) { return sitemap; } } return null; }
private boolean definesVisibility(Widget w, String name) { for (VisibilityRule vr : w.getVisibility()) { if (name.equals(vr.getItem())) { return true; } } return false; }
@Override public EObject getParent(Widget w) { Widget w2 = defaultWidgets.get(w); return (w2 == null) ? w.eContainer() : w2.eContainer(); }
private void copyProperties(Widget source, Widget target) { target.setItem(source.getItem()); target.setIcon(source.getIcon()); target.setLabel(source.getLabel()); target.getVisibility().addAll(EcoreUtil.copyAll(source.getVisibility())); target.getLabelColor().addAll(EcoreUtil.copyAll(source.getLabelColor())); target.getValueColor().addAll(EcoreUtil.copyAll(source.getValueColor())); }
private boolean definesVisibilityOrColor(Widget w, String name) { for (VisibilityRule rule : w.getVisibility()) { if (name.equals(rule.getItem())) { return true; } } for (ColorArray rule : w.getLabelColor()) { if (name.equals(rule.getItem())) { return true; } } for (ColorArray rule : w.getValueColor()) { if (name.equals(rule.getItem())) { return true; } } return false; }
/** * Collects all items that are represented by a given list of widgets * * @param widgets * the widget list to get the items for added to all bundles containing REST resources * @return all items that are represented by the list of widgets */ private Set<Item> getAllItems(EList<Widget> widgets) { Set<Item> items = new HashSet<Item>(); if (itemUIRegistry != null) { for (Widget widget : widgets) { addItemWithName(items, widget.getItem()); if (widget instanceof Frame) { items.addAll(getAllItems(((Frame) widget).getChildren())); } // now scan visibility rules for (VisibilityRule vr : widget.getVisibility()) { addItemWithName(items, vr.getItem()); } } } return items; }
private Switch createPlayerButtons() { Switch playerItemSwitch = SitemapFactory.eINSTANCE.createSwitch(); List<Mapping> mappings = playerItemSwitch.getMappings(); Mapping commandMapping = null; mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(NextPreviousType.PREVIOUS.name()); commandMapping.setLabel("<<"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(PlayPauseType.PAUSE.name()); commandMapping.setLabel("||"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(PlayPauseType.PLAY.name()); commandMapping.setLabel(">"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(NextPreviousType.NEXT.name()); commandMapping.setLabel(">>"); return playerItemSwitch; }
/** * Get command-label map for a Selection widget * * @return String representing JSON object */ private String getMappingsJSON(Selection w) { JsonObject resultObject = new JsonObject(); for (Mapping mapping : w.getMappings()) { resultObject.addProperty(mapping.getCmd(), mapping.getLabel()); } String result = resultObject.toString(); result = StringEscapeUtils.escapeHtml(result); return result; }
@Override public String getLabelColor(Widget w) { return processColorDefinition(getState(w), w.getLabelColor()); }
@Override public String getValueColor(Widget w) { return processColorDefinition(getState(w), w.getValueColor()); }
protected void removeSitemapProvider(SitemapProvider provider) { sitemapProviders.remove(provider); provider.removeModelChangeListener(this); }
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addSitemapProvider(SitemapProvider provider) { sitemapProviders.add(provider); provider.addModelChangeListener(this); }
private void copyProperties(Widget source, Widget target) { target.setItem(source.getItem()); target.setIcon(source.getIcon()); target.setLabel(source.getLabel()); target.getVisibility().addAll(EcoreUtil.copyAll(source.getVisibility())); target.getLabelColor().addAll(EcoreUtil.copyAll(source.getLabelColor())); target.getValueColor().addAll(EcoreUtil.copyAll(source.getValueColor())); }
private Switch createPlayerButtons() { Switch playerItemSwitch = SitemapFactory.eINSTANCE.createSwitch(); List<Mapping> mappings = playerItemSwitch.getMappings(); Mapping commandMapping = null; mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(NextPreviousType.PREVIOUS.name()); commandMapping.setLabel("<<"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(PlayPauseType.PAUSE.name()); commandMapping.setLabel("||"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(PlayPauseType.PLAY.name()); commandMapping.setLabel(">"); mappings.add(commandMapping = SitemapFactory.eINSTANCE.createMapping()); commandMapping.setCmd(NextPreviousType.NEXT.name()); commandMapping.setLabel(">>"); return playerItemSwitch; }
private Sitemap getSitemap(String sitemapName) { for (SitemapProvider provider : sitemapProviders) { Sitemap sitemap = provider.getSitemap(sitemapName); if (sitemap != null) { return sitemap; } } return null; }
@Override public EObject getParent(Widget w) { Widget w2 = defaultWidgets.get(w); return (w2 == null) ? w.eContainer() : w2.eContainer(); }
@Override public String getLabelColor(Widget w) { return processColorDefinition(getState(w), w.getLabelColor()); }
@Override public String getValueColor(Widget w) { return processColorDefinition(getState(w), w.getValueColor()); }
private Sitemap getSitemap(String sitemapname) { for (SitemapProvider provider : sitemapProviders) { Sitemap sitemap = provider.getSitemap(sitemapname); if (sitemap != null) { return sitemap; } } return null; }
private Sitemap getSitemap(String sitemapname) { for (SitemapProvider provider : sitemapProviders) { Sitemap sitemap = provider.getSitemap(sitemapname); if (sitemap != null) { return sitemap; } } return null; }