示例#1
0
  private Window createGeolocationWindow() {

    final Window w = new Window();
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setIcon(IconHelper.createStyle("accordion"));
    w.setHeading("Contact list");
    w.setWidth(500);
    w.setHeight(500);
    w.setLayout(new FitLayout());

    ContentPanel cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Localize your friends");
    cp.setScrollMode(Scroll.NONE);
    cp.setLayout(new FitLayout());

    Frame frame = new Frame();
    frame.setUrl("geolocation.html");
    frame.setLayoutData(new FitLayout());
    cp.add(frame);

    w.add(cp);
    return w;
  }
  public void initUserImportView() {
    final Window window = new Window();
    window.setBodyBorder(false);
    FormPanel reportPanel = new FormPanel();
    Label dLabel = new Label(I18nUtils.getMessages().user_userImportReports());

    reportPanel.add(dLabel);
    reportPanel.setHeight(120);
    reportPanel.setBodyBorder(false);
    reportPanel.setHeaderVisible(false);
    reportPanel.setHideLabels(true);
    Button close = new Button(I18nUtils.getMessages().user_userImportReports_close());
    close.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            window.hide();
          }
        });

    window.setTitle(I18nUtils.getMessages().user_userImportReports_window());
    window.setWidth(560);
    window.setHeading(I18nUtils.getMessages().user_importUsersPanel_title());
    window.setClosable(true);
    MyFileUpload importUserTool =
        new MyFileUpload("importusers") {

          @SuppressWarnings("unchecked")
          @Override
          public void fireActionComplete(String responseText) {
            JSONObject json = (JSONObject) JSONParser.parseLenient(responseText);
            JSONValue number = json.get("reportId");
            JSONNumber sJsonNumber = number.isNumber();

            UserService.Util.getInstance()
                .importUsers(
                    (int) sJsonNumber.doubleValue(),
                    new AsyncCallback() {

                      public void onFailure(Throwable caught) {
                        MessageBox.alert(
                            I18nUtils.getMessages().user_importUsersPanel_title(),
                            caught.getMessage(),
                            null);
                        GWT.log("importing users failed");
                      }

                      public void onSuccess(final Object result) {
                        ImportUserReport[] reports = (ImportUserReport[]) result;
                        String msg = "";
                        for (ImportUserReport r : reports) {
                          msg += r + "<br/>";
                        }
                        Dialog report = new Dialog();
                        report.setHeight(300);
                        report.setWidth(480);
                        report.addText(msg);
                        report.setHideOnButtonClick(true);
                        report.show();

                        load();
                      }
                    });
          }

          @Override
          public void actionEnd() {
            GWT.log("importing users  end up");
          }
        };

    reportPanel.add(importUserTool);
    reportPanel.addButton(close);
    reportPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    window.add(reportPanel);

    window.show();
  }
示例#3
0
  private Window createAccordionWindow() {
    final Window w = new Window();
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setIcon(IconHelper.createStyle("accordion"));
    w.setHeading("Contact list");
    w.setWidth(200);
    w.setHeight(350);

    ToolBar toolBar = new ToolBar();
    Button item = new Button();
    item.setIcon(IconHelper.createStyle("icon-connect"));
    toolBar.add(item);

    toolBar.add(new SeparatorToolItem());
    w.setTopComponent(toolBar);

    item = new Button();
    item.setIcon(IconHelper.createStyle("icon-user-add"));
    toolBar.add(item);

    item = new Button();
    item.setIcon(IconHelper.createStyle("icon-user-delete"));
    toolBar.add(item);

    w.setLayout(new AccordionLayout());

    ContentPanel cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Online Users");
    cp.setScrollMode(Scroll.AUTO);
    cp.getHeader().addTool(new ToolButton("x-tool-refresh"));

    w.add(cp);

    TreeStore<ModelData> store = new TreeStore<ModelData>();
    TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
    tree.setIconProvider(
        new ModelIconProvider<ModelData>() {

          public AbstractImagePrototype getIcon(ModelData model) {
            if (model.get("icon") != null) {
              return IconHelper.createStyle((String) model.get("icon"));
            } else {
              return null;
            }
          }
        });
    tree.setDisplayProperty("name");

    ModelData m = newItem("Eurecom", null);
    store.add(m, false);
    tree.setExpanded(m, true);

    store.add(m, newItem("Emerson Milton", "user-suit"), false);
    store.add(m, newItem("Christina Blake", "user-girl"), false);
    store.add(m, newItem("Heriberto Rush", "user-kid"), false);
    store.add(m, newItem("Candice Carson", "user-girl"), false);
    store.add(m, newItem("Bell Snedden", "user-kid"), false);
    store.add(m, newItem("Dirk Newman", "user-kid"), false);
    store.add(m, newItem("Chad Andrews", "user-suit"), false);

    m = newItem("Italy", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Benito Meeks", "user-suit"), false);
    store.add(m, newItem("Gail Horton", "user-girl"), false);

    m = newItem("Paris", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Claudio Engle", "user-suit"), false);
    store.add(m, newItem("Sine", "user-girl"), false);

    m = newItem("Hometown", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Hollie Voss", "user-girl"), false);

    cp.add(tree);

    cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Settings");
    cp.setBodyStyleName("pad-text");
    cp.addText("Smape1");
    w.add(cp);

    cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Blocked");
    cp.setBodyStyleName("pad-text");
    cp.addText("Smape2");
    w.add(cp);

    return w;
  }