Example #1
0
  private Window createStatisticWindow() {

    Window w = new Window();
    w.setIcon(IconHelper.createStyle("bogus"));
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setHeading("Statistics ");
    w.setSize(400, 400);

    w.setLayout(new AccordionLayout());

    ContentPanel cp = new ContentPanel();
    cp.setHeading("Most contacted friends this month");
    cp.setFrame(false);
    cp.setSize(300, 300);

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

    w.add(cp);

    cp = new ContentPanel();
    cp.setHeading("Most contacted friends in total");
    cp.setFrame(false);
    cp.setSize(300, 300);

    frame = new Frame();
    frame.setUrl(
        "https://chart.googleapis.com/chart?cht=p3&chs=350x200&chd=t:70,30,10&&chl=Hollie|Emerson|Christinal");
    frame.setLayoutData(new FitLayout());
    cp.setLayout(new FitLayout());
    cp.add(frame);

    w.add(cp);

    cp = new ContentPanel();
    cp.setHeading("Average sms per day last two weeks");
    cp.setFrame(false);
    cp.setSize(300, 300);

    frame = new Frame();
    frame.setUrl(
        "https://chart.googleapis.com/chart?cht=lc&chs=350x200&chd=t:25,50,70,90,25,44,56,34,23,56,0,0,34,5,5,103,3,2,6,13&&chl=1|2|3|4|5|6|7|8|9|10|11|12|13|14&chxt=x,y");
    frame.setLayoutData(new FitLayout());
    cp.setLayout(new FitLayout());
    cp.add(frame);

    w.add(cp);

    return w;
  }
Example #2
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;
  }
    @Override
    public void handleEvent(BaseEvent be) {
      final Window w = new Window();
      w.setAutoWidth(true);
      w.setHeading(UserMessages.MESSAGE_UPLOAD_SVG);

      FileUploadPanel p = new FileUploadPanel();
      p.addFileAddedListeners(new FileUploadListener(w));

      w.add(p);
      w.show();
    }
  private SageAlertViewport() {

    westPanel = new ContentPanel();
    westPanel.setScrollMode(Scroll.AUTOY);
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 280);
    westPanel.add(new MenuTreePanel(new MenuDataStore()));
    westPanel.setHeaderVisible(false);
    westPanel.setBottomComponent(new SageAlertToolBar());

    centerPanel = new ContentPanel();
    centerPanel.setLayout(new FitLayout());
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerPanel.setHeaderVisible(false);

    mainWindow = new Window();
    mainWindow.setDraggable(false);
    mainWindow.setHeading("SageAlert v" + Version.getFullVersion());
    mainWindow.setClosable(false);
    mainWindow.setResizable(false);
    mainWindow.setSize(600, 450);
    mainWindow.setLayout(new BorderLayout());
    mainWindow.add(westPanel, westData);
    mainWindow.add(centerPanel, centerData);
    add(mainWindow);
    SettingsServiceAsync rpc = GWT.create(SettingsService.class);
    rpc.isLicensed(
        new AsyncCallback<Boolean>() {

          public void onFailure(Throwable caught) {
            GWT.log("ERROR", caught);
          }

          public void onSuccess(Boolean result) {
            String newHeading = mainWindow.getHeading();
            if (!result) newHeading = newHeading.concat(" (Unlicensed)");
            else newHeading = newHeading.concat(" (Licensed)");
            mainWindow.setHeading(newHeading);
          }
        });
  }
Example #5
0
  /** {@inheritDoc} */
  @Override
  public void buildExportDialog(final ContactDetailsPresenter.ExportActionHandler handler) {

    final Window w = new Window();
    w.setPlain(true);
    w.setModal(true);
    w.setBlinkModal(true);
    w.setLayout(new FitLayout());
    w.setSize(400, 180);
    w.setHeadingHtml(I18N.CONSTANTS.exportData());

    final FormPanel panel = Forms.panel();

    final CheckBox synthesisBox = Forms.checkbox(I18N.CONSTANTS.caracteristics(), Boolean.TRUE);
    synthesisBox.setEnabled(false);
    final CheckBox allRelationsBox = Forms.checkbox(I18N.CONSTANTS.allRelations());
    final CheckBox frameworkRelationsBox = Forms.checkbox(I18N.CONSTANTS.frameworkRelations());
    final CheckBox relationsByElementBox = Forms.checkbox(I18N.CONSTANTS.relationsByElement());

    final CheckBoxGroup options =
        Forms.checkBoxGroup(
            I18N.CONSTANTS.exportOptions(),
            com.extjs.gxt.ui.client.Style.Orientation.VERTICAL,
            synthesisBox,
            allRelationsBox,
            frameworkRelationsBox,
            relationsByElementBox);

    panel.add(options);

    final Button export = Forms.button(I18N.CONSTANTS.export());
    panel.getButtonBar().add(export);
    export.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(final ButtonEvent ce) {
            if (handler != null) {
              handler.onExportContact(
                  synthesisBox.getValue(),
                  allRelationsBox.getValue(),
                  frameworkRelationsBox.getValue(),
                  relationsByElementBox.getValue());
            }
            w.hide();
          }
        });

    w.add(panel);
    w.show();
  }
