Returns a markup id that is JQuery-safe and could be used as a selector.

@param component the component which markup id should be return
@return the component's markup id that is escaped so that it could be used as JQuery selector
968093
public static CharSequence getMarkupId(final Component component) {
        Args.notNull(component, "component");
        String markupId = component.getMarkupId(true);
        return escapeMarkupId(markupId);
    }
197496
public UI wrap(Component component) {
        if (component instanceof UI) {
            return (UI) component;
        }
        if (component instanceof Window) {
            return wrapWindow((Window) component);
        }
        if (component instanceof Layout) {
            return wrapLayout((Layout) component);
        }

        // Ok it's a component we cannot handle directly
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeFull();
        layout.addComponent(component);
        layout.setExpandRatio(component, 1);
        return wrapLayout(layout);
    }
1033560
private String getActualComponentType(String componentType) {

        if (componentType == null) {
            throw new IllegalArgumentException("参数不能为null.");
        }

        int lastIndex = componentType.lastIndexOf(ARRAY_PREFIX);
        if (lastIndex != -1) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < lastIndex + 1; i++) {
                sb.append(ARRAY_PREFIX);
            }
            sb.append("L");
            sb.append(componentType.substring(lastIndex + 1));
            sb.append(";");
            return sb.toString();
        }

        return componentType;
    }
1232831
private WComponent findComponentForLabel(final WComponent component) {
		// Input (but not a RadioButtonGroup)
		if (component instanceof Input && !(component instanceof RadioButtonGroup)) {
			return component;
		}

		// Fieldset or RadioButton
		if (component instanceof WFieldSet || component instanceof WRadioButton) {
			return component;
		}

		// Dont dive into repeaters or tables (Not usually used in a WField)
		if (component instanceof WRepeater || component instanceof WTable || component instanceof WDataTable) {
			return null;
		}

		if (component instanceof Container) {
			Container container = (Container) component;
			final int childCount = container.getChildCount();

			for (int i = 0; i < childCount; i++) {
				WComponent theField = findComponentForLabel(container.getChildAt(i));

				if (theField != null) {
					return theField;
				}
			}
		}

		return null;
	}
873958
public String getLabel(JComponent component) {
        String label = component2LabelMap.get(component);
        if (label != null) {
            return label;
        } else {
            return "";
        }
    }
841979
public static WComponent getComponentWithId(final WComponent root, final String id) {
		return getComponentWithId(root, id, false);
	}
1367086
@Override
	protected MarkupElement onComponentTag(ComponentTag tag)
			throws ParseException {
		if (tag == null) {
			return tag;
		}

		// Only xml tags not already identified as Wicket components will be
		// considered for autolinking. This is because it is assumed that Wicket
		// components like images or all other kind of Wicket Links will handle
		// it themselves.
		// Subclass analyzeAutolinkCondition() to implement you own
		// implementation and register the new tag handler with the markup
		// parser through Application.newMarkupParser().
		if (analyzeAutolinkCondition(tag) == true) {
			// Just a dummy name. The ComponentTag will not be forwarded.
			tag.setId(AUTOLINK_ID);
			tag.setAutoComponentTag(true);
			tag.setModified(true);
			return tag;
		}

		return tag;
	}
1331069
private String getElementID(final String relativePath) {
        final String fragment = getFragment(relativePath);
        if (fragment != null) {
            if (fragment.lastIndexOf(SLASH) != -1) {
                return fragment.substring(fragment.lastIndexOf(SLASH) + 1);
            } else {
                return fragment;
            }
        }
        return null;
    }
300813
public static ElementUI getAssociatedElement(BaseComponent component) {
        return component == null ? null : (ElementUI) component.getAttribute(ASSOC_ELEMENT);
    }
