Skip to content

Commit

Permalink
moving the componentOutput into its own taglib definition file
Browse files Browse the repository at this point in the history
  • Loading branch information
werpu committed Jan 26, 2010
1 parent d47c7a4 commit ff5cb85
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 528 deletions.
@@ -0,0 +1,34 @@
<?xml version='1.0' encoding='UTF-8'?>

<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->

<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://myfaces.apache.org/ext-scripting</namespace>
<tag>
<tag-name>compilerOutput</tag-name>
<component>
<component-type>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-type>
<renderer-type>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-type>
</component>
</tag>
</facelet-taglib>

This file was deleted.

Expand Up @@ -21,7 +21,6 @@ package org.apache.myfaces.groovyloader.test
* @author Werner Punz
*/


class TestBean {
String helloworld = "hallo ist - die bean"

Expand Down
Expand Up @@ -21,6 +21,8 @@
/**
* @author werpu2
* @date: 01.09.2009
*
* This is the domain object we now edit it
*/
public class BlogEntry {

Expand Down
Expand Up @@ -101,14 +101,15 @@
/**
* Simple component to be picked up by
*/

@FacesComponent("at.irian.JavaTestComponent")
public class JavaTestComponent extends UIInput implements Markable {

String _testAttr;


enum PropertyKeys {
inc, testAttr, testAttr2, testAttr3
inc, testAttr, testAttr2, testAttr3, testAttr4
}

public JavaTestComponent() {
Expand Down Expand Up @@ -148,11 +149,27 @@ public void setTestAttr2x(String testAttr) {
getStateHelper().put(PropertyKeys.testAttr2, testAttr);
}

public String getTestAttr3() {
public String getTestAttr3() {
return (String) getStateHelper().eval(PropertyKeys.testAttr3, "");
}

public void setTestAttr3(String testAttr) {
getStateHelper().put(PropertyKeys.testAttr3, testAttr);
}

/**
* Ok guys, lets add a new attribute to the component
* which is displayed in our browser page
*
* Note we are on jsf 2 level
*/

public String getTestAttr4() {
return (String) getStateHelper().eval(PropertyKeys.testAttr4, "");
}

public void setTestAttr4(String testAttr) {
getStateHelper().put(PropertyKeys.testAttr4, testAttr);
}

}
Expand Up @@ -46,12 +46,15 @@ public class JavaTestRenderer1 extends HtmlTextRendererBase {

static Log log = LogFactory.getLog(JavaTestRenderer1.class);


private static final String MSG2 = "aaaa Hello world from Renderer 1";

public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
super.encodeBegin(context, component);
JavaTestComponent myComponent = (JavaTestComponent) component;



ResponseWriter writer = context.getResponseWriter();
test(myComponent, writer);

Expand All @@ -63,6 +66,8 @@ private void test(JavaTestComponent myComponent, ResponseWriter writer) throws I
writer.write(MSG2);
writer.write(myComponent.getMarker());
writer.write("<h1/>TestAttr: "+myComponent.getTestAttr()+" | "+myComponent.getTestAttr3()+"</h1>");
/*lets add the new attribute as extra output*/
writer.write("<h2>"+myComponent.getTestAttr4()+"</h2>");
}

public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
Expand Down

0 comments on commit ff5cb85

Please sign in to comment.