本文整理了Java中org.hippoecm.frontend.plugins.yui.layout.YuiId
类的一些代码示例,展示了YuiId
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YuiId
类的具体详情如下:
包路径:org.hippoecm.frontend.plugins.yui.layout.YuiId
类名称:YuiId
[英]The YuiId allows for transparent element id resolution, without having to worry about id clashes on the client. The idea is really simple. A YuiId consists of an id value, and an optional parentId value. If the parentId is set, the YuiId will return an elementId like 'parentId:id', else it will only return the local id. The id value corresponds to an element in a org.apache.wicket.Component's html file through the attribute yui:id, the parent id is a normal id-attribute, normally generated by Wicket and added to the YuiId once it's known. The YAHOO.hippo.LayoutManager module uses YAHOO.hippo.Dom.resolveElement(id) to resolve elements by their YuiId. For more info see: hippo-ecm-addon-yui/src/main/java/org/hippoecm/frontend/plugins/yui/inc/hippo/2.7.0/hippodom/hippodom.js
[中]YuiId允许透明的元素id解析,而不必担心客户端上的id冲突。这个想法很简单。YuiId由一个id值和一个可选的parentId值组成。如果设置了parentId,YuiId将返回一个elementId,比如“parentId:id”,否则它将只返回本地id。id值对应于组织中的一个元素。阿帕奇。维克特。组件的html文件,通过属性yui:id,父id是一个普通id属性,通常由Wicket生成,并在知道YuiId后添加到YuiId中。雅虎。河马。LayoutManager模块使用YAHOO。河马。多姆。resolveElement(id)按YuiId解析元素。有关更多信息,请参阅:hippo ecm插件yui/src/main/java/org/hippoecm/frontend/plugins/yui/inc/hippo/2.7.0/hippodom/hippodom。js
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
YuiId id = (YuiId) value;
String elid = id.getElementId();
if (elid != null && !"".equals(elid)) {
return elid;
}
return null;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public void setMarkupId(String markupId) {
rootId.setParentId(markupId);
for (UnitSettings unit : units) {
unit.getId().setParentId(markupId);
unit.getBody().setParentId(markupId);
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public Object component(Component component) {
for (Object behavior : component.getBehaviors()) {
if (behavior instanceof IWireframe) {
return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
} else if (behavior instanceof UnitBehavior) {
String position = ((UnitBehavior) behavior).getPosition();
UnitSettings unit = settings.getUnit(position);
if (unit != null) {
YuiId body = unit.getBody();
if (body != null) {
body.setParentId(null);
body.setId(component.getMarkupId());
}
} else {
throw new RuntimeException("Invalid UnitBehavior position " + position);
}
return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
}
return IVisitor.CONTINUE_TRAVERSAL;
}
});
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public UnitSettings(String position, IValueMap config) {
this.position = position;
if (config != null) {
try {
PluginConfigMapper.populate(this, config);
} catch (MappingException e) {
throw new RuntimeException("invalid configuration");
}
id.setId(config.getString("id"));
if (config.containsKey("body")) {
body.setId(config.getString("body"));
}
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public YuiId getYuiId() {
final YuiId rootId = settings.getRootId();
if (rootId.getParentId() == null) {
settings.setMarkupId(getComponent().getMarkupId());
}
return rootId;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public void component(Component component, IVisit<Void> visit) {
for (Object behavior : component.getBehaviors()) {
if (behavior instanceof IWireframe) {
visit.dontGoDeeper();
} else if (behavior instanceof UnitBehavior) {
String position = ((UnitBehavior) behavior).getPosition();
UnitSettings unit = settings.getUnit(position);
if (unit != null) {
YuiId body = unit.getBody();
if (body != null) {
body.setParentId(null);
body.setId(component.getMarkupId());
}
} else {
throw new RuntimeException("Invalid UnitBehavior position " + position);
}
visit.dontGoDeeper();
}
}
}
});
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public UnitSettings(String position, IValueMap config) {
this.position = position;
if (config != null) {
try {
PluginConfigMapper.populate(this, config);
} catch (MappingException e) {
throw new RuntimeException("invalid configuration");
}
id.setId(config.getString("id"));
if (config.containsKey("body")) {
body.setId(config.getString("body"));
}
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
YuiId id = (YuiId) value;
String elid = id.getElementId();
if (elid != null && !"".equals(elid)) {
return elid;
}
return null;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public WireframeSettings(IPluginConfig config) {
units = new ArrayList<UnitSettings>(5);
for (String position : new String[]{"top", "left", "center", "right", "bottom"}) {
String unitConfig = config.getString(position);
if (unitConfig != null) {
units.add(new UnitSettings(position, new ValueMap(unitConfig)));
}
}
try {
PluginConfigMapper.populate(this, config);
} catch (MappingException e) {
throw new RuntimeException(e);
}
rootId.setId(config.getString("root.id"));
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public void setMarkupId(String markupId) {
rootId.setParentId(markupId);
for (UnitSettings unit : units) {
unit.getId().setParentId(markupId);
unit.getBody().setParentId(markupId);
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public String getId() {
return settings.getRootId().getElementId();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public WireframeSettings(IPluginConfig config) {
units = new ArrayList<>(5);
for (String position : new String[]{"top", "left", "center", "right", "bottom"}) {
String unitConfig = config.getString(position);
if (unitConfig != null) {
units.add(new UnitSettings(position, new ValueMap(unitConfig)));
}
}
try {
PluginConfigMapper.populate(this, config);
} catch (MappingException e) {
throw new RuntimeException(e);
}
rootId.setId(config.getString("root.id"));
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public String getId() {
return settings.getRootId().getElementId();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
@Override
public String getId() {
return settings.getRootId().getElementId();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
@Override
public String getId() {
return settings.getRootId().getElementId();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public void resize(AjaxRequestTarget target) {
if (rendered) {
target.appendJavaScript(
"YAHOO.hippo.LayoutManager.getWireframe('" + settings.getRootId().getElementId() + "').resize()");
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui
public boolean toggle(String position, AjaxRequestTarget target) {
UnitSettings unitSettings = settings.getUnit(position);
if (unitSettings == null) {
throw new IllegalArgumentException(
"No unit with position " + position + " is defined in layout[" + settings.getRootId() + "], cannot expand/collapse.");
}
boolean expand = !unitSettings.isExpanded();
String jsMethod = expand ? "YAHOO.hippo.LayoutManager.expandUnit" : "YAHOO.hippo.LayoutManager.collapseUnit";
target.appendJavascript(
jsMethod + "('" + this.settings.getRootId().getElementId() + "', '" + position + "');");
unitSettings.setExpanded(expand);
onToggle(expand, position);
return expand;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-edit
@Override
public void render(PluginRequestTarget target) {
super.render(target);
boolean hasMessage = feedback.anyMessage();
UnitSettings topSettings = wfSettings.getUnit("top");
boolean updateTop = false;
if (hasMessage && !feedbackShown) {
topSettings.setHeight(Integer.valueOf(
getPluginConfig().getAsInteger("feedback.height", 50) + Integer.parseInt(topHeight)).toString());
feedbackShown = true;
updateTop = true;
} else if (!hasMessage && feedbackShown) {
topSettings.setHeight(topHeight);
feedbackShown = false;
updateTop = true;
}
if (updateTop && isVisibleInHierarchy() && target != null) {
String topId = topSettings.getId().getElementId();
target.appendJavascript("YAHOO.hippo.LayoutManager.findLayoutUnit(YAHOO.util.Dom.get('" + topId
+ "')).set('height', " + topSettings.getHeight() + ");");
target.addComponent(feedback);
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public boolean toggle(String position) {
UnitSettings unitSettings = settings.getUnit(position);
if (unitSettings == null) {
throw new IllegalArgumentException(
"No unit with position " + position + " is defined in layout[" + settings.getRootId() + "], cannot expand/collapse.");
}
boolean expand = !unitSettings.isExpanded();
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
if (target != null) {
String jsMethod = expand ? "YAHOO.hippo.LayoutManager.expandUnit" : "YAHOO.hippo.LayoutManager.collapseUnit";
target.appendJavaScript(
jsMethod + "('" + this.settings.getRootId().getElementId() + "', '" + position + "');");
}
unitSettings.setExpanded(expand);
onToggle(expand, position);
return expand;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
/**
* If no unit has been expanded and a default expanded unit has been configured, it will be expanded.
*/
public void expandDefault() {
final String defaultExpandedUnit = settings.getDefaultExpandedUnit();
if (defaultExpandedUnit == null) {
return;
}
final UnitSettings defaultExpandedUnitSettings = settings.getUnit(defaultExpandedUnit);
if (defaultExpandedUnitSettings == null || !defaultExpandedUnitSettings.isExpandCollapseEnabled()) {
return;
}
if (!settings.hasExpandedUnit()) {
final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
if (target != null) {
final String jsMethod = String.format("YAHOO.hippo.LayoutManager.expandUnit('%s', '%s');",
settings.getRootId().getElementId(), defaultExpandedUnitSettings.getPosition());
target.appendJavaScript(jsMethod);
}
defaultExpandedUnitSettings.setExpanded(true);
}
onExpandDefault();
}
内容来源于网络,如有侵权,请联系作者删除!