How to close the editor window?

The method in the controller that I use to save the entity; part of my screen descriptor:

public class CardItemEdit extends AbstractEditor<CardItem> {
	public void save() {
		CardItem cardItem = new CardItem();
		cardItem.setCardType(cardType.getValue());
		cardItem.setCardSubType(cardSubType.getValue());
		cardItem.setCardOutcomeNumber(cardOutcomeNumber.getValue());
		cardItem.setCardOrganization(cardOrganization.getValue());
		cardItem.setCardDeliveryMethod(cardDeliveryMethod.getValue());
		cardItem.setCardDate(cardDate.getValue());
		cardItem.setCardCreationDate(cardCreationDate.getValue());
		cardItem.setCardAdditionalInformation(cardAdditionalInformation.getValue());
		cardItem.setRegistratorName(registratorName.getValue());
		
		cardItemService.saveCardItem(cardItem);
	}
	// SKIPPED
	
    <actions>
        <action id="save" caption="mainMsg://actions.Ok" invoke="save" />
        <action id="cancel" caption="mainMsg://actions.Cancel" invoke="cancel" />
    </actions>
	
    <hbox id="actionsPane" spacing="true" visible="true">
	   <button id="saveBtn" action="save"/>
	   <button id="cancelBtn" action="cancel"/>
    </hbox>

When I press “saveBtn” the entity is saved to the database and I want to close the editor. In addition, I have the “cancelBtn” button and I want to close the editor by clicking on it.

Service CardItemServiceBean:

public class CardItemServiceBean implements CardItemService {

    @Inject
    private Persistence persistence;
	
	@Override
	public UUID saveCardItem(CardItem cardItem) {
        try(Transaction tx = persistence.createTransaction()) {
            persistence.getEntityManager().persist(cardItem);
            tx.commit();
        }
        return cardItem.getId();
	}
  // SKIPPED

How to achieve this?

I would be very grateful for the information. Thanks to all.

Use close() method. And you probably want to call it passing COMMIT_ACTION_ID

1 Like

Thank you for your comment. Will try it tomorrow.

I understand that I must study the documentation in details.

I’m sorry, but i don’t think that we are able or willing to substitude their time you need to spend on getting familiar with a technology because you have no time for it for whatever reasons…

This selfish behavior and statement will most likely disqualify you from further answers (as least mine) if it is not clear that you did invest some time to try to solve the problem on your own.

You cannot assume that someone will give you his / her time if you are not willing to give us time for your own questions.

If you still dont have the possibilty to invest in your own learnings, you are free to go the other way: pay people. Haulmont has great commercial support…

3 Likes

Good thoughts, I agree with you.