Beispiel #1
0
 private void maskView() {
   if (!isMasked && grid.isLoadMask()) {
     scroller.mask(GXT.MESSAGES.loadMask_msg());
     isMasked = true;
   }
 }
  /**
   * @param master
   * @param newClient
   */
  public ClientImportWindow(GroupJSO group, boolean master) {
    this.group = group;
    this.master = master;

    clientConstants = GWT.create(ClientConstants.class);

    clientFactory = BeanModelLookup.get().getFactory(ClientJSO.CLASS_NAME);

    setIcon(IconHelper.createStyle("icon-grid"));
    setMinimizable(true);
    setMaximizable(true);
    setSize(640, 350);
    setHeading("Import klientů");
    //		setBodyStyle("padding: 0px; ");

    //		FormLayout layout = new FormLayout();
    //		layout.setLabelAlign(LabelAlign.LEFT);
    //		setLayout(layout);
    setLayout(new FitLayout());

    clientStore = new ListStore<BeanModel>();
    clientStore.sort("name", SortDir.ASC);
    clientStore.setKeyProvider(
        new ModelKeyProvider<BeanModel>() {

          @Override
          public String getKey(BeanModel model) {
            return model.get("uuid");
          }
        });
    clientStore.setModelComparer(
        new ModelComparer<BeanModel>() {

          @Override
          public boolean equals(BeanModel m1, BeanModel m2) {
            if (m1 == m2) {
              return true;
            }
            if (m1 == null || m2 == null) {
              return false;
            }
            return m1.get("uuid").equals(m2.get("uuid"));
          }
        });

    ColumnConfig name = new ColumnConfig("name", clientConstants.getName(), 180);
    ColumnConfig description =
        new ColumnConfig("description", clientConstants.getDescription(), 180);
    ColumnConfig macAddress = new ColumnConfig("macAddress", clientConstants.getMacAddress(), 140);
    ColumnConfig ipAddress = new ColumnConfig("ipAddress", clientConstants.getIpAddress(), 80);

    final CheckBoxSelectionModel<BeanModel> sm = new CheckBoxSelectionModel<BeanModel>();

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

    config.add(sm.getColumn());
    config.add(name);
    config.add(description);
    config.add(macAddress);
    config.add(ipAddress);

    final ColumnModel cm = new ColumnModel(config);

    clientsGrid = new Grid<BeanModel>(clientStore, cm);
    clientsGrid.setBorders(true);
    clientsGrid.setColumnReordering(true);
    clientsGrid.setSelectionModel(sm);
    clientsGrid.addPlugin(sm);

    GridFilters filters = new GridFilters();
    filters.setLocal(true);

    filters.addFilter(new StringFilter("name"));
    filters.addFilter(new StringFilter("description"));
    filters.addFilter(new StringFilter("ipAddress"));
    filters.addFilter(new StringFilter("macAddress"));

    clientsGrid.addPlugin(filters);

    add(clientsGrid, new FitData());

    clientsGrid.mask(GXT.MESSAGES.loadMask_msg());

    generateButtons();
  }