/** * Constructs a new {@code CollectionConnectorListModel} instance. * * @param collectionConnector * the collection connector holding the values of this list model. */ public CollectionConnectorListModel(ICollectionConnector collectionConnector) { super(); this.collectionConnector = collectionConnector; bindConnector(); }
private void bindConnector() { collectionConnector .addConnectorValueChangeListener(new ListConnectorListener()); for (int index = 0; index < collectionConnector.getChildConnectorKeys() .size(); index++) { bindChildConnector(index); } }
private void bindChildConnector(int index) { IValueConnector cellConnector = collectionConnector .getChildConnector(index); if (cellConnector instanceof IRenderableCompositeValueConnector && ((IRenderableCompositeValueConnector) cellConnector) .getRenderingConnector() != null) { ((IRenderableCompositeValueConnector) cellConnector) .getRenderingConnector().addValueChangeListener( getChildConnectorListener(index)); } else { cellConnector.addValueChangeListener(getChildConnectorListener(index)); } }
viewComponent.setModel(new CollectionConnectorListModel(connector)); viewComponent.setSelectionMode(getSelectionMode(viewDescriptor)); listSelectionModelBinder.bindSelectionModel(viewComponent, connector, viewComponent.getSelectionModel(), null);
setToolTipText(((CollectionConnectorListModel) lm).getRowToolTip(index));
private void bindConnector() { collectionConnector.addValueChangeListener(new ListConnectorListener()); for (int index = 0; index < collectionConnector.getChildConnectorKeys() .size(); index++) { bindChildConnector(index); } }
private void bindChildConnector(int index) { IValueConnector cellConnector = collectionConnector .getChildConnector(index); if (cellConnector instanceof IRenderableCompositeValueConnector && ((IRenderableCompositeValueConnector) cellConnector) .getRenderingConnector() != null) { ((IRenderableCompositeValueConnector) cellConnector) .getRenderingConnector().addConnectorValueChangeListener( getChildConnectorListener(index)); } else { cellConnector .addConnectorValueChangeListener(getChildConnectorListener(index)); } }
private IView<JComponent> createListView(IListViewDescriptor viewDescriptor, @SuppressWarnings("unused") IActionHandler actionHandler, @SuppressWarnings("unused") Locale locale) { ICollectionDescriptorProvider<?> modelDescriptor = ((ICollectionDescriptorProvider<?>) viewDescriptor .getModelDescriptor()); ICompositeValueConnector rowConnectorPrototype = connectorFactory .createCompositeValueConnector(modelDescriptor.getName() + "Element", viewDescriptor.getRenderedProperty()); ICollectionConnector connector = connectorFactory .createCollectionConnector(modelDescriptor.getName(), mvcBinder, rowConnectorPrototype); JList viewComponent = createJList(); JScrollPane scrollPane = createJScrollPane(); scrollPane.setViewportView(viewComponent); IView<JComponent> view = constructView(scrollPane, viewDescriptor, connector); if (viewDescriptor.getRenderedProperty() != null) { IValueConnector cellConnector = createColumnConnector(viewDescriptor .getRenderedProperty(), modelDescriptor.getCollectionDescriptor() .getElementDescriptor()); rowConnectorPrototype.addChildConnector(cellConnector); } viewComponent.setCellRenderer(new EvenOddListCellRenderer()); viewComponent.setModel(new CollectionConnectorListModel(connector)); listSelectionModelBinder.bindSelectionModel(connector, viewComponent .getSelectionModel(), null); return view; }
/** * Constructs a new <code>CollectionConnectorListModel</code> instance. * * @param collectionConnector * the collection connector holding the values of this list model. */ public CollectionConnectorListModel(ICollectionConnector collectionConnector) { super(); this.collectionConnector = collectionConnector; bindConnector(); }