Lou Caudell

Ranch Hand
+ Follow
since Oct 06, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lou Caudell

It's just a standard jsp form whose action calls the servlet. The values are extracted and utilized for a smtp transaction. Then I want it to return to the same page, so validation can be added. I realize that this is easier to accomplish with struts, but I wanted to see it in this traditional form. Oh by the way the jsp is composed of header with css menus calling jsp's and a common footer.
13 years ago
Can some give an example of the correct requestDispatcher api to have the servlet return to the calling page.
I don't want it to open another tab.

Java 6
Tomcat 6.0.29
Firefox 3.6
Servlet/jsp 2.5/2.1
Eclipse galileo
13 years ago
The primary factor in this problem turns out to be calling table.removeAll() in the refresh routine, which removes the renderers from memory.
14 years ago
Unfortunately, I am not at liberty to post the code. Thanks for the incite.
14 years ago
Other tables in this app with JComboBox columns show the row cell with the drop down arrow, this one shows a blank field until clicked on. I both cases renderers have been written, but not necessarily editors.
14 years ago
I should clarify that the drop down arrows do appear when clicked on, but go away when cell is refocused.

DefaultCellEditor is used for every column.
14 years ago
I have a JTable with a model class that extends DefaultTableModel. The model list is composed of a decorated class which is an hibernate table row.
This row contains a couple of entities which are lists that will be rendered as JComboBoxes in the table. My issues is that at runtime the combo boxes do not show the drop down arrow customarily seen with JComboBoxes. I used a DefaultComboBoxModel straight up.
Can someone tell me how to make the drop down arrows appear.
14 years ago
I didn't notice it in your code here, but it sounds as if you are setting the gbc fill to expand to available space.
14 years ago
Continued.....

// ---------------------------------------------------------------------------------- JSP
<ui:tableColumn binding="#{Page1.tableColumn8}" headerText="mask" id="tableColumn8">
<ui:textField binding="#{Page1.textField5}" id="textField5" style="width: 50px" text="#{currentRow.value['backcolor']}" >
<f:converter converterId="HexConverter"/>
</ui:textField>
<ui:message binding="#{Page1.message5}" id="message5" showDetail="false" showSummary="true"/>
</ui:tableColumn>

// ------------------------------------------------------------------------------ faces_config.xml
<converter>
<converter-id>HexConverter</converter-id>
<converter-class>HexConverter</converter-class>
</converter>
16 years ago
JSF
Here's my answer for extending a converter in JSF.
An additional tld is not required.
Don't let the fact that your using a sun dataProvider to populate a table with strings from objects create confusion. Just implement the converter in appropriate components in your jsp.
- Lou Caudell

// -------------------------------------------------------- class HexConverter
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.*;


public class HexConverter implements Converter
{
public HexConverter() { }

// ========================================================== getAsObject(...)
public Object getAsObject( FacesContext facesContext, UIComponent uiComponent, String value )
{
Long longValue = new Long(-1);
try
{
longValue = Long.parseLong( value, 16 );
}
catch (Exception exception)
{
throw new ConverterException(exception);
}
return (new Integer(longValue.intValue()));
}

// ========================================================== getAsString(...)
public String getAsString( FacesContext facesContext, UIComponent uiComponent, Object obj )
{
String hexStr = new String();
try
{
int intValue = (int)((Integer)obj).intValue();
hexStr = Integer.toHexString(intValue);
}
catch (Exception exception)
{
throw new ConverterException(exception);
}
return hexStr;
} // method
} // class
16 years ago
JSF
Netbeans is Sun's free IDE, and it's made a quantum leap in usability lately.
However, you should take also consider the container type required by your project. Netbeans has Tomcat, SJSAS(Glassfish), and is JBOSS capable. Tomcat, however is not a EJB container. Additionally, Netbeans may be the reference implementation used for Oracle's Java IDE, so some say. Netbeans has a lot of tutorials on their site. Eclipse is free, and widely used, but you will find more sophisticated versions in use by corporations. There tools integration is fairly raw, compared to Netbeans, but both are good.
- Lou Caudell
16 years ago
JSF
I have written a custom taglib to extend the converters already utilized in JSF. The page is rendered, but with out the desired conversion. Debugging results in the invocation of the class, but the getAsString() or getAsObject methods do not get called. Can someone tell me what I am missing? The objective is to read a long from a database, convert it to hex and display.
No exceptions are thrown, the debugger just hits the class declaration and returns.

