/** * Returns the connector at {@code index} in the child connectors * collection contained in the backed collection connector. * <p> * {@inheritDoc} */ @Override public IValueConnector getElementAt(int index) { return collectionConnector.getChildConnector(index); }
private void resetRowSelection(int row) { if (collectionConnector.getSelectedIndices() != null) { if (Arrays.binarySearch(collectionConnector.getSelectedIndices(), row) >= 0) { collectionConnector.setSelectedIndices(); } } }
private int computeRow(IValueConnector connector) { for (int i = 0; i < collectionConnector.getChildConnectorCount(); i++) { if (collectionConnector.getChildConnector(i) == connector) { return i; } } return -1; }
private void bindConnector() { collectionConnector.addValueChangeListener(tableListener); for (int row = 0; row < collectionConnector.getChildConnectorCount(); row++) { bindChildRowConnector(row); } }
@SuppressWarnings("ConstantConditions") private Object[] synchWorkspaceNavigatorSelection(ICollectionConnectorListProvider navigatorConnector, Module module) { Object[] result = null; int moduleModelIndex = -1; for (ICollectionConnector childCollectionConnector : navigatorConnector.getCollectionConnectors()) { for (int i = 0; i < childCollectionConnector.getChildConnectorCount(); i++) { IValueConnector childConnector = childCollectionConnector.getChildConnector(i); if (module != null && module.equals(childConnector.getConnectorValue())) { moduleModelIndex = i; } if (childConnector instanceof ICollectionConnectorListProvider) { Object[] subResult = synchWorkspaceNavigatorSelection((ICollectionConnectorListProvider) childConnector, module); if (subResult != null) { result = subResult; } } } if (moduleModelIndex >= 0) { result = new Object[]{childCollectionConnector, moduleModelIndex}; } else { childCollectionConnector.setSelectedIndices(null, -1); } } return result; }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { ICollectionConnector resultConnector = ((ICollectionConnectorProvider) getViewConnector(context)) .getCollectionConnector(); int[] resultSelectedIndices = resultConnector.getSelectedIndices(); if (resultSelectedIndices != null && resultSelectedIndices.length > 0) { Object selectedComponent = resultConnector.getChildConnector( resultSelectedIndices[0]).getConnectorValue(); context.put(ActionContextConstants.ACTION_PARAM, selectedComponent); } return super.execute(actionHandler, context); } }
@Override public void valueChange(ValueChangeEvent evt) { ICollectionConnector connector = (ICollectionConnector) evt.getSource(); IValueConnector parentConnector = connector.getParentConnector(); List<RemoteValueState> children = new ArrayList<>(); for (int i = 0; i < connector.getChildConnectorCount(); i++) { IValueConnector childConnector = connector.getChildConnector(i); if (childConnector instanceof IRemoteStateOwner) { children.add(((IRemoteStateOwner) childConnector).getState()); if (connector.getSelectedIndices() != null && connector.getSelectedIndices().length > 0) { connector.setSelectedIndices(null, -1);
/** * Gets the report to execute out of the model connector. * <p> * {@inheritDoc} */ @Override protected IReport getReportToExecute(IActionHandler actionHandler, Map<String, Object> context) { ICollectionConnector viewConnector = (ICollectionConnector) getViewConnector(context); int[] selectedIndices = viewConnector.getSelectedIndices(); ICollectionConnector collectionConnector = (ICollectionConnector) viewConnector .getModelConnector(); if (selectedIndices == null || selectedIndices.length == 0 || collectionConnector == null) { return null; } Object reportDescriptorOrReport = collectionConnector.getChildConnector( selectedIndices[0]).getConnectorValue(); IReport report = null; if (reportDescriptorOrReport instanceof IReport) { report = (IReport) reportDescriptorOrReport; } else if (reportDescriptorOrReport instanceof IReportDescriptor) { report = getReportFactory().createReportInstance( (IReportDescriptor) reportDescriptorOrReport, getTranslationProvider(context), getLocale(context)); } return report; }
.getCollectionConnector(); int index = -1; int[] selectedIndices = collectionConnector.getSelectedIndices(); if (selectedIndices != null && selectedIndices.length > 0) { index = selectedIndices[0]; if (index >= collectionConnector.getChildConnectorCount()) { IAction fetchAction = getFetchAction(context); if (fetchAction != null) { if (index >= 0 && index < collectionConnector.getChildConnectorCount()) { collectionConnector.setSelectedIndices(index); actionHandler.execute(getOnSuccessAction(), context); } else {
private void checkListenerRegistrationForConnector( ICollectionConnectorListProvider nodeConnector) { for (ICollectionConnector childNodeConnector : nodeConnector .getCollectionConnectors()) { childNodeConnector .addSelectionChangeListener(connectorsSelectionListener); for (int i = 0; i < childNodeConnector.getChildConnectorCount(); i++) { checkListenerRegistrationForConnector((ICollectionConnectorListProvider) childNodeConnector .getChildConnector(i)); } } }
/** * {@inheritDoc} */ @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return collectionConnector.isWritable() && collectionConnector.getChildConnector(rowIndex).isWritable() && getConnectorAt(rowIndex, columnIndex).isWritable(); }
private void childClicked(MouseEvent evt) { ICollectionConnector collectionConnector = (ICollectionConnector) repeaterView.getConnector(); Component child = (Component) evt.getSource(); int index = -1; while (index < 0 && child != null) { index = Arrays.asList(container.getComponents()).indexOf(child); child = child.getParent(); } if (index >= 0) { collectionConnector.setSelectedIndices(new int[]{index}, index); } else { collectionConnector.setSelectedIndices(new int[0], -1); } }
/** * Returns the backed collection connector size. * <p> * {@inheritDoc} */ @Override public int getSize() { return collectionConnector.getChildConnectorCount(); }
/** * {@inheritDoc} */ @Override public int[] getSelectedIndices() { ICollectionConnector collectionConnector = getCollectionConnector(); if (collectionConnector != null) { return collectionConnector.getSelectedIndices(); } return null; }
private void bindConnector() { collectionConnector .addConnectorValueChangeListener(new TableConnectorListener()); for (int row = 0; row < collectionConnector.getChildConnectorCount(); row++) { bindChildRowConnector(row); } }
private void checkListenerRegistrationForConnector( ICollectionConnectorListProvider nodeConnector) { for (ICollectionConnector childNodeConnector : nodeConnector .getCollectionConnectors()) { childNodeConnector .addSelectionChangeListener(connectorsSelectionListener); } } }
List originalList = (List) collectionConnector.getConnectorValue(); List targetList = new ArrayList<Object>(originalList); List<Object> elementsToMove = new ArrayList<Object>(); targetList.add(targetIndices[i], elementsToMove.get(i)); ((IEntity) collectionConnector.getParentConnector().getConnectorValue()) .straightSetProperty(collectionConnector.getId(), null); originalList.clear(); originalList.addAll(targetList); ((IEntity) collectionConnector.getParentConnector().getConnectorValue()) .straightSetProperty(collectionConnector.getId(), originalList); context.put(ActionContextConstants.SELECTED_INDICES, ConnectorHelper .getIndicesOf(collectionConnector, elementsToMove));
/** * {@inheritDoc} */ public int getChildCount(Object parent) { if (parent instanceof IValueConnector && ((IValueConnector) parent).getConnectorValue() == null) { return 0; } if (parent instanceof ICollectionConnectorProvider) { ICollectionConnector collectionConnector = ((ICollectionConnectorProvider) parent) .getCollectionConnector(); if (collectionConnector == null || collectionConnector.getConnectorValue() == null) { return 0; } return ((Collection<?>) collectionConnector.getConnectorValue()).size(); } else if (parent instanceof ICollectionConnectorListProvider) { return ((ICollectionConnectorListProvider) parent) .getCollectionConnectors().size(); } return 0; }
private void bindConnector() { collectionConnector .addConnectorValueChangeListener(new ListConnectorListener()); for (int index = 0; index < collectionConnector.getChildConnectorKeys() .size(); index++) { bindChildConnector(index); } }
/** * {@inheritDoc} */ @Override public ModelCollectionPropertyConnector getModelConnector( Map<String, Object> context) { return (ModelCollectionPropertyConnector) ((ICollectionConnector) context .get(ActionContextConstants.SOURCE_VIEW_CONNECTOR)).getModelConnector(); }