Set value if rollout is edited

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-06-28 17:49:16 +02:00
parent 7e32cbd21c
commit 9ce6e43b87
4 changed files with 12 additions and 10 deletions

View File

@@ -348,6 +348,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
private void populateValuesOfDistribution(final Long editDistId) { private void populateValuesOfDistribution(final Long editDistId) {
this.editDistId = editDistId; this.editDistId = editDistId;
if (editDistId == null) { if (editDistId == null) {
return; return;
} }
@@ -368,13 +369,12 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
if (distSet.getDescription() != null) { if (distSet.getDescription() != null) {
descTextArea.setValue(distSet.getDescription()); descTextArea.setValue(distSet.getDescription());
} }
populateDistSetTypeNameCombo();
} }
public CommonDialogWindow getWindow(final Long editDistId) { public CommonDialogWindow getWindow(final Long editDistId) {
eventBus.publish(this, DragEvent.HIDE_DROP_HINT); eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
resetComponents(); resetComponents();
populateDistSetTypeNameCombo();
populateValuesOfDistribution(editDistId); populateValuesOfDistribution(editDistId);
window = SPUIWindowDecorator.getWindow(i18n.get("caption.add.new.dist"), null, window = SPUIWindowDecorator.getWindow(i18n.get("caption.add.new.dist"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), event -> discardDistribution(), SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), event -> discardDistribution(),
@@ -386,7 +386,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
/** /**
* Populate DistributionSet Type name combo. * Populate DistributionSet Type name combo.
*/ */
public void populateDistSetTypeNameCombo() { private void populateDistSetTypeNameCombo() {
distsetTypeNameComboBox.setContainerDataSource(getDistSetTypeLazyQueryContainer()); distsetTypeNameComboBox.setContainerDataSource(getDistSetTypeLazyQueryContainer());
distsetTypeNameComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); distsetTypeNameComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
distsetTypeNameComboBox.setValue(getDefaultDistributionSetType().getName()); distsetTypeNameComboBox.setValue(getDefaultDistributionSetType().getName());

View File

@@ -155,8 +155,9 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
buildLayout(); buildLayout();
} }
public CommonDialogWindow getWindow() { public CommonDialogWindow getWindow(final Long rolloutId) {
resetComponents(); resetComponents();
populateData(rolloutId);
window = SPUIWindowDecorator.getWindow(i18n.get("caption.configure.rollout"), null, window = SPUIWindowDecorator.getWindow(i18n.get("caption.configure.rollout"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onRolloutSave(), event -> onDiscard(), SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onRolloutSave(), event -> onDiscard(),
uiProperties.getLinks().getDocumentation().getRolloutView(), this, i18n); uiProperties.getLinks().getDocumentation().getRolloutView(), this, i18n);
@@ -728,8 +729,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
* @param rolloutId * @param rolloutId
* rollout id * rollout id
*/ */
public void populateData(final Long rolloutId) { private void populateData(final Long rolloutId) {
resetComponents(); if (rolloutId == null) {
return;
}
editRolloutEnabled = Boolean.TRUE; editRolloutEnabled = Boolean.TRUE;
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId); rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
rolloutName.setValue(rolloutForEdit.getName()); rolloutName.setValue(rolloutForEdit.getName());

View File

@@ -431,8 +431,7 @@ public class RolloutListGrid extends AbstractGrid {
} }
private void onUpdate(final ContextMenuData contextMenuData) { private void onUpdate(final ContextMenuData contextMenuData) {
addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId()); final CommonDialogWindow addTargetWindow = addUpdateRolloutWindow.getWindow(contextMenuData.getRolloutId());
final CommonDialogWindow addTargetWindow = addUpdateRolloutWindow.getWindow();
addTargetWindow.setCaption(i18n.get("caption.update.rollout")); addTargetWindow.setCaption(i18n.get("caption.update.rollout"));
UI.getCurrent().addWindow(addTargetWindow); UI.getCurrent().addWindow(addTargetWindow);
addTargetWindow.setVisible(Boolean.TRUE); addTargetWindow.setVisible(Boolean.TRUE);

View File

@@ -91,8 +91,7 @@ public class RolloutListHeader extends AbstractGridHeader {
@Override @Override
protected void addNewItem(final ClickEvent event) { protected void addNewItem(final ClickEvent event) {
addUpdateRolloutWindow.resetComponents(); final Window addTargetWindow = addUpdateRolloutWindow.getWindow(null);
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
UI.getCurrent().addWindow(addTargetWindow); UI.getCurrent().addWindow(addTargetWindow);
addTargetWindow.setVisible(Boolean.TRUE); addTargetWindow.setVisible(Boolean.TRUE);