private IView<JComponent> createColorPropertyView( IColorPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, @SuppressWarnings("unused") Locale locale) { JColorPicker viewComponent = createJColorPicker(); if (propertyDescriptor.getDefaultValue() != null) { int[] rgba = ColorHelper.fromHexString((String) propertyDescriptor .getDefaultValue()); viewComponent .setResetValue(new Color(rgba[0], rgba[1], rgba[2], rgba[3])); } JColorPickerConnector connector = new JColorPickerConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); return constructView(viewComponent, null, connector); }
/** * {@inheritDoc} */ @Override protected IView<JComponent> createColorPropertyView(IPropertyViewDescriptor propertyViewDescriptor, IActionHandler actionHandler, Locale locale) { IColorPropertyDescriptor propertyDescriptor = (IColorPropertyDescriptor) propertyViewDescriptor .getModelDescriptor(); JColorPicker viewComponent = createJColorPicker(propertyViewDescriptor); if (propertyDescriptor.getDefaultValue() != null) { int[] rgba = ColorHelper.fromHexString((String) propertyDescriptor.getDefaultValue()); viewComponent.setResetValue(new Color(rgba[0], rgba[1], rgba[2], rgba[3])); } else { if (propertyDescriptor.isMandatory()) { viewComponent.setResetEnabled(false); } } JColorPickerConnector connector = new JColorPickerConnector(propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); return constructView(viewComponent, propertyViewDescriptor, connector); }