當前位置: 首頁>>代碼示例>>Java>>正文


Java UIComponent類代碼示例

本文整理匯總了Java中javax.faces.component.UIComponent的典型用法代碼示例。如果您正苦於以下問題:Java UIComponent類的具體用法?Java UIComponent怎麽用?Java UIComponent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UIComponent類屬於javax.faces.component包,在下文中一共展示了UIComponent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOnblur

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * In Internet Explorer, handle autosubmit.
 */
@Override
protected String getOnblur(
  UIComponent component,
  FacesBean   bean)
{
  RenderingContext rc = RenderingContext.getCurrentInstance();
  String onblur = super.getOnblur(component, bean);

  //PH: onblur should be included only for desktop IE since PIE and
  //IE mobile do not support onblur on a select component
  if (isIE(rc) &&  isDesktop(rc) && isAutoSubmit(component, bean))
  {
    String auto = getAutoSubmitScript(rc, component, bean);
    // See getOnclick()
    auto = _IE_ACTION_HANDLER_PREFIX + auto;
    onblur = XhtmlUtils.getChainedJS(onblur, auto, true);
  }

  return onblur;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,代碼來源:SimpleSelectOneChoiceRenderer.java

示例2: outputHiddenLabel

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * Outputs a hidden label.
 * @param component 
 */
static public void outputHiddenLabel(
  UIXRenderingContext context,
  String           id,
  Object           text, 
  UIComponent component
  ) throws IOException
{
  if (!XhtmlLafRenderer.isInaccessibleMode(context) &&
      (text != null) &&
      (id   != null))
  {
    if (!id.equals(context.getProperty(UIConstants.MARLIN_NAMESPACE,
                                       _LABEL_KEY)))
    {
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("label", component);
      writer.writeAttribute("for", id, null);
      XhtmlLafRenderer.renderStyleClassAttribute(context,
                                                 _HIDDEN_LABEL_CLASS);
      writer.writeText(text, null);
      writer.endElement("label");
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:HiddenLabelUtils.java

示例3: templateChanged_toSameValue

import javax.faces.component.UIComponent; //導入依賴的package包/類
@Test
public void templateChanged_toSameValue() {
    // given
    ValueChangeEvent event = new ValueChangeEvent(mock(UIComponent.class),
            Long.valueOf(101L), Long.valueOf(101L));
    ManageOperatorRevenueShareModel model = new ManageOperatorRevenueShareModel();
    model.setSelectedTemplateKey(101L);
    ctrl.setModel(spy(model));

    // when
    ctrl.templateChanged(event);

    // then
    assertEquals(101L, ctrl.getModel().getSelectedTemplateKey());
    verify(ctrl.getModel(), times(0)).setSelectedTemplateKey(eq(101L));
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:17,代碼來源:ManageOperatorRevenueShareCtrlTest.java

示例4: getAsString

import javax.faces.component.UIComponent; //導入依賴的package包/類
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
	if (value == null) {
		return CommonUtil.NO_SELECTION_VALUE;
	} else if (value instanceof String) {
		if (CommonUtil.NO_SELECTION_VALUE.equals(value)) {
			return CommonUtil.NO_SELECTION_VALUE;
		} else {
			return WebUtil.stringToLong((String) value).toString();
		}
	} else if (value instanceof IDVO) {
		return ((IDVO) value).getId().toString();
	} else {
		return CommonUtil.NO_SELECTION_VALUE;
	}
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:17,代碼來源:IDVOConverter.java

示例5: encodeAll

import javax.faces.component.UIComponent; //導入依賴的package包/類
@Override
public void encodeAll(FacesContext context) throws IOException {
	ResponseWriter writer = context.getResponseWriter();
	String features = ComponentUtils.getValueToRender(context, this);
	UIComponent parent = this;

	while (!(parent instanceof Map)) {
		parent = parent.getParent();
	}

	Map mapComponent = (Map) parent;
	String mapVar = mapComponent.getJsVariable();

	if (features == null || features.length() == 0) {
		features = "[]";
	}

	writer.write("var vector = new ol.layer.Vector({" + "  source: new ol.source.Vector(), " + "  style: new ol.style.Style({" + "	   fill: new ol.style.Fill({"
			+ "	     color: 'rgba(50,30,230, 0.3)'" + "	   })," + "	   stroke: new ol.style.Stroke({" + "	     color: 'rgba(50,25,180, 1)'," + "		 width: 2" + "	   })" + "  })" + "});\n");

	writer.write(mapVar + ".addLayer(vector);\n");
	writer.write("vector.getSource().addFeatures(" + features + ");\n");
}
 
開發者ID:elielwaltrick,項目名稱:ol3jsf,代碼行數:24,代碼來源:InputVectorLayer.java

示例6: partialEncodeVisit

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * <p>
 * Called when visiting the CoreRenderer's component during optimized partial page encoding so
 * that the CoreRenderer can modify what is actually encoded.  For example tab controls often
 * render the tabs for the ShowDetailItems in the tab bar before delegating to the
 * disclosed ShowDetailItem to render the tab content.  As a result, the tab control
 * needs to encode its tab bar if any of its ShowDetailItems are partial targets so that
 * the tab labels, for example, are up-to-date.
 * </p>
 * <p>
 * The default implementation calls the VisitCallback and returns its result if this UIXComponent
 * is a partial target of the current encoding.
 * </p>
 * @param visitContext VisitContext to pass to the VisitCallback
 * @param partialContext PartialPageContext for the current partial encoding
 * @param component The component for the CoreRenderer to visit
 * @param callback VisitCallback to call if this component is a partial target
 * @return The VisitResult controlling continued iteration of the visit.
 */
public VisitResult partialEncodeVisit(
  VisitContext       visitContext,
  PartialPageContext partialContext,
  UIComponent        component,
  VisitCallback      callback)
{
  if (partialContext.isPossiblePartialTarget(component.getId()) &&
      partialContext.isPartialTarget(component.getClientId(visitContext.getFacesContext())))
  {
    // visit the component instance
    return callback.visit(visitContext, component);
  }
  else
  {
    // Not visiting this component, but allow visit to
    // continue into this subtree in case we've got
    // visit targets there.
    return VisitResult.ACCEPT;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:40,代碼來源:CoreRenderer.java

示例7: findSortState

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * @return the state of the sorting after the page submition
 */
private String findSortState(
  int         sortability,
  UIComponent component,
  FacesBean   bean)
{
  String state;
  if (sortability == SORT_ASCENDING)
  {
    state = XhtmlConstants.SORTABLE_ASCENDING;
  }
  else if (sortability == SORT_DESCENDING)
  {
    state = XhtmlConstants.SORTABLE_DESCENDING;
  }
  else if ("descending".equals(getDefaultSortOrder(component, bean)))
  {
    state = XhtmlConstants.SORTABLE_ASCENDING;
  }
  else
  {
    state = "";
  }

  return state;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:ColumnGroupRenderer.java

示例8: _getSourceExtension

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * Returns the lowercase extension of any source URL
 */
private String _getSourceExtension(
  UIComponent component,
  FacesBean   bean)
{
  String sourceURLString = getSource(component, bean);

  if (sourceURLString != null)
  {
    int extensionIndex = sourceURLString.lastIndexOf('.');

    if ((extensionIndex != -1) &&
        (extensionIndex != sourceURLString.length() -1))
    {
      return sourceURLString.substring(extensionIndex + 1).toLowerCase();
    }
  }

  // no extension
  return null;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,代碼來源:MediaRenderer.java

示例9: _renderChildren

import javax.faces.component.UIComponent; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private void _renderChildren(
  FacesContext context,
  UIComponent  component,
  NodeData     parentNode
  ) throws IOException
{
  int i = 0;
  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    if (child.isRendered())
    {
      // Tell the parent node - if there is one - which child we're rendering
      if (parentNode != null)
      {
        parentNode.currentChild = i;
      }

      encodeChild(context, child);
    }

    i++;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:25,代碼來源:ColumnGroupRenderer.java

示例10: parse

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * Parses the specified string into a long integer.
 * 
 * @param context
 *            FacesContext for the request we are processing
 * @param component
 *            UIComponent we are checking for correctness
 * @param value
 *            the value to parse
 * @throws ValidatorException
 *             if the specified string could not be parsed into a valid long
 *             integer.
 */
public static long parse(FacesContext context, UIComponent uiComponent,
        String value) throws ValidatorException {
    if (!GenericValidator.isLong(value)) {
        Object[] args = null;
        String label = JSFUtils.getLabel(uiComponent);
        if (label != null) {
            args = new Object[] { label };
        }
        ValidationException e = new ValidationException(
                ValidationException.ReasonEnum.LONG, label, null);
        String message = JSFUtils.getText(e.getMessageKey(), args, context);
        throw getException(message);
    }
    return Long.parseLong(value);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:29,代碼來源:LongValidator.java

示例11: _getTrNumberConverter

import javax.faces.component.UIComponent; //導入依賴的package包/類
private String _getTrNumberConverter(
  FacesContext context,
  UIComponent  component,
  Map<?, ?>    messages)
{
  StringBuilder outBuffer = new StringBuilder(250);
  outBuffer.append("new TrNumberConverter(");

  Object[] params = _getClientConstructorParams(context, messages);
  for (int i = 0; i < params.length; i++)
  {
    try
    {
      JsonUtils.writeObject(outBuffer, params[i], false); 
    } 
    catch (Exception e)
    {
      outBuffer.append("null");
    }
    if (i < params.length-1)
      outBuffer.append(',');
  }
  outBuffer.append(')');
  return outBuffer.toString();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:NumberConverter.java

示例12: _executeValidate

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * Executes validation logic.
 */
private void _executeValidate(FacesContext context)
{
  Application application = context.getApplication();
  application.publishEvent(context, PreValidateEvent.class, UIComponent.class, this);
  try
  {
    validate(context);
  }
  catch (RuntimeException e)
  {
    context.renderResponse();
    throw e;
  }
  finally
  {
    application.publishEvent(context, PostValidateEvent.class, UIComponent.class, this);
  }

  if (!isValid())
  {
    context.renderResponse();
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:UIXEditableValueTemplate.java

示例13: removeChildren

import javax.faces.component.UIComponent; //導入依賴的package包/類
/**
 * Removes a pair of children, based on some characteristic of the
 *  event source.
 */
public void removeChildren(ActionEvent event)
{
  UIComponent eventSource = event.getComponent();
  UIComponent uic = eventSource.findComponent("pg1");
  int numChildren = uic.getChildCount();
  if (numChildren == 0)
    return;
  String eventSourceId = eventSource.getId();    
  if (eventSourceId.equals("cb2"))
  {
    _removeChild(uic, "sic1");
    _removeChild(uic, "cc1");
  }
  else if (eventSourceId.equals("cb3"))
  {
    _removeChild(uic, "cd1");
    _removeChild(uic, "sid1");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,代碼來源:ChangeBean.java

示例14: _getNodeAttributeMap

import javax.faces.component.UIComponent; //導入依賴的package包/類
private Map<String, Object> _getNodeAttributeMap(
  FacesContext context,
  UIComponent  comp,
  FacesBean    bean,
  boolean      embed)
{
  Map<String, Object> attrs = null;
  attrs = new ArrayMap<String, Object>(1);

  attrs.put(Icon.SHORT_DESC_KEY, getShortDesc(comp, bean));
  attrs.put(Icon.STYLE_CLASS_KEY, getStyleClass(comp, bean));

  if (embed)
  {
    attrs.put(Icon.EMBEDDED_KEY, Boolean.TRUE);
  }
  else
  {
    attrs.put(Icon.ID_KEY, getClientId(context, comp));
  }

  return attrs;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,代碼來源:IconRenderer.java

示例15: renderAllAttributes

import javax.faces.component.UIComponent; //導入依賴的package包/類
@Override
protected void renderAllAttributes(
  FacesContext     context,
  RenderingContext rc,
  UIComponent      component,
  FacesBean        bean
  ) throws IOException
{
  ResponseWriter rw = context.getResponseWriter();

  renderAllAttributes(context, rc, component, bean, false);
  renderStyleAttributes(context, rc, component, bean);

  // Old PDA renderer rule
  if (isPDA(rc))
    rw.writeAttribute("size", "1", null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:SeparatorRenderer.java


注:本文中的javax.faces.component.UIComponent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。