Je suis novice en programmation.Comment ajouter un bouton d'annulation dans PopupPanel dans Gwt
J'ai le panneau vertical. Un bouton (lblAddFolderIcon) est ajouté sur le verticalPanel et aussi quelques widgets. Sur un clic de b1, il devrait y avoir un panneau popup avec quelques widgets supplémentaires et deux boutons avec ajouter et annuler.
Mon code:
lblAddFolderIcon.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String childFolder = item.getText();
String[] mainRepository=getPath(item);
String objectId=item.getTitle();
final AddFolderPopup addFolderPopup = new AddFolderPopup(childFolder,mainRepository[0],objectId);
addFolderPopup.setHeight("300px");
addFolderPopup.setWidth("502px");
addFolderPopup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
public void setPosition(int offsetWidth, int offsetHeight) {
// TODO Auto-generated method stub
int left = (Window.getClientWidth() - offsetWidth)/3;
int top = (Window.getClientHeight() - offsetHeight)/3;
addFolderPopup.setPopupPosition(left, top);
}
});
//addFolderPopup.show();
addFolderPopup.addFolderGui();
}
});
public class AddFolderPopup extends PopupPanel {
VerticalPanel vpPopupl = new VerticalPanel();
private String childFolder;
private String mainRepository;
private String objectId;
public AddFolderPopup(){
super(true);
}
public AddFolderPopup(String childFolder, String mainRepository, String objectId) {
this.childFolder = childFolder;
this.mainRepository = mainRepository;
this.objectId = objectId;
}
public void addFolderGui() {
// some widget to design Gui and
Button btnCancel = new Button("Cancel");
btnCancel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
/* i Dont Know what should i write here
so that this popupwindow is closed
*/
}
});
}
}
Plz suggérer un code pour fermer cette fenêtre et également si mon approche est correcte.
un bouton d'annulation sur un panneau contextuel? vous êtes sûr de ne pas vouloir de boîte de dialogue? – milan
il devrait être fenêtre qui vient sur l'écran arrière .. si boîte de dialogue satisfait le besoin, ça ira. – NewCodeLearner