Merge pull request #164 from bsinno/fix_reflect_tag_color_change_immediatly_after_popup_is_closed

Reflect tag colour change immediatly after popup is closed.
This commit is contained in:
Michael Hirsch
2016-05-11 14:09:51 +02:00
3 changed files with 12 additions and 10 deletions

View File

@@ -22,6 +22,7 @@ import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent; import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent; import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent; import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
/** /**
* The default hawkbit event provider. * The default hawkbit event provider.
@@ -39,6 +40,7 @@ public class HawkbitEventProvider implements UIEventProvider {
SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class); SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class);
SINGLE_EVENTS.add(RolloutGroupChangeEvent.class); SINGLE_EVENTS.add(RolloutGroupChangeEvent.class);
SINGLE_EVENTS.add(RolloutChangeEvent.class); SINGLE_EVENTS.add(RolloutChangeEvent.class);
SINGLE_EVENTS.add(TargetTagUpdateEvent.class);
BULK_EVENTS.add(TargetCreatedEvent.class); BULK_EVENTS.add(TargetCreatedEvent.class);
BULK_EVENTS.add(TargetInfoUpdateEvent.class); BULK_EVENTS.add(TargetInfoUpdateEvent.class);

View File

@@ -554,7 +554,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
.findSoftwareModuleTypeByName(typeName.getValue()); .findSoftwareModuleTypeByName(typeName.getValue());
if (createOptiongroup.getValue().equals(createTypeStr)) { if (createOptiongroup.getValue().equals(createTypeStr)) {
if (!checkIsKeyDuplicate(typeKey.getValue()) && !checkIsDuplicate(existingType)) { if (!checkIsKeyDuplicate(typeKey.getValue()) && !checkIsDuplicate(existingType)) {
crateNewSWModuleType(); createNewSWModuleType();
} }
} else { } else {
@@ -611,9 +611,9 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
/** /**
* Create new tag. * Create new tag.
*/ */
private void crateNewSWModuleType() { private void createNewSWModuleType() {
int assignNumber = 0; int assignNumber = 0;
final String colorPicked = getColorPickedSting(); final String colorPicked = getColorPickedString();
final String typeNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeName.getValue()); final String typeNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeName.getValue());
final String typeKeyValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeKey.getValue()); final String typeKeyValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeKey.getValue());
final String typeDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeDesc.getValue()); final String typeDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(typeDesc.getValue());
@@ -650,7 +650,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
* *
* @return String of color picked value. * @return String of color picked value.
*/ */
private String getColorPickedSting() { private String getColorPickedString() {
return "rgb(" + getSelPreview().getColor().getRed() + "," + getSelPreview().getColor().getGreen() + "," return "rgb(" + getSelPreview().getColor().getRed() + "," + getSelPreview().getColor().getGreen() + ","
+ getSelPreview().getColor().getBlue() + ")"; + getSelPreview().getColor().getBlue() + ")";
} }
@@ -676,7 +676,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
existingType.setDescription(null != typeDescValue ? typeDescValue : null); existingType.setDescription(null != typeDescValue ? typeDescValue : null);
existingType.setColour(getColorPickedSting()); existingType.setColour(getColorPickedString());
swTypeManagementService.updateSoftwareModuleType(existingType); swTypeManagementService.updateSoftwareModuleType(existingType);
uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { existingType.getName() })); uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { existingType.getName() }));
closeWindow(); closeWindow();

View File

@@ -150,7 +150,7 @@ public class CreateUpdateTargetTagLayout extends CreateUpdateTagLayout {
final TargetTag existingTag = tagManagement.findTargetTag(tagName.getValue()); final TargetTag existingTag = tagManagement.findTargetTag(tagName.getValue());
if (optiongroup.getValue().equals(createTagNw)) { if (optiongroup.getValue().equals(createTagNw)) {
if (!checkIsDuplicate(existingTag)) { if (!checkIsDuplicate(existingTag)) {
crateNewTag(); createNewTag();
} }
} else { } else {
@@ -188,8 +188,8 @@ public class CreateUpdateTargetTagLayout extends CreateUpdateTagLayout {
/** /**
* Create new tag. * Create new tag.
*/ */
private void crateNewTag() { private void createNewTag() {
final String colorPicked = getColorPickedSting(); final String colorPicked = getColorPickedString();
final String tagNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagName.getValue()); final String tagNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagName.getValue());
final String tagDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue()); final String tagDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue());
if (null != tagNameValue) { if (null != tagNameValue) {
@@ -220,7 +220,7 @@ public class CreateUpdateTargetTagLayout extends CreateUpdateTagLayout {
if (null != nameUpdateValue) { if (null != nameUpdateValue) {
targetObj.setName(nameUpdateValue); targetObj.setName(nameUpdateValue);
targetObj.setDescription(null != descUpdateValue ? descUpdateValue : null); targetObj.setDescription(null != descUpdateValue ? descUpdateValue : null);
targetObj.setColour(getColorPickedSting()); targetObj.setColour(getColorPickedString());
tagManagement.updateTargetTag(targetObj); tagManagement.updateTargetTag(targetObj);
uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { targetObj.getName() })); uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { targetObj.getName() }));
closeWindow(); closeWindow();
@@ -250,7 +250,7 @@ public class CreateUpdateTargetTagLayout extends CreateUpdateTagLayout {
* *
* @return String of color picked value. * @return String of color picked value.
*/ */
private String getColorPickedSting() { private String getColorPickedString() {
return "rgb(" + getSelPreview().getColor().getRed() + "," + getSelPreview().getColor().getGreen() + "," return "rgb(" + getSelPreview().getColor().getRed() + "," + getSelPreview().getColor().getGreen() + ","
+ getSelPreview().getColor().getBlue() + ")"; + getSelPreview().getColor().getBlue() + ")";
} }