Пример #1
0
  public RoomMaterialsViewImpl() {
    /*CellTable.Resources tableResources = GWT
    .create(MyCellTableResources.class);*/
    // cell tbale changes
    CellTable.Resources tableResources = GWT.create(MyCellTableResourcesNoSortArrow.class);
    table = new AdvanceCellTable<MaterialListProxy>(OsMaConstant.TABLE_PAGE_SIZE, tableResources);
    // cell table chages
    SimplePager.Resources pagerResources = GWT.create(MySimplePagerResources.class);
    Pager =
        new SimplePager(
            SimplePager.TextLocation.RIGHT,
            pagerResources,
            true,
            OsMaConstant.TABLE_JUMP_SIZE,
            true);

    searchBox =
        new QuickSearchBox(
            new QuickSearchBox.Delegate() {
              @Override
              public void performAction() {
                delegate.performSearch(searchBox.getValue());
              }
            });

    initWidget(uiBinder.createAndBindUi(this));
    init();
    splitLayoutPanel.setWidgetMinSize(
        splitLayoutPanel.getWidget(0), OsMaConstant.SPLIT_PANEL_MINWIDTH);

    AddButton.setText(constants.addMaterial());
  }
Пример #2
0
 public void showErrorMessageToUser(String message) {
   final MessageConfirmationDialogBox confirmationDialogBox =
       new MessageConfirmationDialogBox(constants.warning());
   confirmationDialogBox.showConfirmationDialog(message);
 }
 @Override
 public String mayStop() {
   if (!save && changed()) return constants.changesDiscarded();
   else return null;
 }
Пример #4
0
  public void init() {

    ResolutionSettings.setSplitLayoutPanelPosition(splitLayoutPanel, true);
    //		int splitLeft = (OsMaMainNav.getMenuStatus() == 0) ? 40 : 225;
    //
    //		DOM.setElementAttribute(splitLayoutPanel.getElement(), "style",
    //				"position: absolute; left: "+splitLeft+"px; top: 30px; right: 5px; bottom: 0px;");
    //
    //		if(OsMaMainNav.getMenuStatus() == 0)
    //			splitLayoutPanel.setWidgetSize(splitLayoutPanel.getWidget(0), 1412);
    //		else
    //			splitLayoutPanel.setWidgetSize(splitLayoutPanel.getWidget(0), 1220);

    // @SPEC

    paths.add("name");
    paths.add("");
    table.addColumn(
        new TextColumn<MaterialListProxy>() {
          {
            this.setSortable(true);
          }

          Renderer<java.lang.String> renderer =
              new AbstractRenderer<java.lang.String>() {

                public String render(java.lang.String obj) {
                  return obj == null ? "" : String.valueOf(obj);
                }
              };

          @Override
          public String getValue(MaterialListProxy materialListProxy) {
            return renderer.render(
                (materialListProxy.getName() == null) ? "" : materialListProxy.getName());
          }
        },
        constants.roomMaterialName());

    paths.add("type");
    paths.add("");
    table.addColumn(
        new TextColumn<MaterialListProxy>() {
          {
            this.setSortable(true);
          }

          Renderer<MaterialType> renderer = new EnumRenderer<MaterialType>();

          @Override
          public String getValue(MaterialListProxy materialListProxy) {
            return renderer.render(materialListProxy.getType());
          }
        },
        constants.roomMaterialType());

    paths.add("price");
    paths.add("");
    table.addColumn(
        new TextColumn<MaterialListProxy>() {
          {
            this.setSortable(true);
          }

          Renderer<String> renderer =
              new AbstractRenderer<String>() {

                public String render(String obj) {
                  return obj == null ? "" : String.valueOf(obj);
                }
              };

          @Override
          public String getValue(MaterialListProxy materialListProxy) {
            return renderer.render(
                (materialListProxy.getPrice() == null)
                    ? ""
                    : materialListProxy.getPrice().toString());
          }
        },
        constants.roomMaterialPrice());

    paths.add("priceType");
    paths.add("");
    table.addColumn(
        new TextColumn<MaterialListProxy>() {
          {
            this.setSortable(true);
          }

          Renderer<PriceType> renderer = new EnumRenderer<PriceType>();

          @Override
          public String getValue(MaterialListProxy materialListProxy) {
            return renderer.render(materialListProxy.getPriceType());
          }
        },
        constants.roomMaterialPriceType());

    // // Edit Button
    // addColumn(new ActionCell<MaterialListProxy>("Edit",
    // new ActionCell.Delegate<MaterialListProxy>() {
    // public void execute(MaterialListProxy specialization) {
    // // Window.alert("You clicked " +
    // // institution.getInstitutionName());
    // if (Window.confirm(constants.reallyDelete()))
    // delegate.
    // deleteClicked(specialization);
    // }
    // }), "", new GetValue<MaterialListProxy>() {
    // public MaterialListProxy getValue(MaterialListProxy specialization) {
    // return specialization;
    // }
    // }, null);
    // table.addColumnStyleName(1, "iconCol");

    // Delete button
    addColumn(
        new ActionCell<MaterialListProxy>(
            OsMaConstant.DELETE_ICON,
            new ActionCell.Delegate<MaterialListProxy>() {
              public void execute(final MaterialListProxy materialListProxy) {
                // Window.alert("You clicked " +
                // institution.getInstitutionName());
                /*if (Window.confirm(constants.reallyDelete()))
                delegate.deleteClicked(materialListProxy);*/
                // Issue Role
                final MessageConfirmationDialogBox dialogBox =
                    new MessageConfirmationDialogBox(constants.success());
                dialogBox.showYesNoDialog(constants.reallyDelete());
                dialogBox
                    .getYesBtn()
                    .addClickHandler(
                        new ClickHandler() {

                          @Override
                          public void onClick(ClickEvent event) {
                            dialogBox.hide();
                            Log.info("yes click");
                            delegate.deleteClicked(materialListProxy);
                            return;
                          }
                        });

                dialogBox
                    .getNoBtnl()
                    .addClickHandler(
                        new ClickHandler() {

                          @Override
                          public void onClick(ClickEvent event) {
                            dialogBox.hide();
                            Log.info("no click");
                            return;
                          }
                        });
                // E: Issue Role
              }
            }),
        "",
        new GetValue<MaterialListProxy>() {
          public MaterialListProxy getValue(MaterialListProxy materialListProxy) {
            return materialListProxy;
          }
        },
        null);
    table.addColumnStyleName(1, "iconCol");
    table.addColumnStyleName(3, "iconCol");
    table.addColumnStyleName(5, "iconCol");
    table.addColumnStyleName(7, "iconCol");
    table.addColumnStyleName(8, "iconCol");
  }