Custom implementation of GUI Designer table

Answered

Hi, 

I'm trying to make a custom implementation of the table found in the GUI Designer form. Could someone familiar with this please explain how values are added to the table? This is all I need to understand.

Thank you.

8 comments
Comment actions Permalink

You can modify the default list of UI elements programmatically via com.intellij.uiDesigner.palette.Palette#addItem

If you want to change the groups completely depending on given file, see com.intellij.ide.palette.PaletteItemProvider

0
Comment actions Permalink

Thanks for the response. I tried importing that class into a new project, however intellij isn't recognizing it. I have project sdk set to Intellij IDEA IU. Any ideas why this might be the case?

0
Comment actions Permalink

You need to add UI designer plugin (com.intellij.uiDesigner) to your classpath and dependency in plugin.xml

http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html

0
Comment actions Permalink

Thank you. I have the palette but I don't think it suits my needs. I just need the properties table from the GUI form. From what I can tell, the palette isn't to be used as a GUI component. 

I have the properties table by creating custom PropertyTable and RadPropertyTable classes (com.intellij.designer). I then add elements to the table via a custom PropertiesContainer class, which creates two properties in the getProperties() method and adds them to the table. This works, however I can't seem to add values, only property names.

If the palette can achieve a similar result by plugging it into a tool window/JPanel, please let me know. If you can see a way to make this work or an easier way, please also let me know. Thank you for the help.

0
Comment actions Permalink

Could you please show implementation of your custom Property?

0
Comment actions Permalink
private class CustomPropContainer extends RadComponent {

@Override
public List getProperties() {
List<Property> properties = new ArrayList<>();

Property one = new Property(null, "this is me") {
@NotNull
@Override
public PropertyRenderer getRenderer() {
return new AbstractResourceRenderer() {
@Override
protected void formatValue(RadComponent container, Object value) {
container.setClientProperty("this is me", "i am the value");
}
};
}

@Nullable
@Override
public PropertyEditor getEditor() {
return null;
}
};

properties.add(one);
        return properties;

This adds a row with the property this is me, but no value. I've tried using setValueAtRow but ran into various errors.
0
Comment actions Permalink

Please try to return proper editor in com.intellij.designer.model.Property#getEditor

0
Comment actions Permalink

Thank you so much for your patience. It now works by making my own editor and setting the get component to return a JLabel.

0

Please sign in to leave a comment.