Review of cl1p in one powerful word

Mr Biggs just posted an excellent article on cl1p.net on his blog.

Thanks for the post Mr Biggs!

Posted in Uncategorized | Leave a comment

A programmers start page

You can use cl1p.net as a start page for programmers. As a web application developer I have to access a lot of machines in the office. Most of them are by IP and some have long cumbersome names. I also have to access the web apps that I’m working on from different browsers.

My solution was to use cl1p.net to make a simple HTML start page. You can see it here.

Create your own, just follow these steps.

1. Pick a URL that starts with cl1p.net. ( i picked http://cl1p.net/robs/startpage )

2. In the Textarea write the HTML. I just use a simple table and links, but you could use any HTML you wanted.

3. Add a password, change the keep for to something longer then a week and Click save, you will see a message saying (Page was saved).

4. In the top right hand corner you see a link http://cl1p.net/robs/startpage. Click on that link to see the rendered HTML.

5. What happened here is that you are now looking at http://d.cl1p.net/robs/startpage. This will only show you the raw data, and since its HTML we see an HTML page.

6. Set http://d.cl1p.net/robs/startpage as the homepage.

Bam! There you go. A programmers start page.

Posted in cl1p | 1 Comment

Just Married

Last weekend I got married. The wedding went off without a hitch and everyone had a great time. And now back to programming.

Posted in Uncategorized | Leave a comment

Writing Icefaces components – part 1

I work for icesoft on the component team, and I am just about to write a new component for a company that sells hand wheels and a lot of other industrial kits, and I thought I would
walk you through the process.

The Slider Control Part 1

I’m going to be implementing script.aclo.us slider control in icefaces.

Looking at the slider example in the script.aclo.us download I see that it requires the following HTML.

So the first step will be to create a new component that will render that HTML.

So fire up your editor of choice and lets get started.

The component class

Silder.java defines the properties or model of this component. This is where you could put things
like style and styleClass for example. But for now its going to be blank. I just want to get the framework in
place first.

Slider.java

package com.icesoft.faces.component.slider;

import javax.faces.component.UIInput;

public class Slider extends UIInput {

public static final String COMPONENET_TYPE = "com.icesoft.faces.Slider";
public static final String DEFAULT_RENDERER_TYPE = "com.icesoft.faces.SliderRenderer";
public static final String COMPONENT_FAMILY = "com.icesoft.faces.SliderFamily";

public Slider() {
super();
}

public String getFamily() {
return COMPONENT_FAMILY;
}

public String getRendererType() {
return DEFAULT_RENDERER_TYPE;
}

}

Again this is just a skeleton to get started.

Up next. The renderer. Where all the magic happens. Again like the first step we are just getting started
so all I’m going to do is output the HTML show above.

SliderRenderer.java

package com.icesoft.faces.component.slider;

import com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer;
import com.icesoft.faces.renderkit.dom_html_basic.HTML;
import com.icesoft.faces.context.DOMContext;

import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;

import org.w3c.dom.Element;

public class SliderRenderer extends DomBasicRenderer {

public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) {
DOMContext domContext = DOMContext.attachDOMContext(facesContext, uiComponent);
if (!domContext.isInitialized()) {
Element root = domContext.createRootElement(HTML.DIV_ELEM);
root.setAttribute(HTML.STYLE_ATTR,"width:200px;background-color:#aaa;height:5px;");
Element slider = domContext.createElement(HTML.DIV_ELEM);
slider.setAttribute(HTML.STYLE_ATTR,"width:5px;height:10px;background-color:#f00;");
root.appendChild(slider);
}
}
}

Now we need a tag for out JSP. Since we don’t have any attributes just yet its going to be simple.

SliderTag.java

package com.icesoft.faces.component.slider;

import javax.faces.webapp.UIComponentTag;

public class SliderTag extends UIComponentTag {

public String getComponentType() {
return Slider.COMPONENET_TYPE;
}

public String getRendererType() {
return Slider.DEFAULT_RENDERER_TYPE;
}
}


Adding to faces-config.xml

We need to tell icefaces about this new component. Add the following to the faces-config.xml.



com.icesoft.faces.SliderFamily
com.icesoft.faces.SliderRenderer
com.icesoft.faces.component.slider.SliderRenderer


com.icesoft.faces.Slider
com.icesoft.faces.component.slider.Slider


Creating a TLD

This part here is a bit strange. You need to create a tld file, Then you need to put the tld file in a jar. and
include it inĀ  your web application lib directory.

0.03
1.2
slider
http://icesoft.com/slider

Slider


slider
com.icesoft.faces.component.slider.SliderTag
JSP
Slider Tag



There you go! Step 1 is complete.

Posted in Icefaces | 4 Comments

del.icio.us for cl1p now > 1000

Cl1p.net just passed a big milestone. Over 1000 people have bookmarked cl1p.net on del.icio.us! I’m glad that so many people are using cl1p.net. But just wait, new features are in the work that will make cl1p.net more accessible and fun!

Posted in cl1p | Leave a comment