Example #6
0
  private Window createCheeseWindows() {
    Window w = new Window();
    w.setIcon(IconHelper.createStyle("icon-grid"));
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setHeading("3Dtest app");
    w.setSize(800, 600);
    w.setLayout(new FitLayout());

    Frame app3d = new Frame("scenes/cheese.xhtml");
    System.out.println(app3d.getUrl());

    w.add(app3d);
    return w;
  }
Example #7
0
  private Window createConfiguratorWindows() {
    Window w = new Window();
    w.setIcon(IconHelper.createStyle("icon-grid"));
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setHeading("Zweite Test3DApp");
    w.setSize(800, 600);
    w.setLayout(new FitLayout());

    Frame app3d = new Frame("scenes/car3d/AC_1038.xhtml");
    System.out.println(app3d.getUrl());

    w.add(app3d);
    return w;
  }
Example #8
0
  public Window createVideoWindow() {

    Window w = new Window();
    w.setSize(800, 800);
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setBodyBorder(false);
    w.setBorders(false);
    w.setHeading("Received mms:)");

    Frame frame = new Frame();
    frame.setUrl("video.html");
    frame.setLayoutData(new FitLayout());
    w.setLayout(new FitLayout());
    w.add(frame);

    return w;
  }
Example #9
0
  public Window createPrezioWindow() {

    Window w = new Window();
    w.setSize(500, 500);
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setBodyBorder(false);
    w.setBorders(false);
    w.setHeading("Presentation:)");

    Frame frame = new Frame();
    frame.setUrl("https://prezi.com/secure/40398e8bef489ebec26c2f09c4e0cf4b1d419524/");
    frame.setLayoutData(new FitLayout());
    w.setLayout(new FitLayout());
    w.add(frame);

    return w;
  }
