Eugen Bl
Eugen Bl

Reputation: 11

RapidClipse X - PopupView

As there's still no manual for migration from RC-4 to RC-X its not easy to create new projects or migrate the old ones. Does anyone know how to show a PopupView to edit something and to close it again in the popup class after finished activities or on cancel?

different other conceptional changes like grid, item.writebean.... I already solved. But for Popup cant find similar solution.

thanks in advance for every hint.

Upvotes: 1

Views: 148

Answers (3)

Schwabenheinz
Schwabenheinz

Reputation: 143

Below you will find a second example, which I use to open a dialog with a listbox in it. After selecting a value out of listbox I transfer and use it in the underlying form:

    private void btEditL1_onClick(final ClickEvent<Button> event)
{
    //modal Dialog Mainclassification
    final HorizontalLayout horlayout=new HorizontalLayout();
    final VerticalLayout vertlayout=new VerticalLayout();
    final Notification MyL1Selection=new Notification();//
    final Button btnAbbruch=new Button();
    final ComboBox<TfinGroup> cBL1Liste = new ComboBox<>();

    btnAbbruch.setText("Abbruch");
    vertlayout.add(new Label("Bitte wählen Sie eine Klasse?"));
    horlayout.add(cBL1Liste);
    horlayout.add(btnAbbruch);
    vertlayout.add(horlayout);

    cBL1Liste.setDataProvider(DataProvider.ofCollection(TfinGroupDAO.INSTANCE.findMainGroups()));
    cBL1Liste.setItemLabelGenerator(ItemLabelGeneratorFactory
        .NonNull(v -> CaptionUtils.resolveCaption(v, "{%id}, {%groupName}")));




    cBL1Liste.addValueChangeListener(evtChangeSelektion ->
    {
        this.logger.info("Es wurde ein Wert aus der Liste selektiert: "+ evtChangeSelektion.getValue().getId());
        // muss zu cB2 übergeben werden und in Textfeld         nrL1Id
        this.nrL1Id.setValue((double)evtChangeSelektion.getValue().getId());
        MyL1Selection.close();

    });

    btnAbbruch.addClickListener(evtclose->
    {
        this.logger.info("Abbrechen geklickt");
        MyL1Selection.close();
    });


    vertlayout.add(horlayout);
    horlayout.add(btnAbbruch);

    MyL1Selection.add(vertlayout);
    MyL1Selection.setPosition(Position.MIDDLE);
    MyL1Selection.addThemeVariants(NotificationVariant.LUMO_PRIMARY);
    MyL1Selection.open();
    this.btnEditL2.setVisible(true);

}

Upvotes: 0

Schwabenheinz
Schwabenheinz

Reputation: 143

I have a delete confirmation dialog in a rapidclipse X application. Perhaps you can use following example to fullfill your request. Sorry german dialogs and without deeper explanation:

    private void btnDelete_onClick(final ClickEvent<Button> event)
{
    final HorizontalLayout horlayout=new HorizontalLayout();
    final VerticalLayout vertlayout=new VerticalLayout();
    final Notification myDelRequest=new Notification();//
    final Button btnAbbr=new Button();

    this.logger.info("Der Datensatz mit der ID soll gelöscht werden: " + this.nrDmvId.getValue().toString());

    if(this.nrDmvId.getValue() != null && this.nrDmvId.getValue() > 0)
    {

        btnAbbr.addClickListener(evtclose->
        {
            this.logger.info("Der Datensatz mit der ID wurde nicht gelöscht: " + this.nrDmvId.getValue().toString());
            myDelRequest.close();
        });

        btnAbbr.setText("Abbrechen");
        final Button btnDelConf=new Button();
        btnDelConf.addClickListener(evtDelete -> {

            try {

                if(this.binder.validate().isOk())
                {
                    final boolean confirm = new OkmDbMetadataValueDAO().removeById(this.nrDmvId.getValue().longValue());
                    this.logger.info("Der Datensatz mit der ID ist gelöscht: " + this.nrDmvId.getValue().toString()+ ", Rückgabe= "+ Boolean.toString(confirm));

                    this.btnDelete.setVisible(false);
                    this.btnSave.setVisible(false);
                    this.fiRegalplatz.setVisible(false);
                    this.fiposition.setVisible(false);
                    this.fiKurzBez.setVisible(false);
                    this.fiBeschreibung.setVisible(false);
                    this.frmRegale.setVisible(false);

                }
            }
            catch(final Exception e)
            {
                e.printStackTrace();
            }


            myDelRequest.close();

        });


        btnDelConf.setText("Daten löschen");
        vertlayout.add(new Label("Wollen Sie den Datensatz wirklich löschen?"));
        vertlayout.add(horlayout);
        horlayout.add(btnAbbr);
        horlayout.add(btnDelConf);

        myDelRequest.add(vertlayout);
        myDelRequest.setPosition(Position.MIDDLE);
        myDelRequest.addThemeVariants(NotificationVariant.LUMO_PRIMARY);
        myDelRequest.open();
    }

}

Upvotes: 0

Manuel St&#246;r
Manuel St&#246;r

Reputation: 141

What I would do is create a new GUI-Element that inherits from Dialog. This view can then be designed with the GUI-Builder. To then show the dialog all you have to do is to create a new instance and then call the open() method on it.

Example: new EditPopup(myBean).open(); <- EditPopup inherits from Dialog

Closing the dialog is as simple as calling this.close();

Hope this helps :)

Upvotes: 0

Related Questions