Package org.springframework.richclient.selection.dialog

Examples of org.springframework.richclient.selection.dialog.ListSelectionDialog


    protected ApplicationDialog createSelectionDialog() {
        EventList eventList = createEventList(selectableItemsHolder);
        final ValueModel2EventListBridge itemRefresher = new ValueModel2EventListBridge(selectableItemsHolder,
                eventList, true);

        ListSelectionDialog selectionDialog = null;
        if (filtered) {
            FilterListSelectionDialog filterDialog = new FilterListSelectionDialog("", null, new FilterList(eventList));
            if (filterProperties == null) {
                filterDialog.setFilterator(new StringTextFilterator());
            } else {
                filterDialog.setFilterator(new BeanTextFilterator(filterProperties));
            }

            selectionDialog = filterDialog;
        } else {
            selectionDialog = new ListSelectionDialog("", null, eventList);
        }

        selectionDialog.setOnAboutToShow(new Block() {
            protected void handle(Object ignore) {
                itemRefresher.synchronize();
            }
        });

        selectionDialog.setOnSelectAction(new Closure() {
            public Object call(Object argument) {
                controlValueChanged(argument);
                selectField.setValue(argument);

                return argument;
            }
        });
        selectionDialog.setRenderer(getRendererForSelectionDialog());

        if (StringUtils.hasText(descriptionKey)) {
            String description = getMessage(descriptionKey);
            selectionDialog.setDescription(description);
        }
        if (StringUtils.hasText(titleKey)) {
            String title = getMessage(titleKey);
            selectionDialog.setTitle(title);
        }

        return selectionDialog;
    }
View Full Code Here


   */
  @Nullable
  public static <T> T userSelect( @NotNull List<? extends T> values, @NotNull @NonNls String titleKey, @NotNull DefaultLabelProvider<? super T> labelProvider ) throws CanceledException {
    final Object[] selected = new Object[]{null};

    ListSelectionDialog dialog = new ListSelectionDialog( SpringSupport.INSTANCE.getMessage( titleKey ), values ) {
      @Override
      protected void onSelect( Object selection ) {
        selected[0] = selection;
      }
    };

    dialog.setRenderer( new LabelProviderListCellRenderer( labelProvider ) );
    dialog.showDialog();

    if ( selected[0] == null ) {
      throw new CanceledException();
    }

View Full Code Here

TOP

Related Classes of org.springframework.richclient.selection.dialog.ListSelectionDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.