Color Picker for Options
I need a color Picker Option and since the nice one that exists in Geneious does not seem to be accessible so I need to implement it from scratch.
I tried to extend from Option but I'm getting an unexpected:
Methods c() from com.biomatters.geneious.publicapi.plugin.Options.Option and c() from com.biomatters.geneious.publicapi.plugin.Options.Option are inherited with the same signature
public static class ColorOption extends Options.Option<Color, JPanel> {
// String a;
private Color color = Color.RED;
protected ColorOption(Element var1) throws XMLSerializationException {
super(var1);
//this.color = var1.getChildText("layoutNextToOption");
}
protected ColorOption(String optionName, String label, Color defaultColor) {
super(optionName, label, defaultColor);
}
public String getDisplayedLabel() {
return null;
}
public Color getValueFromString(String rgbValue) {
try {
return new Color(Integer.valueOf(rgbValue));
} catch (Exception var3) {
var3.printStackTrace();
return (Color) this.getDefaultValue();
}
}
protected JPanel createComponent() {
final JPanel panel = new JPanel();
panel.setOpaque(true);
panel.setBackground(color);
//if (super.a.isVerticallyCompact(this.isAdvanced())) {
panel.setPreferredSize(new Dimension(10, 10));
// }
return panel;
}
protected void setValueOnComponent(JPanel panel, Color color) {
this.color = color;
panel.setBackground(color);
this.color = color;
}
}
-
Hi Adrian,
This appears to be a problem with our build/obfuscation process. We use a tool called proguard that shrinks and obfuscates non-API methods to names like a(), b(), c(), etc.
It's produced a duplicate name in that class. However since they're private methods you should still be able to compile.
I tried it out in IntelliJ and found that although an error was produced in the editor, when I compiled the class, the compiler didn't complain at all. Can you see if your IDE lets you compile. If it doesn't can you tell us what IDE you're using.
Cheers,
MatthewP.S. As a side note, we're considering moving ColorOption to the Public API in a future version of Geneious.
0 -
I'll try to move the code to Idea and see. You can probably annotate with @KeepMethodNames. The docs talk about subclassing Options and anybody doing that will run into the issue.
I found an inelegant stop gap solution by using a wrapped LabelOption that is exposed albeit not fully now.
Certainly the ColorOption will not expose any corporate secrets :)
0
Please sign in to leave a comment.
Comments
2 comments