Custom JComboBox Renderer

Hi!
I want to use a JMenu as a renderer for a JComboBox. When the combo is pressed, the popup that is open should contain 3 JMenu. Then if the mouse id moved over any of the 3 JMenu, 2 check menu items should be opened in an additional popup, near the popup that contains the 3 JMenu.
A picture that illustrate the behaviour could be found here: [http://www.trilulilu.ro/mogadiscio/ee847e6a14b2d5]
I'm able to obtain the 3 JMenus in the combo's popup but the 3 JMenus does not repond to mouse events so the additional submenu is not open.
Any suggestions are welcome.
Orly

package supercombo;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
public class SuperCombo6 extends JComboBox {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(500, 300);
        frame.setTitle("Super Combo 6");
        JToolBar tb = new JToolBar();
        tb.setLayout(new FlowLayout(FlowLayout.LEFT));
        tb.add(new SuperCombo6(new String[][] {
                {"M1", "M1.1", "M1.2"},
                {"M2", "M2.1", "M2.2"},
                {"M3", "M3.1", "M3.2"}
        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(tb, BorderLayout.NORTH);
        frame.setVisible(true);
    public SuperCombo6(String[][] items) {
        super(new SuperComboModel6(items.length));
        setPreferredSize(new Dimension(120, 20));
        setRenderer(new SuperComboRenderer6(items, this));
class SuperComboModel6 extends DefaultComboBoxModel {
    private int _size;
    public SuperComboModel6(int size) {
        this._size = size;
    public int getSize() {
        return _size;
class SuperComboRenderer6 extends DefaultListCellRenderer {
    private JLabel title;
    private ArrayList menus;
    public SuperComboRenderer6(String[][] items, final JComboBox combo) {
        title = new JLabel("SuperCombo6");
        title.setHorizontalAlignment(SwingConstants.LEFT);
        menus = new ArrayList();
        for (int i = 0; i < items.length; i++) {
            final JMenu menu = new JMenu(items[0]);
for (int j = 1; j < items[i].length; j++) {
JCheckBoxMenuItem item = new JCheckBoxMenuItem(items[i][j]);
menu.add(item);
menus.add(menu);
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (index == -1) {
return title;
JMenu menu = (JMenu) menus.get(index);
if (isSelected) {
menu.setSelected(true);
} else {
menu.setSelected(false);
return menu;

Similar Messages

  • Customized JComboBox Editor for JTable

    Hi,
    I am new to swing development and have gotten my self stuck on an issue. Basically I have a JTable that is dynamically populated from the database, in which one of the columns has a customized JComboBox Renderer and Editor. The default values load up fine when the page loads up but when I selected a new value in the combo box and select a new row in the JTable, the combo box defaults back to the original value. How can I make sure that the new selection is maintain.
    Thanks, Anthony
    Here are my Driver, Renderer and Editor:
    excerpts from the Driver
    contract.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    keys = contractSelectedEvent.getKeys();
    String sql = contractSelectedEvent.getSchdSql(keys);
    table = contractSelectedEvent.getStatusTable(sql);
    table.setDefaultRenderer(CashFlow.class, new CashFlowRenderer());
    table.setDefaultEditor(CashFlow.class, new CashFlowEditor());
    public class CashFlowRenderer extends JComboBox implements TableCellRenderer {
    protected QueryComboBoxModel comboModel;
    /** Creates a new instance of CashFlowRenderer */
    public CashFlowRenderer() {
    super();
    comboModel = new QueryComboBoxModel("Select Ref_ID, Ref_Desc From Ref Where
    Ref_Typ_ID = 910 order by Ref_ID ");
    super.setModel(comboModel);
    public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus,
    int row,
    int column) {
    if(value == null) {
    return this;
    if(value instanceof CashFlow) {
    //set the cashflow equal to the value
    CashFlow cashFlow = new CashFlow(((CashFlow) value).getCashFlow());
    setSelectedItem(cashFlow);
    else {
    //default the cashflow
    CashFlow cashFlow = new CashFlow();
    setSelectedItem(cashFlow.getCashFlow());
    return this;
    public boolean isCellEditable() {
    return true;
    public class CashFlowEditor extends JComboBox implements TableCellEditor {
    protected transient Vector listeners;
    protected transient String originalValue;
    protected QueryComboBoxModel comboModel;
    /** Creates new CashFlowEditor */
    public CashFlowEditor() {
    super();
    comboModel = new QueryComboBoxModel("Select Ref_ID, Ref_Desc From Ref Where Ref_Typ_ID = 910 order by Ref_ID ");
    super.setModel(comboModel);
    listeners = new Vector();
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    if(value == null) {
    return this;
    if (value instanceof CashFlow) {
    setSelectedItem(((CashFlow)value).getCashFlow());
    else {
    CashFlow cashFlow = new CashFlow();
    setSelectedItem(cashFlow.getCashFlow());
    table.setRowSelectionInterval(row, row);
    table.setColumnSelectionInterval(column, column);
    originalValue = (String) getSelectedItem();
    return this;
    public void cancelCellEditing() {
    fireEditingCanceled();
    public Object getCellEditorValue() {
    return (String)getSelectedItem();
    public boolean isCellEditable(EventObject eo) {
    return true;
    public boolean shouldSelectCell(EventObject eo) {
    return true;
    public boolean stopCellEditing() {
    CashFlow cashflow = new CashFlow((String)getSelectedItem());
    setSelectedItem(cashflow.getCashFlow());
    fireEditingStopped();
    return true;
    public void addCellEditorListener(CellEditorListener cel) {
    listeners.addElement(cel);
    public void removeCellEditorListener(CellEditorListener cel) {
    listeners.removeElement(cel);
    protected void fireEditingCanceled() {
    setSelectedItem(originalValue);
    ChangeEvent ce = new ChangeEvent(this);
    for(int i = listeners.size(); i >= 0; i--) {
    ((CellEditorListener)listeners.elementAt(i)).editingCanceled(ce);
    protected void fireEditingStopped() {
    ChangeEvent ce = new ChangeEvent(this);
    for(int i = listeners.size() - 1; i >= 0; i--) {
    ((CellEditorListener)listeners.elementAt(i)).editingStopped(ce);

    First off, I wouldn't subclass JComboBox to create a custom renderer/editor. I would have a renderer/editor component that makes use of a JComboBox. But that is just me.
    In order for setSelectedItem to work, the items in your combo box have to compare against each other correctly with equals(). Since you are creating new instances, your objects (even though they contain the same data) are going to be different instances and aren't going to be considered equal. Write your own equals() method in your CashFlow object that tests for equality based on the actual values in the objects and you should be fine.

  • TableSorter + custom cell renderer: how to get DISPLAYED value?

    Hi!
    I have a JTable with a custom cell renderer. This renderer translates numerical codes, which are stored in the table model, into textual names. E.g. the table model stores country codes, the renderer displays the name of the country.
    Now, having a reference on the JTable, how can I get the DISPLAYED value, i.e. the country name? Is there some method like ....getRenderer().getText()?
    Thanx,
    Thilo

    Well, a renderer can be anything. It may be rendering an image not text so you can't assume a method like getText(). However, since you know the component being used to render the cell you should be able to do something like:
    TableCellRenderer renderer = table.getCellRenderer(row, column);
    Component component = table.prepareRenderer(renderer, row, column);
    Now you can cast the component and use get text.
    Another option would be to store a custom class on the table cell. This class would contain both the code and value. The toString() method would return the value. Whenever you want the code you would use the table.getValueAt(...) method and then use the classes getCode() method. Using this approach you would not need a custom renderer. This thread shows how you can use this approach using a JComboBox, but the concept is the same for JTable as well:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=417832

  • Data provider problem in custom item renderer

    I have a complex, custom item renderer for a list. I add
    items that I extracted from an xml to the data provider using the
    IList interface. But when displaying the list, the items are all
    screwed up. Each rendered item has some parts which are initialized
    as different components depending on the values from the xml. This
    initialization is called in the item renderer for the
    creationComplete event.
    The weird thing is that when I output the dataProvider to
    check its values, some of the items have internal uids sometimes
    and sometimes they don't. If I output the dataProvider right after
    I add the items to it, none of them get internal uids. But from the
    initialize method, some of them do and some don't.
    To make things weirder, sometimes, as I scroll up and down
    the list, the dynamic components get all switched up. I'm either
    having a problem with internal uids or with the creation policies
    for lists. Or it's probably some simpler mistake I have yet to see.
    Anyone have any idea where the problem could lie? Any help is
    greatly appreciated.

    Any successful render must:
    1) override the set data property of the component
    Further, best practice is to store any data you need in the
    override set data(), and call invalidateProperties(). Then do the
    actual work in an override commitProperties() function.
    The framework is smart about when to call commitProperties
    efficiently. set data() gets called much more often.
    Tracy

  • Event Handling in JTable Custom Cell Renderer

    I have a JLabel as a custom cell Renderer for a column. I want to handle mouse click event for the JLabel rendered in the cell.
    I tried adding the listener for the label in the custom cell renderer but it is not working. Any ideas how to handle this problem??
    Thanks
    S.Anand

    If you want to handle the selection of a tree node
    1) write a class like:
    public class TreePaneListener implements TreeSelectionListener {
    // TREE SELECTION LISTENER
    public void valueChanged(TreeSelectionEvent e) {
    JTree tree = (JTree)e.getSource();
    DefaultMutableTreeNode node = null;
    int count = 0;
    boolean doSomething = false;
    if(tree.getSelectionCount() > 1) {
         TreePath[] selection = tree.getSelectionPaths();
         int[] temp = new int[selection.length];
         for(int i =0; i < selection.length; i++) {
    // Check each node for selection
         node = (DefaultMutableTreeNode)selection.getLastPathComponent();
         if(node.getLevel()==2) {
    // Change this code to take the action desired
         doSomething = true;
    2) After creating the tree register the listener
    TreePaneListener handler = new TreePaneListener();
    tree.addTreeSelectionListener(handler);

  • Custom Resource Renderer not coming on Implementing Flexible UI Components

    HI,
    I am using the Sneak Preview NW2004s SP9 with TREX .
    I have to modify the search result list as returned by the TREX using the default search, basically have to include a custom Link based on the resource name.
    I am trying to run the examples from the Knowledge Management and Collaboration Developer's Guide - "How to Implement Flexible UI Components".
    I deployed the par file for the sample application "Using Flexible UI Ready-Mades"
    and followed the steps as outlined below:
    System Administration>System Configuration>Knowledge Management -->Content Management
    1) Under
    User Interface->Mapping>Resource Renderer
    Created a new mapping for the java class com.sap.km.ui.renderer.SimpleResourceRenderer
    2) Then under
    User Interface->Settings>Resource Renderer Settings
    Created a duplicate of  SearchResourceRenderer
    and in the copy changed the Resource Renderer to the custom one(as the one mapped in previous step).
    In the Search Result layout Set, i changed the Resource Renderer Name to the custom one.
    Now i restarted the server.(i tried restarting after almost all the steps )
    But my resource renderer is not coming after i execute the TREX Search.The list returned seems to use the default Resource Renderer.
    I even tried by making an advanced copy of the Search Layout Set, changed the Resource Renderer name, updated the OTH file(search.oth), Switched on the degugging for the WdfProxy and reloaded the OTH.
    Now the new layout Set is being used but still i cannot see the result as per the custom resource renderer.
    Morover, if i try to print some message from the resource renderer code(Component render method), it is not printed in the default Trace file.
    Please help me in identifying and resolving the problem.
    Thanks,
    Siddhartha

    Hi Detlev,
    Sorry for the delay.
    We don't want to exlude the folders, we would like keep it, the problem is, instead of appearing the folder name, is displayed the error message and below the actions (details, delete, …).
    At first, we thought that could have been an error in the configuration of LayoutSet, but then, we tried on other two environments, with the default LayoutSet configuration and we still get, on the three environments, the same error message.
    Any idea?
    Thanks and Regards,
    John

  • Need for a Datagrid with variableRowHeight="true" and custom Item Renderer to display exact rows

    Hi again, developers:
    I'm in a search of a datagrid  with certain characteristics:
         - variableRowHeight = "true"
         - only one column
         - each row must have a custom item renderer with possibly different heights, and a fixed width
         - the datagrid must show always every item in the data provider with no vertical scroll bars, what means that the datagrid height must have always the exact height sum of all the item renderers it is displaying.
         - and no extra empty rows must appear in the last positions of the datagrid
    The last two requirements are something difficult to achieve... for some reason, empty rows appear at the last positions of the datagrid. I post what i've managed to get:
    <mx:Script>
         <![CDATA[
         private function resize():void
                    if (dg.dataProvider)
                        var h:Number = dg.measureHeightOfItems( -1, dg.dataProvider.length);
                        dg.height = h;
         ]]>
    </mx:Script>
    <mx:DataGrid id="dg" width="530" horizontalCenter="0" verticalScrollPolicy="off"
            dataProvider="{dp}"
            wordWrap="true" variableRowHeight="true" showHeaders="false" dataChange="resize()" height="{dg.measureHeightOfItems(-1,dg.dataProvider.length)}" click="Alert.show(dg.rowCount.toString());">
            <mx:columns>
                <mx:DataGridColumn headerText="ID" width="50">
                    <mx:itemRenderer>
                        <mx:Component>
                            <mx:TextArea height="{Math.random()*100}" wordWrap="true" backgroundColor="{Math.random() * 16777216}" paddingTop="0" paddingBottom="0"/>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>

    Thanks Harui, but it doesn't help. If the border is set it will help, but the very big problem is the empty rows that appear at the end of the datagrid... I can't find a way of measuring correctly the height of the itemRenderers!
    I'll update this thread if I manage to do it.

  • Range component in custom item renderer

    Hi,
    I am trying to put a spark Range component into the labelItemRenderer for flex mobile. Everytime I add it I get the error: "Skin for (long directory name for my range component) cannot be found". The custom item renderer is an actionscipt class because I read this is the best way to make them for mobile. I'll put the error in the bottom of the post.
    If anyone has any idea why this could be happening or if anyone knows a possible way around this it would be extremely helpful. I basicaly just need a list where each item has a label on side and then a progress bar on the other side.
    Thanks.
    Here is the full error, ill put a star on the line where the addChild method gets called in my item renderer for the range component.
    Error: Skin for HoosFit0.TabbedViewNavigatorApplicationSkin5.tabbedNavigator.TabbedViewNavigatorSkin7.con tentGroup.ViewNavigator1.ViewNavigatorSkin12.contentGroup.
    FCfacilities139.SkinnableContainerSkin141.contentGroup.Group143.facilityList.ListSkin145.S croller147.ScrollerSkin148.DataGroup146.FCfacilitiesInnerClass0_157.Range154 cannot be found.
              at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\4.y\frameworks\pr ojects\spark\src\spark\components\supportClasses\SkinnableComponent.as:698]
              at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\4.y\frame works\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]
              at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\4.y\framework s\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]
              at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UI Component.as:7634]
              at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]
              at mx.core::UIComponent/addChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UICo mponent.as:7176]
    *** at views::itemRenderer2/set data()[/Users/evan/Documents/Adobe Flash Builder 4.6/HoosFit/src/views/itemRenderer2.as:73]
              at spark.components::SkinnableDataContainer/updateRenderer()[E:\dev\4.y\frameworks\projects\ spark\src\spark\components\SkinnableDataContainer.as:606]
              at spark.components.supportClasses::ListBase/updateRenderer()[E:\dev\4.y\frameworks\projects \spark\src\spark\components\supportClasses\ListBase.as:1106]
              at spark.components::DataGroup/setUpItemRenderer()[E:\dev\4.y\frameworks\projects\spark\src\ spark\components\DataGroup.as:1157]
              at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.y\frameworks\projects\spark\ src\spark\components\DataGroup.as:327]
              at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.y\frameworks\projects\s park\src\spark\components\DataGroup.as:384]
              at spark.components::DataGroup/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\comp onents\DataGroup.as:1467]
              at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
              at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\ UIComponent.as:8430]
              at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx \managers\LayoutManager.as:665]
              at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:816]
              at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1180]

    Hi,
    I am trying to put a spark Range component into the labelItemRenderer for flex mobile. Everytime I add it I get the error: "Skin for (long directory name for my range component) cannot be found". The custom item renderer is an actionscipt class because I read this is the best way to make them for mobile. I'll put the error in the bottom of the post.
    If anyone has any idea why this could be happening or if anyone knows a possible way around this it would be extremely helpful. I basicaly just need a list where each item has a label on side and then a progress bar on the other side.
    Thanks.
    Here is the full error, ill put a star on the line where the addChild method gets called in my item renderer for the range component.
    Error: Skin for HoosFit0.TabbedViewNavigatorApplicationSkin5.tabbedNavigator.TabbedViewNavigatorSkin7.con tentGroup.ViewNavigator1.ViewNavigatorSkin12.contentGroup.
    FCfacilities139.SkinnableContainerSkin141.contentGroup.Group143.facilityList.ListSkin145.S croller147.ScrollerSkin148.DataGroup146.FCfacilitiesInnerClass0_157.Range154 cannot be found.
              at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\4.y\frameworks\pr ojects\spark\src\spark\components\supportClasses\SkinnableComponent.as:698]
              at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\4.y\frame works\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]
              at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\4.y\framework s\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]
              at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UI Component.as:7634]
              at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]
              at mx.core::UIComponent/addChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UICo mponent.as:7176]
    *** at views::itemRenderer2/set data()[/Users/evan/Documents/Adobe Flash Builder 4.6/HoosFit/src/views/itemRenderer2.as:73]
              at spark.components::SkinnableDataContainer/updateRenderer()[E:\dev\4.y\frameworks\projects\ spark\src\spark\components\SkinnableDataContainer.as:606]
              at spark.components.supportClasses::ListBase/updateRenderer()[E:\dev\4.y\frameworks\projects \spark\src\spark\components\supportClasses\ListBase.as:1106]
              at spark.components::DataGroup/setUpItemRenderer()[E:\dev\4.y\frameworks\projects\spark\src\ spark\components\DataGroup.as:1157]
              at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.y\frameworks\projects\spark\ src\spark\components\DataGroup.as:327]
              at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.y\frameworks\projects\s park\src\spark\components\DataGroup.as:384]
              at spark.components::DataGroup/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\comp onents\DataGroup.as:1467]
              at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
              at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\ UIComponent.as:8430]
              at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx \managers\LayoutManager.as:665]
              at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:816]
              at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1180]

  • How to implement custom field renderer?

    I'm trying to create a custom field renderer that will render certain database fields as checkboxes in HTML. I'm using the Data Web Beans/JSP approach. In my view object I have added a "Boolean" property to the attributes that represent boolean type fields (e.g., field Warranty to indicate if an asset is under warranty). I have created a CheckBoxField() class similar to the TextField() class, and call it if the attribute is a boolean, but I can't figure out how to set the custom field renderer. When the program runs, it still uses the TextField renderer. The JDeveloper online documentation doesn't say anything about it. Is there a sample program or some other documentation that implements a custom field renderer?

    Hi,
    this document in addition
    http://www.oracle.com/technology/products/jdev/howtos/10g/jaassec/index.htm
    has a list of LoginModules, one that authenticates against physical database users
    Frank

  • Row Selection problem in custom cell renderer

    Hi,
    I have created a custom cell renderer to set color in my table based on some value and the screen also shows colors when i set this cell renderer.
    But, I am not able to see the row selection ie. with blue background when I select any row in the table is nor appearing. Can you tell me how to solve this problem.
    Regards,
    R.Vishnu Varadhan.

    Check out this [url http://forum.java.sun.com/thread.jsp?forum=57&thread=507001]thread for a similiar example.

  • Custom Group Renderer

    Hi all,
    My situation is that I need to be able to, when uploading a document to KM and according to the value that takes a custom property, show only a specific group of properties on the screen.
    I'm trying to solve this by developing a custom group renderer. Within the renderer I can get the value of a property, then according to this value I would want to load the specific structured group using its name and render it inside my current structured group renderer.
    The problem is that I've haven't been able to create/load the structured group, how is this done?
    Also I could try to do it with a custom property renderer that modifies the contents of its containing structured group. Is this possible?/how could I do this?
    From what I've seen the KM creates all the Structured Groups when CM loads and pass only the minimal parameters to the group/property renderers limiting what can be done from a dynamic loading of properties point of view. What should I do to be able to extend the logic, not only the way that static properties are painted/rendered?
    I'd like to know what you think.
    Thanks in advanced,
    Andrés
    This topic is derived from this one because nodoby could help me there. Custom Group Renderer

    Hi Patricio,
    Thanks for your answer. Could you please help me with some doubts that I have?
    1. In the ResourceType creation it asks for a Resource Type ID, I don't know what to put in there, at help.sap.com it shows it in a URLish form. What should I put here?
    2. Also, in Custom Properties is it a comma separated values of the Ids of the properties?
    3. How do I pass the ResourceType to the new command that I will create? What is the format of the "parameters" parameter.
    If you could provide some references/procedures that I can look into I'd appreciate it.
    Thanks in advanced,
    André

  • Writing a Custom Property Renderer

    Hello all,
    I am new to KMC development.  I want to know how to go about writing a custom property renderer.  Detail step by step instructions as to where to start and what are the configurations, etc. would be a great help for me.
    Thanks in advance.
    Vicky R.

    Hello Vicky,
    Step by Step guide to creating Property renderer is:
    1. Program an implementation of AbstractPropertyRenderer.
    2. Implement a RFServerWrapper service to register your property renderer with CrtClassLoaderRegistry.
    CrtClassLoaderRegistry.addClassLoader(this.getClass().getClassLoader());
    3. Technical mapping to your coding in the Property Metadata service.
    4.Restart your server for the changes to take effect.
    Check this link for more infos:
    https://forums.sdn.sap.com/thread.jspa?threadID=41619
    Also check the implementations of RFServerWrapper service in examples at this link:
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c739e546-0701-0010-53a9-a370e39a5a20
    Greetings,
    Praveen Gudapati

  • How to get jsp PageContext in custom component renderer

    Hi,
    How to find PageContext(javax.servlet.jsp.PageContext) form within the custom component renderer class?
    Please help?
    Thanx & Regards
    Milind

    Strictly you're looking which URL has invoked the new request? With other words, you want the referrer?
    If so, doString referrer = request.getHeader("referer"); // Yes, with the legendaric misspelling.Be careful with this, the client has full control over what he/she sends with the headers, so also the referrer. It might be null or changed while you didn't expect that. If you want to be safe, you may consider to send the current URL as a hidden parameter along with the request.

  • Using JScrollpane via Custom Cell Renderer.Please Help

    Chaps,
    I have a question regarding scrolling of a JList.
    I have written a class (FTRDList) that has an Custom Cell Renderer.
    I want the list to be scrollable.
    This class is being called by many other classes.
    Now,as the FTRDList class is being called by many classes,i need
    to have all these classes to have the flwg statement
    add(new JScrollPane(FTRDList)),BorderLayout.CENTER);
    This can be a lot of work to chaneg all classes
    Rather,is it possible to have the JScrollPane built in the
    FTRDList class once and for all and let all classes call
    it by
    add(FTRDList,BorderLayout.CENTER);
    Please can anyone tell me how to make the FTRDList class Scrollable?
    Or is this not possible at all?
    Attached is the class:
    public class FTRDList extends JList {
        /* Inner class for Custom Cell Renderer */
        class MyCellRenderer extends JLabel implements ListCellRenderer {
        public Component getListCellRendererComponent(JList list,
                                                      Object value,            // value to display
                                                      int index,               // cell index
                                                      boolean isSelected,      // is the cell selected
                                                      boolean cellHasFocus) {  // the list and the cell have the focus
                setText(value.toString());
                if (isSelected) {
                setBackground(isSelected ? Color.red : Color.yellow);
             setForeground(isSelected ? Color.white : Color.black);
                setEnabled(list.isEnabled());
                setOpaque(isSelected);
                return this;
        public FTRDList() {
            super();
            setSelectedIndex(0);
            /** Invoke the cell Renderer */
            setCellRenderer(new MyCellRenderer());
            setOpaque(false);    

    I HAVE ALSO POSTED THIS IN THE JAVA PROGRAMMING FORUM PLEASE DONT GET OFFENDED AS I AM EXPECTING AN URGENT RESPONSEWell, someone has probably already answered this question in the Java forum, so I won't waste my time and answer it again here.

  • Performance decrease with custom cell renderer

    Hi,
    Finally, I have my cell renderer working fine (it was simpler than I thought). Anyway, I'm suspecting something is not working quite well yet. When I try to reorder my colums (by dragging them) they move like slow motion. If I don't register my custom cell renderer, I can move my columns fine. Next is the code of my custom renderer.
    class PriorityRenderer extends DefaultTableCellRenderer {   
      public Component getTableCellRendererComponent(
      JTable table, Object value,     boolean isSelected,
      boolean hasFocus, int row, int column) {              
        if(value instanceof coloredValue) {
        coloredValue cv = (coloredValue)value;
        if(isSelected) this.setBackground(table.getSelectionBackground());
        else this.setBackground(cv.getbkColor());
        this.setForeground(cv.gettxColor());
        this.setText(value.toString());
        this.setOpaque(true);
        return this;
    }All the cells of my JTable are "coloredValue"s. This is a little class with a String, two colors and some getter methods.
    Can anyone giveme a hint ?
    Thanks!!

    OK! Now the performance problem is gone!! (I don't know why, I didn't touch a thing)
    Thanks anyway

Maybe you are looking for

  • Using Infoset query

    Dear Experts and friends, I have created a infoset using the logical database sdf, and have created a query adding two more tables( mara and marm) giving conditions. The problem is when i try to add some fields under basic list for list output the me

  • Error when trying to import from Aperture Library

    I'm trying to import my Aperture Library into Lightroom using the "Import from Aperture Library" plug-in. Every time I get a "?:0: attempt to index a nil value" error as soon as I click the Import button. I've tried removing Lightroom (and its ancill

  • Sort alphabetically not by ascii value

    In LR5 I wish to sort by file name. However my camera names files as ABC123, ABC124, ABC125 etc etc. Lightroom sorts such names as ABC3, ABC2, ABC5 etc because the numeral part of the name is looked as as an ascii not a numeral. I think!! However wha

  • Help required on Organisation Structure

    Dear All, I wanted to prepare a Organisation Structure for one of our Client. The Business process is like this , there is one Head office , 25 Branches & 50 Service centres . The Head Office & Branches have similar function, i.e of booking the order

  • Save Parent window

    Hi,           I had question regarding parent and child window. If i create many child windows in a single parent window, is it possible to save the parent windows and load the same again? I don't need the values of particular control or a indicator