@Override
  public void setup(
      final WorkbenchPanelView eastWidget,
      final WorkbenchPanelView westWidget,
      final Position position,
      final Integer preferredSize,
      final Integer preferredMinSize) {

    final int size = assertSize(preferredSize);
    final int minSize = assertMinimumSize(preferredMinSize);

    switch (position) {
      case EAST:
        final int eastChildSize = getChildSize(eastWidget.getPresenter().getDefinition());
        slp.addEast(eastWidgetContainer, size + eastChildSize);
        slp.add(westWidgetContainer);
        break;
      case WEST:
        final int westChildSize = getChildSize(westWidget.getPresenter().getDefinition());
        slp.addWest(westWidgetContainer, size + westChildSize);
        slp.add(eastWidgetContainer);
        break;
      default:
        throw new IllegalArgumentException("position must be either EAST or WEST");
    }
    slp.setWidgetMinSize(eastWidgetContainer, minSize);
    slp.setWidgetMinSize(westWidgetContainer, minSize);

    westWidgetContainer.setWidget(westWidget);
    eastWidgetContainer.setWidget(eastWidget);
    scheduleResize(slp);
  }
예제 #2
0
 @Override
 public void setContentView(Widget widget) {
   if (content.getElement().getChildCount() > 0) {
     for (int i = 0; i < content.getElement().getChildCount(); i++) {
       content.getElement().getChild(i).removeFromParent();
     }
   }
   content.add(widget);
 }
  public com.google.gwt.user.client.ui.Widget createAndBindUi(
      final PolyakovGWT.client.view.MailboxViewImpl owner) {

    PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay =
            (PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle)
                GWT.create(PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenBundle.class);
    PolyakovGWT.client.view.MailboxViewImpl_MyUiBinderImpl_GenCss_style style =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style();
    PolyakovGWT.client.view.widgets.CurrentPathWidget currentPathWidget =
        (PolyakovGWT.client.view.widgets.CurrentPathWidget)
            GWT.create(PolyakovGWT.client.view.widgets.CurrentPathWidget.class);
    PolyakovGWT.client.view.widgets.toolbar.ButtonsHolderWidget buttonsWidget = owner.buttonsWidget;
    com.google.gwt.user.client.ui.VerticalPanel f_VerticalPanel2 =
        (com.google.gwt.user.client.ui.VerticalPanel)
            GWT.create(com.google.gwt.user.client.ui.VerticalPanel.class);
    PolyakovGWT.client.view.widgets.FolderTreeWidget folderTree = owner.folderTree;
    com.google.gwt.user.client.ui.SimpleLayoutPanel containerPanel =
        (com.google.gwt.user.client.ui.SimpleLayoutPanel)
            GWT.create(com.google.gwt.user.client.ui.SimpleLayoutPanel.class);
    com.google.gwt.user.client.ui.SplitLayoutPanel f_SplitLayoutPanel3 =
        (com.google.gwt.user.client.ui.SplitLayoutPanel)
            GWT.create(com.google.gwt.user.client.ui.SplitLayoutPanel.class);
    com.google.gwt.user.client.ui.DockLayoutPanel f_DockLayoutPanel1 =
        new com.google.gwt.user.client.ui.DockLayoutPanel(com.google.gwt.dom.client.Style.Unit.PX);

    f_VerticalPanel2.add(currentPathWidget);
    f_VerticalPanel2.add(buttonsWidget);
    f_DockLayoutPanel1.addNorth(f_VerticalPanel2, 85);
    f_SplitLayoutPanel3.addWest(folderTree, 135);
    containerPanel.addStyleName("" + style.container() + "");
    f_SplitLayoutPanel3.add(containerPanel);
    f_SplitLayoutPanel3.addStyleName("" + style.data_container() + "");
    f_DockLayoutPanel1.add(f_SplitLayoutPanel3);

    owner.containerPanel = containerPanel;
    owner.currentPathWidget = currentPathWidget;
    clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected();

    return f_DockLayoutPanel1;
  }
  public Widget draw() {

    // contentWidget.setSize("100%", "100%");

    DockLayoutPanel ft = new DockLayoutPanel(Style.Unit.PX);
    contentWidget.setWidget(ft);

    final DataGrid gridTable = new DataGrid();
    gridTable.setSize("100%", "100%");

    final ArrayList<Attribute> vosList = new ArrayList<Attribute>();
    final GetAttributesV2 getVos =
        new GetAttributesV2(
            new JsonCallbackEvents() {
              public void onFinished(JavaScriptObject jso) {
                vosList.addAll(
                    new TableSorter<Attribute>()
                        .sortByAttrNameTranslation(JsonUtils.<Attribute>jsoAsList(jso)));
                gridTable.setRowData(vosList);
                gridTable.redraw();
              }
            });
    getVos.getUserAttributes(3411);
    getVos.retrieveData();

    gridTable.setSelectionModel(
        new MultiSelectionModel<Attribute>(new GeneralKeyProvider<Attribute>()));
    final SelectionModel<Attribute> selectionModel = gridTable.getSelectionModel();
    gridTable.setKeyboardSelectionPolicy(
        HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);

    Column<Attribute, Boolean> checkBoxColumn =
        new Column<Attribute, Boolean>(new CheckboxCell(true, true)) {
          @Override
          public Boolean getValue(Attribute object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
          }
        };
    checkBoxColumn.setFieldUpdater(
        new FieldUpdater<Attribute, Boolean>() {
          @Override
          public void update(int i, Attribute Attribute, Boolean aBoolean) {
            selectionModel.setSelected(Attribute, aBoolean);
          }
        });

    // Checkbox column header
    CheckboxCell cb = new CheckboxCell();
    Header<Boolean> checkBoxHeader =
        new Header<Boolean>(cb) {
          public Boolean getValue() {
            return false; // return true to see a checked checkbox.
          }
        };
    checkBoxHeader.setUpdater(
        new ValueUpdater<Boolean>() {
          public void update(Boolean value) {
            // sets selected to all, if value = true, unselect otherwise
            for (Attribute obj : vosList) {
              selectionModel.setSelected(obj, value);
            }
          }
        });

    gridTable.addColumn(checkBoxColumn, checkBoxHeader, checkBoxHeader);
    gridTable.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);

    TextColumn<Attribute> idColumn =
        new TextColumn<Attribute>() {
          @Override
          public String getValue(Attribute object) {
            return String.valueOf(object.getId());
          }
        };

    if (JsonUtils.isExtendedInfoVisible()) {
      gridTable.addColumn(idColumn, "Id", "Id");
      gridTable.setColumnWidth(idColumn, "90px");
    }

    // Name column
    Column<Attribute, Attribute> nameColumn = JsonUtils.addColumn(new PerunAttributeNameCell());

    // Description column
    Column<Attribute, Attribute> descriptionColumn =
        JsonUtils.addColumn(new PerunAttributeDescriptionCell());

    // Value column
    Column<Attribute, Attribute> valueColumn =
        JsonUtils.addColumn(
            new PerunAttributeValueCell(),
            new FieldUpdater<Attribute, Attribute>() {
              public void update(int index, Attribute object, Attribute value) {
                object = value;
                selectionModel.setSelected(object, object.isAttributeValid());
              }
            });

    ColumnSortEvent.ListHandler<Attribute> columnSortHandler =
        new ColumnSortEvent.ListHandler<Attribute>(vosList);
    gridTable.addColumnSortHandler(columnSortHandler);

    // Sorting name column
    nameColumn.setSortable(true);
    columnSortHandler.setComparator(
        nameColumn, new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_NAME));

    // Sorting description column
    descriptionColumn.setSortable(true);
    columnSortHandler.setComparator(
        descriptionColumn,
        new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_DESCRIPTION));

    // Add sorting
    gridTable.addColumnSortHandler(columnSortHandler);

    // updates the columns size
    gridTable.setColumnWidth(nameColumn, 200.0, Style.Unit.PX);
    gridTable.setColumnWidth(valueColumn, 420.0, Style.Unit.PX);

    gridTable.addColumn(nameColumn, "Name");
    gridTable.addColumn(valueColumn, "Value");
    gridTable.addColumn(descriptionColumn, "Description");

    TabMenu tabMenu = new TabMenu();

    tabMenu.addWidget(
        TabMenu.getPredefinedButton(
            ButtonType.ADD,
            "",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                session.getTabManager().addTabToCurrentTab(new TestDataGridTabItem(), true);
              }
            }));

    ft.addNorth(tabMenu, 50);
    ft.add(gridTable);

    return getWidget();
  }
예제 #5
0
 @Override
 public void setNavigationView(Widget widget) {
   navigation.add(widget);
 }
예제 #6
0
 @Override
 public void setHeaderView(Widget widget) {
   header.add(widget);
 }