com.atlassian.plugin.connect.modules.beans.WebItemModuleBean类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.atlassian.plugin.connect.modules.beans.WebItemModuleBean类的一些代码示例,展示了WebItemModuleBean类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebItemModuleBean类的具体详情如下:
包路径:com.atlassian.plugin.connect.modules.beans.WebItemModuleBean
类名称:WebItemModuleBean

WebItemModuleBean介绍

[英]Adds a web item to a specified location in the application interface. A web item is a hyperlink that’s inserted into some standard place in the Atlassian application interface, such as the administration menu.

The form that the link takes can vary depending on the location. For instance, a web item in the header bar (with a location section of system.top.navigation.bar) adds a link to the navigation bar across the top of the interface. On the other hand, a web item in the opsbar-operation location section in JIRA adds an item to the issue operation buttons.

A web item link can open a new page in the application or a dialog, depending on your configuration.

Web items are a simple and useful way to extend Atlassian applications. If you want to extend an Atlassian application and don't know where to start, a web item may be all you need.

Your add-on can receive additional context from the application by using variable tokens in the url attribute.
Example
[中]将web项添加到应用程序界面中的指定位置。web项是插入到Atlassian应用程序界面中某个标准位置的超链接,例如“管理”菜单。
链接的形式可能因位置而异。例如,标题栏中的web项(位置部分为'system.top.navigation.bar')会在界面顶部添加指向导航栏的链接。另一方面,JIRA中“opsbar操作”位置部分中的一个web项会将一个项添加到问题操作按钮中。
web项链接可以在应用程序或对话框中打开新页面,具体取决于您的配置。
Web项是扩展Atlassian应用程序的一种简单而有用的方法。如果你想扩展一个Atlassian应用程序,但又不知道从哪里开始,你可能只需要一个web项目。
通过在“url”属性中使用变量标记,您的加载项可以从应用程序接收[additional context](../../concepts/context parameters.html)。
实例

