Java Code Examples for com.google.gwt.view.client.ListDataProvider#setList()

The following examples show how to use com.google.gwt.view.client.ListDataProvider#setList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JndiTreeParser.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Get the {@link NodeInfo} that provides the children
 * of the specified value.
 */
public <T> NodeInfo<?> getNodeInfo(T value) {

    final ListDataProvider<JndiEntry> dataProvider = new ListDataProvider<JndiEntry>();

    if (value instanceof JndiEntry) {
        JndiEntry entry = (JndiEntry)value;
        dataProvider.setList(entry.getChildren());
    } else {
        setFinish(new Command() {
            @Override
            public void execute() {
                dataProvider.setList(rootEntry.getChildren());
            }
        });
    }

    return new DefaultNodeInfo<JndiEntry>(dataProvider, new JndiEntryCell(), selectionModel, null);
}
 
Example 2
Source File: PersonPanelView.java    From demo-gwt-springboot with Apache License 2.0 5 votes vote down vote up
private void refreshGrid(List<PersonDto> personDtos, ListDataProvider<PersonDto> dataProvider) {
	for (PersonDto p : personDtos) {
		logger.info(p.getNickname() + " " + p.isInRetirement());
	}

	dataProvider.setList(personDtos);
}
 
Example 3
Source File: GwtTreeNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setItems(List<TreeState.TreeNodeState> list) {
  ListDataProvider<TreeState.TreeNodeState> provider = (ListDataProvider<TreeState.TreeNodeState>)getProvidesKey();

  provider.setList(list);
  provider.refresh();
}
 
Example 4
Source File: AssignmentDialog.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Widget asWidget() {
    ProvidesKey<Role> keyProvider = Role::getId;

    AbstractCell<Role> roleCell = new AbstractCell<Role>() {
        @Override
        public void render(final Context context, final Role value, final SafeHtmlBuilder sb) {
            sb.append(Templates.roleItem("navigation-column-item", value));
        }
    };
    DefaultCellList<Role> list = new DefaultCellList<>(roleCell, keyProvider);
    list.setPageSize(30);
    list.setKeyboardPagingPolicy(INCREASE_RANGE);
    list.setKeyboardSelectionPolicy(BOUND_TO_SELECTION);

    ListDataProvider<Role> dataProvider = new ListDataProvider<>(keyProvider);
    dataProvider.setList(
            Roles.orderedByType().compound(Roles.orderedByName()).immutableSortedCopy(unassignedRoles));
    dataProvider.addDataDisplay(list);

    SingleSelectionModel<Role> selectionModel = new SingleSelectionModel<>(keyProvider);
    list.setSelectionModel(selectionModel);
    selectionModel.setSelected(dataProvider.getList().get(0), true);
    Scheduler.get().scheduleDeferred(() -> list.setFocus(true));

    Label errorMessage = new Label();
    errorMessage.setVisible(false);
    errorMessage.getElement().getStyle().setColor("#c82e2e");
    errorMessage.getElement().getStyle().setPadding(7, PX);

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("window-content");
    layout.add(errorMessage);
    layout.add(list);

    DialogueOptions options = new DialogueOptions(
            event -> {
                if (selectionModel.getSelectedObject() == null) {
                    errorMessage.setText(Console.CONSTANTS.pleaseSelectRole());
                    errorMessage.setVisible(true);
                } else {
                    Assignment assignment = new Assignment(principal, selectionModel.getSelectedObject(),
                            include);
                    circuit.dispatch(new AddAssignment(assignment, PRINCIPAL_TO_ROLE));
                    presenter.closeWindow();
                }
            },
            event -> presenter.closeWindow()
    );

    return new WindowContentBuilder(layout, options).build();
}
 
Example 5
Source File: MemberDialog.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Widget asWidget() {
    ProvidesKey<Principal> keyProvider = Principal::getId;

    AbstractCell<Principal> roleCell = new AbstractCell<Principal>() {
        @Override
        public void render(final Context context, final Principal value, final SafeHtmlBuilder sb) {
            sb.append(Templates.memberItem("navigation-column-item", value));
        }
    };
    DefaultCellList<Principal> list = new DefaultCellList<>(roleCell, keyProvider);
    list.setPageSize(30);
    list.setKeyboardPagingPolicy(INCREASE_RANGE);
    list.setKeyboardSelectionPolicy(BOUND_TO_SELECTION);

    ListDataProvider<Principal> dataProvider = new ListDataProvider<>(keyProvider);
    dataProvider.setList(Principals.orderedByType()
            .compound(Principals.orderedByName())
            .immutableSortedCopy(unassignedPrincipals));
    dataProvider.addDataDisplay(list);

    SingleSelectionModel<Principal> selectionModel = new SingleSelectionModel<>(keyProvider);
    list.setSelectionModel(selectionModel);
    selectionModel.setSelected(dataProvider.getList().get(0), true);
    Scheduler.get().scheduleDeferred(() -> list.setFocus(true));

    Label errorMessage = new Label();
    errorMessage.setVisible(false);
    errorMessage.getElement().getStyle().setColor("#c82e2e");
    errorMessage.getElement().getStyle().setPadding(7, PX);

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("window-content");
    layout.add(errorMessage);
    layout.add(list);

    DialogueOptions options = new DialogueOptions(
            event -> {
                if (selectionModel.getSelectedObject() == null) {
                    errorMessage.setText(Console.CONSTANTS.pleaseSelectPrincipal());
                    errorMessage.setVisible(true);
                } else {
                    Assignment assignment = new Assignment(selectionModel.getSelectedObject(), role,
                            include);
                    circuit.dispatch(new AddAssignment(assignment, ROLE_TO_PRINCIPAL));
                    presenter.closeWindow();
                }
            },
            event -> presenter.closeWindow()
    );

    return new WindowContentBuilder(layout, options).build();
}