Example #10
0
  private Window createTabWindow() {
    Window w = new Window();
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setSize(740, 480);
    w.setIcon(IconHelper.createStyle("tabs"));
    w.setHeading("Configurator Testapp");

    w.setLayout(new FitLayout());

    TabPanel panel = new TabPanel();

    for (int i = 0; i < 4; i++) {
      TabItem item = new TabItem("Configurator Testapp " + (i + 1));
      item.addText("Something useful would be here");
      panel.add(item);
    }

    w.add(panel);
    return w;
  }
  @Override
  public Widget asWidget() {

    // show window
    window.setSize(400, 310);
    window.setPlain(true);
    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);
    window.setHeading(AppController.Lang.AddNew(AppController.Lang.RunValue().toLowerCase()));
    window.setLayout(new FitLayout());

    // form
    final FormData formData = new FormData("-20");
    FormPanel simple = new FormPanel();
    simple.setHeaderVisible(false);
    simple.setFrame(true);
    simple.setAutoWidth(true);
    simple.setLabelWidth(100);
    // run
    cbName.setDisplayField("n");
    cbName.setFieldLabel(AppController.Lang.Run());
    cbName.setStore(storeName);
    cbName.setEnabled(false);
    cbName.setMinLength(Constants.LIMIT_NAME_MIN);
    cbName.setMaxLength(Constants.LIMIT_NAME_MAX);
    cbName.setAllowBlank(false);
    cbName.setTriggerAction(TriggerAction.ALL);
    simple.add(cbName, formData);
    // date
    final DateField tfDate = CommonUtils.getDateField(date);
    simple.add(tfDate, formData);
    // time
    final TimeSelectFieldView tfTime = new TimeSelectFieldView(0, null);
    tfTime.setFieldLabel(AppController.Lang.Time());
    simple.add(tfTime);

    // duration
    final MySpinnerField tfDuration = CommonUtils.getDurationSpinner();
    simple.add(tfDuration, formData);
    // pulse
    final SpinnerField tfPulse = CommonUtils.getPulseSpinner();
    simple.add(tfPulse, formData);
    // pulse max
    final SpinnerField tfPulseMax = CommonUtils.getPulseSpinner();
    tfPulseMax.setFieldLabel(AppController.Lang.MaxPulse());
    simple.add(tfPulseMax, formData);
    // calories
    final SpinnerField tfCalories = CommonUtils.getCaloriesSpinner();
    simple.add(tfCalories, formData);

    // info
    final TextArea tfInfo = new TextArea();
    tfInfo.setPreventScrollbars(true);
    tfInfo.setFieldLabel(AppController.Lang.Info());
    simple.add(tfInfo, formData);

    // buttons eventhandler
    Button btnAdd = new Button(AppController.Lang.Add());
    btnAdd.setScale(ButtonScale.MEDIUM);
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @SuppressWarnings("deprecation")
          @Override
          public void componentSelected(ButtonEvent ce) {
            try {
              // return model
              if (handler != null) {

                final int pulse = (int) tfPulse.getValue().doubleValue();
                final int pulseMax = (int) tfPulseMax.getValue().doubleValue();
                final int calories = (int) tfCalories.getValue().doubleValue();
                // date and time
                Date date = tfDate.getValue();
                final double time = CommonUtils.getTimeToSeconds(tfTime.getValue());
                date.setHours((int) (time / 3600));
                date.setMinutes((int) ((time % 3600) / 60));
                date = CommonUtils.trimDateToDatabase(date, false);
                final String info = tfInfo.getValue();
                final long duration = tfDuration.getValue().intValue();

                RunValueModel value = new RunValueModel();
                value.setCalories(calories);
                value.setDate(date);
                value.setDuration(duration);
                value.setInfo(info);
                value.setPulse(pulse);
                value.setPulseMax(pulseMax);

                // get run
                RunModel run = null;
                // if no values
                if (cbName.getValue() == null) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // if user typed new value
                else if (!cbName.getRawValue().equals(cbName.getValue().getNameClient())) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // value selected from list
                else {
                  run = cbName.getValue();
                }

                handler.newValue(run, value);
              }

            } catch (Exception e) {
              Motiver.showException(e);
            }
          }
        });
    simple.addButton(btnAdd);
    Button btnCancel = new Button(AppController.Lang.Cancel());
    btnCancel.setScale(ButtonScale.MEDIUM);
    // hide window
    btnCancel.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            handler.cancel();
          }
        });
    simple.addButton(btnCancel);
    simple.setButtonAlign(HorizontalAlignment.CENTER);
    FormButtonBinding binding = new FormButtonBinding(simple);
    binding.addButton(btnAdd);
    window.add(simple);

    window.show();

    return this;
  }
  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();
  }
Example #13
0
  private Window createGridWindow() {
    Window w = new Window();
    w.setIcon(IconHelper.createStyle("icon-grid"));
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setHeading("Messages Window");
    w.setSize(500, 400);
    w.setLayout(new FitLayout());

    GroupingStore<Employee> employeeList = new GroupingStore<Employee>();
    employeeList.add(TestData.getEmployees());
    employeeList.groupBy("department");

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId("name");
    column.setHeader("Sender Name");
    column.setWidth(200);
    configs.add(column);

    column = new ColumnConfig("department", "User group", 150);
    column.setAlignment(HorizontalAlignment.LEFT);
    configs.add(column);

    column = new ColumnConfig("designation", "Taggs", 150);
    column.setAlignment(HorizontalAlignment.LEFT);
    configs.add(column);

    column = new ColumnConfig("salary", "Length", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    final NumberFormat number = NumberFormat.getFormat("0.00");
    GridCellRenderer<Employee> checkSalary =
        new GridCellRenderer<Employee>() {
          public String render(
              Employee model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<Employee> employeeList,
              Grid<Employee> grid) {
            double val = (Double) model.get(property);
            String style = val < 70000 ? "red" : "green";
            return "<span style='color:" + style + "'>" + number.format(val) + "</span>";
          }
        };
    column.setRenderer(checkSalary);
    configs.add(column);

    column = new ColumnConfig("joiningdate", "Date", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());
    configs.add(column);

    final ColumnModel cm = new ColumnModel(configs);

    GroupingView view = new GroupingView();
    view.setForceFit(true);
    view.setGroupRenderer(
        new GridGroupRenderer() {
          public String render(GroupColumnData data) {
            String f = cm.getColumnById(data.field).getHeader();
            String l = data.models.size() == 1 ? "Item" : "Items";
            return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
          }
        });

    Grid<Employee> grid = new Grid<Employee>(employeeList, cm);
    grid.setView(view);
    grid.setBorders(true);

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    cp.setHeading("Friends List");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.setSize(700, 420);
    cp.add(grid);
    w.add(cp);

    return w;
  }
Example #14
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;
  }