代码示例

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-modules

  1. @Override
  2. public WebItemModuleBean build() {
  3. return new WebItemModuleBean(this);
  4. }
  5. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-modules

  1. public WebItemModuleBeanBuilder(WebItemModuleBean defaultBean) {
  2. super(defaultBean);
  3. this.location = defaultBean.getLocation();
  4. this.weight = defaultBean.getWeight();
  5. this.styleClasses = defaultBean.getStyleClasses();
  6. this.needsEscaping = defaultBean.needsEscaping();
  7. this.locationValidationEnabled = defaultBean.isLocationValidationEnabled();
  8. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-modules

  1. public WebItemModuleBeanBuilder(WebItemModuleBean defaultBean) {
  2. super(defaultBean);
  3. this.location = defaultBean.getLocation();
  4. this.weight = defaultBean.getWeight();
  5. this.styleClasses = defaultBean.getStyleClasses();
  6. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-integration-tests-support

  1. public static WebItemModuleBean randomWebItemBean() {
  2. return newWebItemBean()
  3. .withName(new I18nProperty(randomModuleKey(), null))
  4. .withKey(randomModuleKey())
  5. .withLocation("system.nowhere")
  6. .withUrl("/nowhere")
  7. .build();
  8. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-integration-tests-support

  1. public static WebItemModuleBean randomWebItemBean() {
  2. return newWebItemBean()
  3. .withName(value(randomModuleKey()))
  4. .withKey(randomModuleKey())
  5. .withLocation("system.nowhere")
  6. .withUrl("/nowhere")
  7. .build();
  8. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-modules

  1. @Override
  2. public String toString() {
  3. return super.fillToStringHelper(Objects.toStringHelper(this))
  4. .add("location", getLocation())
  5. .add("weight", getWeight())
  6. .add("styleClasses", getStyleClasses())
  7. .toString();
  8. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-test-support-plugin

  1. public static WebItemModuleBean randomWebItemBean() {
  2. return newWebItemBean().withName(value(randomPluginKey())).withKey(randomPluginKey()).withLocation("system.nowhere").withUrl("/nowhere").build();
  3. }
  4. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-modules

  1. @Override
  2. public String toString() {
  3. return super.fillToStringHelper(Objects.toStringHelper(this))
  4. .add("location", getLocation())
  5. .add("weight", getWeight())
  6. .add("styleClasses", getStyleClasses())
  7. .toString();
  8. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-modules

  1. @Override
  2. public WebItemModuleBean build() {
  3. return new WebItemModuleBean(this);
  4. }
  5. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-extension-spi

  1. @Override
  2. public List<ModuleDescriptor<?>> createPluginModuleDescriptors(List<ConnectPageModuleBean> modules, ConnectAddonBean addon) {
  3. List<ModuleDescriptor<?>> descriptors = new ArrayList<>();
  4. for (ConnectPageModuleBean bean : modules) {
  5. if (hasWebItem()) {
  6. // create a web item targeting the iframe page
  7. Integer weight = bean.getWeight() == null ? getDefaultWeight() : bean.getWeight();
  8. String location = isNullOrEmpty(bean.getLocation()) ? getDefaultSection() : bean.getLocation();
  9. WebItemModuleBean webItemBean = newWebItemBean()
  10. .withName(bean.getName())
  11. .withKey(bean.getRawKey())
  12. .withContext(page)
  13. .withUrl(ConnectIFrameServletPath.forModule(addon.getKey(), bean.getRawKey()))
  14. .withLocation(location)
  15. .withWeight(weight)
  16. .withIcon(bean.getIcon())
  17. .withConditions(bean.getConditions())
  18. .setNeedsEscaping(needsEscaping())
  19. .build();
  20. descriptors.add(webItemModuleDescriptorFactory.createModuleDescriptor(
  21. webItemBean, addon, getConditionClasses()));
  22. }
  23. descriptors.add(createPageIFrame(bean, addon));
  24. descriptors.add(createRawIFrame(bean, addon));
  25. }
  26. return descriptors;
  27. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-extension-spi

  1. private WebItemModuleBean createWebItemModuleBean(ConnectPageModuleBean bean, String url) {
  2. Integer weight = bean.getWeight() == null ? getDefaultWeight() : bean.getWeight();
  3. String location = isNullOrEmpty(bean.getLocation()) ? getDefaultSection() : bean.getLocation();
  4. return newWebItemBean()
  5. .withName(bean.getName())
  6. .withKey(bean.getRawKey())
  7. .withContext(page)
  8. .withUrl(url)
  9. .withLocation(location)
  10. .withWeight(weight)
  11. .withIcon(bean.getIcon())
  12. .withConditions(bean.getConditions())
  13. .setNeedsEscaping(needsEscaping())
  14. .build();
  15. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-modules

  1. private static String createWebItemExample() {
  2. final WebItemModuleBean webItemModuleBean = WebItemModuleBean.newWebItemBean()
  3. .withName(i18nProperty("My Web Item"))
  4. .withUrl("/my-web-item")
  5. .withKey("web-item-example")
  6. .withLocation("system.preset.filters")
  7. .withIcon(newIconBean().withUrl("/maps/icon.png").withHeight(16).withWidth(16).build())
  8. .withStyleClasses("webitem", "system-present-webitem")
  9. .withTooltip(i18nProperty("Example tooltip"))
  10. .withWeight(200)
  11. .build();
  12. return JsonExamplesUtils.createModuleArrayAsString("webItems", webItemModuleBean);
  13. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-server-modules

  1. private static String createWebItemExample() {
  2. final WebItemModuleBean webItemModuleBean = WebItemModuleBean.newWebItemBean()
  3. .withName(i18nProperty("My Web Item"))
  4. .withUrl("/my-web-item")
  5. .withKey("web-item-example")
  6. .withLocation("system.preset.filters")
  7. .withIcon(newIconBean().withUrl("/maps/icon.png").withHeight(16).withWidth(16).build())
  8. .withStyleClasses("webitem", "system-present-webitem")
  9. .withTooltip(i18nProperty("Example tooltip"))
  10. .withWeight(200)
  11. .build();
  12. return JsonExamplesUtils.createModuleArrayAsString("webItems", webItemModuleBean);
  13. }

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-spi

  1. @Override
  2. public List<ModuleDescriptor> createPluginModuleDescriptors(List<ConnectPageModuleBean> modules, ConnectModuleProviderContext moduleProviderContext)
  3. {
  4. List<ModuleDescriptor> descriptors = new ArrayList<>();
  5. final ConnectAddonBean connectAddonBean = moduleProviderContext.getConnectAddonBean();
  6. for (ConnectPageModuleBean bean : modules)
  7. {
  8. if (hasWebItem())
  9. {
  10. // create a web item targeting the iframe page
  11. Integer weight = bean.getWeight() == null ? getDefaultWeight() : bean.getWeight();
  12. String location = isNullOrEmpty(bean.getLocation()) ? getDefaultSection() : bean.getLocation();
  13. WebItemModuleBean webItemBean = newWebItemBean()
  14. .withName(bean.getName())
  15. .withKey(bean.getRawKey())
  16. .withContext(page)
  17. .withUrl(ConnectIFrameServletPath.forModule(connectAddonBean.getKey(), bean.getRawKey()))
  18. .withLocation(location)
  19. .withWeight(weight)
  20. .withIcon(bean.getIcon())
  21. .withConditions(bean.getConditions())
  22. .setNeedsEscaping(needsEscaping())
  23. .build();
  24. descriptors.add(webItemModuleDescriptorFactory.createModuleDescriptor(moduleProviderContext,
  25. pluginRetrievalService.getPlugin(), webItemBean, getConditionClasses()));
  26. }
  27. registerIframeRenderStrategy(bean, connectAddonBean);
  28. }
  29. return descriptors;
  30. }

相关文章