gpt4 book ai didi

com.github.bordertech.wcomponents.WebUtilities.getContextForComponent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 16:05:05 25 4
gpt4 key购买 nike

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

WebUtilities.getContextForComponent介绍

[英]Returns the context for this component. The component may not be in the current context.
[中]返回此组件的上下文。组件可能不在当前上下文中。

代码示例

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Returns the context for the given component.
 *
 * @param uic the current user's UIContext.
 * @param component the component to retrieve its context for.
 * @return the context for the given component.
 * @deprecated Badly named Method. Use {@link #getContextForComponent(com.github.bordertech.wcomponents.WComponent)}
 * instead
 */
@Deprecated
public static UIContext getPrimaryContext(final UIContext uic, final WComponent component) {
  return getContextForComponent(component);
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Override preparePaintComponent in order to register the components for the current request.
 *
 * @param request the request being responded to
 */
@Override
protected void preparePaintComponent(final Request request) {
  super.preparePaintComponent(request);
  List<AjaxTarget> targets = getTargets();
  if (targets != null && !targets.isEmpty()) {
    WComponent triggerComponent = trigger == null ? this : trigger;
    // The trigger maybe in a different context
    UIContext triggerContext = WebUtilities.getContextForComponent(triggerComponent);
    UIContextHolder.pushContext(triggerContext);
    // TODO The IDs of the targets are based on the Triggers Context. Not good for targets in repeaters
    try {
      List<String> targetIds = new ArrayList<>();
      for (AjaxTarget target : getTargets()) {
        targetIds.add(target.getId());
      }
      AjaxHelper.registerComponents(targetIds, triggerComponent.getId());
    } finally {
      UIContextHolder.popContext();
    }
  }
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-addons-table

/**
 * Find the UIContext for the ROW in a table.
 *
 * @return the UIContext for the row
 */
protected UIContext getRowUic() {
  // TODO This should be available from WComponents
  // The table maybe in a different context
  UIContext tblContext = WebUtilities.getContextForComponent(tbl);
  UIContextHolder.pushContext(tblContext);
  // Find the context for this row
  try {
    List<WTable.RowIdWrapper> rows = tbl.getRepeater().getBeanList();
    for (WTable.RowIdWrapper row : rows) {
      if (Objects.equals(row.getRowKey(), rowKey)) {
        // Get the UIContext for this rowId
        return tbl.getRepeater().getRowContext(row);
      }
    }
  } finally {
    UIContextHolder.popContext();
  }
  return null;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com