- Lou Caudell

################################## CONFIGURATION
OS: XPP SP2
IDE: Netbeans 5.5.1
JDK: 1.5.0_10
WAS: SJSAS 9.1

##################################################### faces-config.xml
<converter>
<converter-id>convert2Color</converter-id>
<converter-class>customconverter1.Convert2Color</converter-class>
</converter>
##################################################### JSP
<ui:tableColumn binding="#{Page1.tableColumn7}" headerText="forecolor" id="tableColumn7" sort="forecolor">

<ui:staticText binding="#{Page1.staticText7}" id="staticText7" text="#{currentRow.value['forecolor']}">

<ui:message binding="#{Page1.message1}" id="message1" showDetail="false" showSummary="true"/>

<f:converter converterId="convert2Color"/>

</ui:staticText>

</ui:tableColumn>

<ui:tableColumn binding="#{Page1.tableColumn8}" headerText="backcolor" id="tableColumn8" sort="backcolor">

<ui:staticText binding="#{Page1.staticText8}" id="staticText8" ext="#{currentRow.value['backcolor']}">

<f:converter converterId="convert2Color"/>

</ui:staticText>

<ui:message binding="#{Page1.message2}" id="message2" showDetail="false" showSummary="true"/>

</ui:tableColumn>

##################################################### class
package customconverter1;

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.apache.commons.lang.StringUtils;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;

// ------------------------------------------------------------- Convert2Color()
public class Convert2Color implements Converter
{
// ============================================================= getAsObject()
public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException
{
if (StringUtils.isEmpty(value)) { return null;}

HTMLColor hColor = new HTMLColor();
hColor.setOriginal(value);
hColor.setHexColor(value);

return hColor;
}

// ============================================================= getAsString()
public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException
{
return value.toString();
}

} // class


// class ------------------------------------------------------------- HTMLColor
// -----------------------------------------------------------------------------
class HTMLColor implements Serializable
{
private String asColor = new String();
private String original = new String();

// ================================================================ toString()
public String toString()
{
return asColor;
}

// ============================================================= setOriginal()
public void setOriginal( String ocolor )
{
original = ocolor;
} // method

// ============================================================= setHexColor()
public void setHexColor( String longStr )
{
String result = new String();
int color = Integer.parseInt(longStr);
result = Integer.toHexString( color );
asColor = padColor( result );
} // method

// ================================================================ padColor()
// pad value with zeros is cases where string length less than 6
private String padColor( String result )
{
String padded = new String();
switch (result.length())
{
case 1:
padded = "00000"+result;
break;
case 2:
padded = "0000"+result;
break;
case 3:
padded = "000"+result;
break;
case 4:
padded = "00"+result;
break;
case 5:
padded = "0"+result;
break;
case 6:
padded = result;
break;
default:
return "not web color";
}
return padded;
} // method

} // class
16 years ago
JSF
That's the console on my machine, which contains a link to the control panel also available via settings in XP. Those parameters pertain to calling an applet in the traditional method, not a plugin, per my documentation. If the case with Vista, is that both are set via the control panel, then Sun is not doing a very good job of stating it clearly.

The applet/app which I am running does not appear the same when running via traditional applet html tags and plugin (object, embed) tags.
17 years ago
Ok, this file resides in
\documents and Settings\(user)\ApplicationData\
Sun\Java\Deployment\deployment.properties
On an XP system. The heap size instruction is added to the property for plugins. "deployment.javapi.jre.1.6.0_01.args=-Xmx256m"
FYI: there is no "\documents and settings" dir on any Vista installation I've seen thus far. Its now "\user". WOOPS: did I get that slash wrong....just joking Linus.
To set the heap size for an applet. Change the value for the jre/jdk in the control panel java->java tab->view button->java runtime parameter. I am not aware of this plugin control panel you speak of. Please tell me where it's at. I have yet to see a deployment.properties file in Vista, so how does one set the heap size....
17 years ago
I have just ran an applet via plugin html from Vista with no apparent issue.
The jdk is 1.6.01. However, when running in XP it is necessary to raise the heap parameter in the deployment.properties to Xmx256m. My question is, how would you do this in Vista. Also, isn't there an api to set the heap parameter in the individual applets code?
17 years ago