public void setSelectedColorPaletteDefinition(ColorPaletteDef cpd) { removeUserDefinedPalette(); final ComboBoxModel<ColorPaletteWrapper> model = getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).cpd.equals(cpd)) { setSelectedIndex(i); return; } } setUserDefinedPalette(cpd); }
@Test public void testCreateClone_andEquals() { //preparation final Point[] points = { new Point(1, Color.black), new Point(2, Color.red), new Point(3, Color.green), new Point(4, Color.blue), new Point(5, Color.white), }; final ColorPaletteDef cpd = new ColorPaletteDef(points, 256); cpd.setDiscrete(true); cpd.setAutoDistribute(true); //execution final ColorPaletteDef clone = (ColorPaletteDef) cpd.clone(); //verification assertTrue(cpd.equals(clone)); }