private void resetMetaWidgets() { ForgeConfigReader configReader = new ForgeConfigReader(this.config, this.project); this.entityMetawidget = new StaticHtmlMetawidget(); this.entityMetawidget.setConfigReader(configReader); this.entityMetawidget.setConfig("scaffold/faces/metawidget-entity.xml"); this.searchMetawidget = new StaticHtmlMetawidget(); this.searchMetawidget.setConfigReader(configReader); this.searchMetawidget.setConfig("scaffold/faces/metawidget-search.xml"); this.beanMetawidget = new StaticHtmlMetawidget(); this.beanMetawidget.setConfigReader(configReader); this.beanMetawidget.setConfig("scaffold/faces/metawidget-bean.xml"); this.qbeMetawidget = new StaticJavaMetawidget(); this.qbeMetawidget.setConfigReader(configReader); this.qbeMetawidget.setConfig("scaffold/faces/metawidget-qbe.xml"); this.rmEntityMetawidget = new StaticJavaMetawidget(); this.rmEntityMetawidget.setConfigReader(configReader); this.rmEntityMetawidget.setConfig("scaffold/faces/metawidget-remove-entity.xml"); }
/** * Overridden to carry CSS style attributes into the nested Metawidget. */ @Override public void initNestedMetawidget( StaticMetawidget nestedMetawidget, Map<String, String> attributes ) { super.initNestedMetawidget( nestedMetawidget, attributes ); StaticHtmlMetawidget htmlMetawidget = (StaticHtmlMetawidget) nestedMetawidget; // Attributes htmlMetawidget.setStyle( mStyle ); htmlMetawidget.setStyleClass( mStyleClass ); }
/** * Writes the entity Metawidget and its namespaces into the given context. */ protected void writeEntityMetawidget(final Map<Object, Object> context, final int entityMetawidgetIndent, final Map<String, String> existingNamespaces) { StringWriter stringWriter = new StringWriter(); this.entityMetawidget.write(stringWriter, entityMetawidgetIndent); context.put("metawidget", stringWriter.toString().trim()); Map<String, String> namespaces = this.entityMetawidget.getNamespaces(); namespaces.keySet().removeAll(existingNamespaces.keySet()); context.put("metawidgetNamespaces", namespacesToString(namespaces)); }
+ StringUtils.SEPARATOR_DOT_CHAR + StringUtils.decapitalize(columnAttributes.get(NAME)); output.setValue(StaticFacesUtils.wrapExpression(displayExpression)); output.setValue(StaticFacesUtils.wrapExpression(valueExpression)); StaticHtmlMetawidget footerMetawidget = new StaticHtmlMetawidget(); Map<String, String> footerAttributes = CollectionUtils.newHashMap(); metawidget.initNestedMetawidget(footerMetawidget, footerAttributes); footerMetawidget.removeWidgetProcessor(footerMetawidget .getWidgetProcessor(RequiredAttributeProcessor.class)); footerMetawidget.setValue(StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + columnName)); footerMetawidget.setPath(componentType + StringUtils.SEPARATOR_FORWARD_SLASH_CHAR + columnName); footerMetawidget.setLayout(new SimpleLayout()); message.putAttribute("for", footerMetawidget.getAttribute("id")); message.putAttribute("styleClass", "error"); footerFacet.getChildren().add(message);
this.entityMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + "." + ccEntity)); this.entityMetawidget.setPath(entity.getQualifiedName()); this.entityMetawidget.setReadOnly(false); this.entityMetawidget.setStyle(null); this.entityMetawidget.setReadOnly(true); writeEntityMetawidget(context, this.viewTemplateEntityMetawidgetIndent, this.viewTemplateNamespaces); this.searchMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + ".example")); this.searchMetawidget.setPath(entity.getQualifiedName()); this.beanMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + ".pageItems")); this.beanMetawidget.setPath(viewBean.getQualifiedName() + "/pageItems"); writeSearchAndBeanMetawidget(context, this.searchTemplateSearchMetawidgetIndent, this.searchTemplateBeanMetawidgetIndent, this.searchTemplateNamespaces);
columnContents = new StaticHtmlMetawidget(); String valueExpression = dataTable.getAttribute( "var" ) + StringUtils.SEPARATOR_DOT_CHAR + StringUtils.decapitalize( columnAttributes.get( NAME ) ); columnContents.putAttribute( "value", StaticFacesUtils.wrapExpression( valueExpression ) ); columnMetawidget.setPath( WidgetBuilderUtils.getComponentType( tableAttributes ) + StringUtils.SEPARATOR_FORWARD_SLASH_CHAR + columnAttributes.get( NAME ) ); metawidget.initNestedMetawidget( columnMetawidget, columnAttributes ); columnMetawidget.setLayout( new SimpleLayout() ); columnMetawidget.setReadOnly( true );
StaticHtmlMetawidget nestedMetawidget = new StaticHtmlMetawidget(); metawidget.initNestedMetawidget(nestedMetawidget, attributes); String unwrappedExpression = StaticFacesUtils.unwrapExpression(nestedMetawidget.getValue()); nestedMetawidget.putAttribute("rendered", StaticFacesUtils.wrapExpression("!empty " + unwrappedExpression));
+ StringUtils.decapitalize(columnAttributes.get(NAME)) + ")"; ((BaseStaticXmlWidget) link).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view"); output.setValue(StaticFacesUtils.wrapExpression(displayExpression)); output.setValue(StaticFacesUtils.wrapExpression(valueExpression)); StaticHtmlMetawidget footerMetawidget = new StaticHtmlMetawidget(); Map<String, String> footerAttributes = CollectionUtils.newHashMap(); metawidget.initNestedMetawidget(footerMetawidget, footerAttributes); footerMetawidget.removeWidgetProcessor(footerMetawidget .getWidgetProcessor(RequiredAttributeProcessor.class)); footerMetawidget.setValue(StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + columnName)); footerMetawidget.setPath(componentType + StringUtils.SEPARATOR_FORWARD_SLASH_CHAR + columnName); footerMetawidget.setLayout(new SimpleLayout()); message.putAttribute("for", footerMetawidget.getAttribute("id")); message.putAttribute("styleClass", "error"); footerFacet.getChildren().add(message);
this.entityMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + "." + ccEntity)); this.entityMetawidget.setPath(entity.getQualifiedName()); this.entityMetawidget.setReadOnly(false); this.entityMetawidget.setStyle(null); this.entityMetawidget.setReadOnly(true); writeEntityMetawidget(context, this.viewTemplateEntityMetawidgetIndent, this.viewTemplateNamespaces); this.searchMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + ".example")); this.searchMetawidget.setPath(entity.getQualifiedName()); this.beanMetawidget.setValue(StaticFacesUtils.wrapExpression(beanName + ".pageItems")); this.beanMetawidget.setPath(viewBean.getQualifiedName() + "/pageItems"); writeSearchAndBeanMetawidget(context, this.searchTemplateSearchMetawidgetIndent, this.searchTemplateBeanMetawidgetIndent, this.searchTemplateNamespaces);
StaticHtmlMetawidget nestedMetawidget = new StaticHtmlMetawidget(); metawidget.initNestedMetawidget(nestedMetawidget, attributes); String unwrappedExpression = StaticFacesUtils.unwrapExpression(nestedMetawidget.getValue()); nestedMetawidget.putAttribute("rendered", StaticFacesUtils.wrapExpression("!empty " + unwrappedExpression));
private void resetMetaWidgets() { ForgeConfigReader configReader = new ForgeConfigReader(getConfig(), this.project); this.entityMetawidget = new StaticHtmlMetawidget(); this.entityMetawidget.setConfigReader(configReader); this.entityMetawidget.setConfig(SCAFFOLD_META_WIDGET_ENTITY); this.searchMetawidget = new StaticHtmlMetawidget(); this.searchMetawidget.setConfigReader(configReader); this.searchMetawidget.setConfig(SCAFFOLD_META_WIDGET_SEARCH); this.beanMetawidget = new StaticHtmlMetawidget(); this.beanMetawidget.setConfigReader(configReader); this.beanMetawidget.setConfig(SCAFFOLD_META_WIDGET_BEAN); this.qbeMetawidget = new StaticJavaMetawidget(); this.qbeMetawidget.setConfigReader(configReader); this.qbeMetawidget.setConfig(SCAFFOLD_META_WIDGET_QBE); this.rmEntityMetawidget = new StaticJavaMetawidget(); this.rmEntityMetawidget.setConfigReader(configReader); this.rmEntityMetawidget.setConfig(SCAFFOLD_META_WIDGET_REMOVE_ENTITY); }
/** * Writes the entity Metawidget and its namespaces into the given context. */ protected void writeEntityMetawidget(final Map<Object, Object> context, final int entityMetawidgetIndent, final Map<String, String> existingNamespaces) { StringWriter stringWriter = new StringWriter(); this.entityMetawidget.write(stringWriter, entityMetawidgetIndent); context.put("metawidget", stringWriter.toString().trim()); Map<String, String> namespaces = this.entityMetawidget.getNamespaces(); namespaces.keySet().removeAll(existingNamespaces.keySet()); context.put("metawidgetNamespaces", namespacesToString(namespaces)); }
/** * Writes the search Metawidget, the bean Metawidget and their namespaces into the given context. */ protected void writeSearchAndBeanMetawidget(final Map<Object, Object> context, final int searchMetawidgetIndent, final int beanMetawidgetIndent, final Map<String, String> existingNamespaces) { StringWriter stringWriter = new StringWriter(); this.searchMetawidget.write(stringWriter, searchMetawidgetIndent); context.put("searchMetawidget", stringWriter.toString().trim()); stringWriter = new StringWriter(); this.beanMetawidget.write(stringWriter, beanMetawidgetIndent); context.put("beanMetawidget", stringWriter.toString().trim()); Map<String, String> namespaces = this.searchMetawidget.getNamespaces(); namespaces.putAll(this.beanMetawidget.getNamespaces()); namespaces.keySet().removeAll(existingNamespaces.keySet()); context.put("metawidgetNamespaces", namespacesToString(namespaces)); }
/** * Writes the search Metawidget, the bean Metawidget and their namespaces into the given context. */ protected void writeSearchAndBeanMetawidget(final Map<Object, Object> context, final int searchMetawidgetIndent, final int beanMetawidgetIndent, final Map<String, String> existingNamespaces) { StringWriter stringWriter = new StringWriter(); this.searchMetawidget.write(stringWriter, searchMetawidgetIndent); context.put("searchMetawidget", stringWriter.toString().trim()); stringWriter = new StringWriter(); this.beanMetawidget.write(stringWriter, beanMetawidgetIndent); context.put("beanMetawidget", stringWriter.toString().trim()); Map<String, String> namespaces = this.searchMetawidget.getNamespaces(); namespaces.putAll(this.beanMetawidget.getNamespaces()); namespaces.keySet().removeAll(existingNamespaces.keySet()); context.put("metawidgetNamespaces", namespacesToString(namespaces)); }