Package com.piki.client.presenter

Examples of com.piki.client.presenter.WikiPagePresenterCallback


  }
 
  @Override
  protected TabLayoutPanel onInitialize() {
   
    final WikiPagePresenterCallback callback = getPresenterCallback();
   
    deckPanel = new TabLayoutPanel(2.5, Unit.EM);
    deckPanel.setStyleName(STYLE_NAME);
   
    // add panels
    deckPanel.add(decorateWidget(createReadPanel()), "Lesen");
    deckPanel.add(decorateWidget(createEditPanel()), "Bearbeiten");
   
    // select read Tab
    deckPanel.selectTab(0);
   
    deckPanel.addSelectionHandler(new SelectionHandler<Integer>() {
     
      @Override
      public void onSelection(SelectionEvent<Integer> event) {
        int tabId = event.getSelectedItem();
        if (tabId == 1) {
          callback.toBeEdit(new AsyncCallback<Boolean>() {

            @Override
            public void onSuccess(Boolean result) {
              if (result == null)
                Window.alert("Seite kann leider nicht geladen werden: unerwarteter Rückgabewert (result == null");
View Full Code Here


   * create the edit panel
   * @return edit panel
   */
  private Widget createEditPanel() {
   
    final WikiPagePresenterCallback callback = getPresenterCallback();
   
    HorizontalPanel deckPanel = new HorizontalPanel();
    deckPanel.setWidth("100%");
    deckPanel.setStyleName(STYLE_NAME_EDIT);
    deckPanel.add(wikiPageArea);

    // footer panel
    VerticalPanel footerPanel = new VerticalPanel();
    footerPanel.setStyleName(STYLE_NAME_EDIT_FOOTER);
 
    // Hilfe
    HTML help = new HTML(WIKI_HELP);
    footerPanel.add(help);
   
    // save button
    Button save = new Button("Seite speichern");
    save.setStyleName(STYLE_NAME_BUTTON);
    save.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        callback.toBeSaved(wikiPageArea.getText()new AsyncCallback<Boolean>() {
         
          @Override
          public void onSuccess(Boolean result) {
            if (result == null)
              Window.alert("Seite kann leider nicht gespeichert werden: unerwarteter Rückgabewert (result == null");
           
            if (result != null) {
              if (result)
                selectReadPanel();
              else
                Window.alert("Seite kann leider nicht gespeichert werden: unerwarteter Rückgabewert (result == false");
            }
          }
         

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("Seite kann leider nicht gespeichert werden: caught.getMessage()");         
          }
        });
       
      }
    });
    footerPanel.add(save);
   
    // preview button
    Button preview = new Button("Vorschau anzeigen");
    preview.setStyleName(STYLE_NAME_BUTTON);
    preview.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        callback.toBePreview(wikiPageArea.getText()new AsyncCallback<Boolean>() {
         
          @Override
          public void onSuccess(Boolean result) {
            if (result == null)
              Window.alert("Vorschau auf Seite leider nicht möglich: unerwarteter Rückgabewert (result == null");
           
            if (result != null) {
              if (!result)
                Window.alert("Vorschau auf Seite leider nicht möglich: unerwarteter Rückgabewert (result == false");
            }
          }
         

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("Vorschau auf Seite nicht möglich: caught.getMessage()");         
          }
        });
       
      }
       
    });
    footerPanel.add(preview);
   
    // discard button
    Button discard = new Button("Abbrechen");
    discard.setStyleName(STYLE_NAME_BUTTON);
    discard.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        try {
          if (!callback.discard())
          Window.alert("Änderung kann nicht zurückgenommen werden");
        } catch (Exception exception) {
          Window.alert("Änderung kann nicht zurückgenommen werden: " + exception.getMessage());
        }
      }
View Full Code Here

TOP

Related Classes of com.piki.client.presenter.WikiPagePresenterCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.