예제 #1
0
 private String getImageBrowser() {
   String model =
       ""
           + "<table width='100%' height='100%' cellpadding='0' cellspacing='0'>"
           + "<tr>"
           + "<td width='20%' valign='top'>"
           + "<div style='width:100%;'>"
           + getPages()
           + "</td>"
           + "<td valign='top'>"
           + "<button id='btnImageUpload' onclick='return getUICore().imageUpload();'>"
           + "Добавить картинку"
           + "</button>"
           + btnRemoveImage.getModel()
           + "</div>"
           + getImages()
           + "</td>"
           + "</tr>"
           + "</table>";
   return model;
 }
예제 #2
0
  private String getPages() {

    String pages =
        ""
            + btnImages.getModel()
            + "<br/>"
            + btnAbout.getModel()
            + "<br/>"
            + btnService.getModel()
            + "<br/>"
            + btnShop.getModel()
            + "<br/>"
            + btnAddress.getModel()
            + "<br/>"
            + btnContacts.getModel();

    return pages;
  }
예제 #3
0
  public EditorPanel(String sessionId) {
    super(sessionId);
    btnImages = new Button(getSession(), "Картинки");
    btnImages.setStyle("width:98%;");
    btnImages.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            JSMediator.setImageBrowser(getSession(), getImageBrowser());
          }
        });

    btnAbout = new Button(getSession(), "О нас");
    btnAbout.setStyle("width:98%;");
    btnAbout.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            selectedPage = "about";
            JSMediator.showEditor(getSession(), getModel());
            JSMediator.setEditorContent(getSession(), getPage(selectedPage));
          }
        });

    btnShop = new Button(getSession(), "Магазин");
    btnShop.setStyle("width:98%;");
    btnShop.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            selectedPage = "shop";
            JSMediator.showEditor(getSession(), getModel());
            JSMediator.setEditorContent(getSession(), getPage(selectedPage));
          }
        });

    btnService = new Button(getSession(), "Услуги");
    btnService.setStyle("width:98%;");
    btnService.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            selectedPage = "service";
            JSMediator.showEditor(getSession(), getModel());
            JSMediator.setEditorContent(getSession(), getPage(selectedPage));
          }
        });

    btnAddress = new Button(getSession(), "Адрес");
    btnAddress.setStyle("width:98%;");
    btnAddress.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            selectedPage = "address";
            JSMediator.showEditor(getSession(), getModel());
            JSMediator.setEditorContent(getSession(), getPage(selectedPage));
          }
        });

    btnContacts = new Button(getSession(), "Контакты");
    btnContacts.setStyle("width:98%;");
    btnContacts.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            selectedPage = "contacts";
            JSMediator.showEditor(getSession(), getModel());
            JSMediator.setEditorContent(getSession(), getPage(selectedPage));
          }
        });

    btnRemoveImage = new Button(getSession(), "Удалить картинку");
    btnRemoveImage.addUIEventListener(
        new UIEventListener() {
          @Override
          public void event(UIEvent evt) {
            if (selectedFileImage != null) {
              ConfirmPanel confirmPanel =
                  new ConfirmPanel(getSession()) {
                    @Override
                    public void pressed(int button) {
                      if (button == ConfirmPanel.YES) {
                        selectedFileImage.toFile().delete();
                        buildJSImagesList();
                        try {
                          JSMediator.setImageBrowser(getSession(), getImageBrowser());
                          selectedFileImage = null;

                        } catch (Exception e) {
                          JSMediator.alert(getSession(), e.toString());
                          Logger.getGlobal().log(Level.WARNING, null, e);
                          selectedFileImage = null;
                        }
                      }
                    }
                  };
              confirmPanel.setTitle("Предупреждение");
              confirmPanel.setMessage("Удалить выбранную картинку?");
              confirmPanel.showPanel();
            }
          }
        });
  }