1057944
protected String htmlComponent(CmsSetupComponent component) {

        StringBuffer html = new StringBuffer(256);
        html.append("\t<tr>\n");
        html.append("\t\t<td>\n");
        html.append("\t\t\t<input type='checkbox' name='availableComponents' value='");
        html.append(component.getId());
        html.append("'");
        if (component.isChecked()) {
            html.append(" checked='checked'");
        }
        html.append(" onClick=\"checkComponentDependencies('");
        html.append(component.getId());
        html.append("');\">\n");
        html.append("\t\t</td>\n");
        html.append("\t\t<td style='width: 100%; '>\n\t\t\t");
        html.append(component.getName());
        html.append("\n\t\t</td>\n");
        html.append("\t</tr>\n");
        html.append("\t<tr>\n");
        html.append("\t\t<td>&nbsp;</td>\n");
        html.append(
            "\t\t<td style='vertical-align: top; width: 100%; padding-bottom: 8px; font-style: italic;'>\n\t\t\t");
        html.append(component.getDescription());
        html.append("\n\t\t</td>\n");
        html.append("\t</tr>\n");

        return html.toString();
    }
1251805
public void removeTaggedComponent(final WComponent component) {
		TemplateModel model = getOrCreateComponentModel();
		if (model.taggedComponents != null) {
			// Find tag
			String tag = null;
			for (Map.Entry<String, WComponent> entry : model.taggedComponents.entrySet()) {
				if (entry.getValue().equals(component)) {
					tag = entry.getKey();
					break;
				}
			}
			if (tag != null) {
				removeTaggedComponent(tag);
			}
		}
	}
216677
private void markComponentForDeletion(String id , UIComponent component)
    {
        _componentsMarkedForDeletion.get(_deletionLevel).put(id, component);
    }
446493
private String createId(FacesContext context)
            throws JspException {

        if (this.id == null) {
            return getFacesJspId();
        } else {
            // if this tag happens to be nested within <c:forEach>, jspId
            // will be the same for each iteration. So it is
            // transformed into a unique "id" by appending a counter which gets
            // stored in request scope with jspId as the key for use during next
            // iteration.
            if (isDuplicateId(this.id)) {
                if (!isSpecifiedIdUnique(this.id)) {
                    if (isNestedInIterator) {
                        this.id = generateIncrementedId(this.id);
                    } else {
                        StringWriter writer = new StringWriter(128);
                        printTree(context.getViewRoot(), this.id, writer, 0);
                        String msg = "Component ID '"
                                + this.id
                                + "' has already been used"
                                + " in the view.\n"
                                + "See below for the view up to the point of"
                                + " the detected error.\n"
                                + writer.toString();
                        throw new JspException(msg);
                    }
                }
            }
            return (this.id);
        }

    }
1110328
public String apply(final String markup) {
        if (tags.isEmpty()) {
            return markup;
        }

        if (null == tagletPattern) {
            tagletPattern = Pattern.compile(createTagletPattern(), Pattern.MULTILINE);
        }

        final Matcher matcher = tagletPattern.matcher(markup);
        if (!matcher.find()) {
            return markup;
        }

        matcher.reset();
        return doApply(matcher);
    }
1248036
private static Map decodeComponent(String component) {
        byte[] bodyData = Base64.decode(component, Base64.DEFAULT);
        if (bodyData == null)
            return null;
        try {
            return Manager.getObjectMapper().readValue(bodyData, Map.class);
        } catch (IOException e) {
            Log.w(TAG, "Failed decode component: %s", e, component);
            return null;
        }
    }
794861
protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();

        writer.startElement("div", null);
        writer.writeAttribute("id", clientId, null);
        writer.writeAttribute("style", "display: none;", null);

        renderPassThruAttributes(context, component, null);

        writer.endElement("div");
    }
1032417
public static String getterName(Class<?> componentClass) {
      if (componentClass == null) return null;
      StringBuilder sb = new StringBuilder("get");
      sb.append(componentClass.getSimpleName());
      return sb.toString();
   }