/** * Delegates to the frontend controller. * <p> * {@inheritDoc} */ @Override public void registerCommand(RemoteCommand command) { ((IRemoteCommandHandler) getFrontendController()).registerCommand(command); }
/** * Registers a command for remote execution. * * @param command * the command to register. * @param context * the action context. */ protected void registerCommand(RemoteCommand command, Map<String, Object> context) { ((IRemoteCommandHandler) getController(context)).registerCommand(command); } }
private void createAndRegisterRemoveChildrenCommand(RemoteCompositeValueState parentState, List<RemoteValueState> removedChildren) { RemoteChildrenCommand parentRemoveCommand = new RemoteChildrenCommand(); parentRemoveCommand.setTargetPeerGuid(parentState.getGuid()); parentRemoveCommand.setRemove(true); String[] removedChildrenGuids = new String[removedChildren.size()]; for (int i = 0; i < removedChildren.size(); i++) { removedChildrenGuids[i] = removedChildren.get(i).getGuid(); } parentRemoveCommand.setRemovedChildrenGuids(removedChildrenGuids); remoteCommandHandler.registerCommand(parentRemoveCommand); }
/** * Add repeated sections. * * @param repeater * the repeater * @param extraSections * the extra sections */ protected void addRepeatedSections(RComponent repeater, List<RComponent> extraSections) { RemoteAddRepeatedCommand addRepeatedCommand = new RemoteAddRepeatedCommand(); addRepeatedCommand.setTargetPeerGuid(repeater.getGuid()); addRepeatedCommand.setNewSections(extraSections.toArray(new RComponent[extraSections.size()])); getRemoteCommandHandler().registerCommand(addRepeatedCommand); }
/** * {@inheritDoc} */ @Override public void edit(RComponent component) { RemoteEditCommand editCommand = new RemoteEditCommand(); editCommand.setTargetPeerGuid(component.getGuid()); getRemoteCommandHandler().registerCommand(editCommand); }
/** * {@inheritDoc} */ @Override public void focus(RComponent component) { RemoteFocusCommand focusCommand = new RemoteFocusCommand(); focusCommand.setTargetPeerGuid(component.getGuid()); getRemoteCommandHandler().registerCommand(focusCommand); }
/** * {@inheritDoc} */ @Override public void setActionEnabled(RAction action, boolean enabled) { action.setEnabled(enabled); RemoteEnablementCommand command = new RemoteEnablementCommand(); command.setTargetPeerGuid(action.getGuid()); command.setEnabled(action.isEnabled()); remoteCommandHandler.registerCommand(command); }
/** * {@inheritDoc} */ @Override protected void showCardInPanel(RComponent cardsPeer, String cardName) { RemoteValueState cardState = cardsPeer.getState(); cardState.setValue(cardName); RemoteValueCommand command = new RemoteValueCommand(); command.setTargetPeerGuid(cardState.getGuid()); command.setValue(cardState.getValue()); getRemoteCommandHandler().registerCommand(command); }
/** * {@inheritDoc} */ @Override protected void selectChildViewIndex(RComponent viewComponent, int index) { if (viewComponent instanceof RTabContainer) { RTabContainer rTab = ((RTabContainer) viewComponent); if (rTab.getSelectedIndex() != index) { rTab.setSelectedIndex(index); RemoteSelectionCommand selectionCommand = new RemoteSelectionCommand(); selectionCommand.setTargetPeerGuid(rTab.getGuid()); selectionCommand.setLeadingIndex(rTab.translateExcludingHiddenChildren(index)); getRemoteCommandHandler().registerCommand(selectionCommand); } } }
@Override public void valueChange(ValueChangeEvent evt) { IValueConnector connector = (IValueConnector) evt.getSource(); if (!isRecycling(connector)) { RemoteFormattedValueState state = (RemoteFormattedValueState) ((IRemoteStateOwner) connector).getState(); RemoteValueCommand command = new RemoteValueCommand(); command.setTargetPeerGuid(state.getGuid()); command.setValue(state.getValue()); command.setValueAsObject(state.getValueAsObject()); remoteCommandHandler.registerCommand(command); } } };
@Override public void valueChange(ValueChangeEvent evt) { IValueConnector connector = (IValueConnector) evt.getSource(); // if (connector.getParentConnector() instanceof IRenderableCompositeValueConnector // && ((IRenderableCompositeValueConnector) connector // .getParentConnector()).getRenderingConnector() == connector) { // // don't listen to rendering connectors. // connector.removeValueChangeListener(this); // } else if (connector.getParentConnector() == null) { // // don't listen to root connectors. // connector.removeValueChangeListener(this); // } else { if (!isRecycling(connector)) { RemoteValueState state = ((IRemoteStateOwner) connector).getState(); RemoteValueCommand command = new RemoteValueCommand(); command.setTargetPeerGuid(state.getGuid()); command.setValue(state.getValue()); remoteCommandHandler.registerCommand(command); } // } } };
/** * {@inheritDoc} */ @Override protected void selectChildViewIndex(RComponent viewComponent, int index) { if (viewComponent instanceof RTabContainer) { RTabContainer rTab = ((RTabContainer) viewComponent); if (rTab.getSelectedIndex() != index) { rTab.setSelectedIndex(index); RemoteSelectionCommand selectionCommand = new RemoteSelectionCommand(); selectionCommand.setTargetPeerGuid(rTab.getGuid()); selectionCommand.setLeadingIndex(rTab.translateExcludingHiddenChildren(index)); getRemoteCommandHandler().registerCommand(selectionCommand); } } }
remoteCommandHandler.registerCommand(parentCommand); command.setChildren(null); remoteCommandHandler.registerCommand(command);
/** * {@inheritDoc} */ @Override protected void addCard(IMapView<RComponent> cardView, IView<RComponent> card, String cardName) { cardView.addToChildrenMap(cardName, card); RCardContainer cardContainer = (RCardContainer) cardView.getPeer(); RComponent[] newCards = new RComponent[cardContainer.getCards().length + 1]; System.arraycopy(cardContainer.getCards(), 0, newCards, 0, cardContainer.getCards().length); newCards[newCards.length - 1] = card.getPeer(); cardContainer.setCards(newCards); String[] newCardNames = new String[cardContainer.getCardNames().length + 1]; System.arraycopy(cardContainer.getCardNames(), 0, newCardNames, 0, cardContainer.getCardNames().length); newCardNames[newCardNames.length - 1] = cardName; cardContainer.setCardNames(newCardNames); RemoteAddCardCommand command = new RemoteAddCardCommand(); command.setTargetPeerGuid(cardContainer.getGuid()); command.setCard(card.getPeer()); command.setCardName(cardName); getRemoteCommandHandler().registerCommand(command); }
@Override public void valueChange(ValueChangeEvent evt) { IRenderableCompositeValueConnector connector = (IRenderableCompositeValueConnector) ((IValueConnector) evt .getSource()).getParentConnector(); if (!isRecycling(connector)) { RemoteCompositeValueState state = (RemoteCompositeValueState) ((IRemoteStateOwner) connector).getState(); RemoteValueCommand command = new RemoteValueCommand(); command.setTargetPeerGuid(state.getGuid()); command.setValue(state.getValue()); command.setDescription(state.getDescription()); command.setIconImageUrl(state.getIconImageUrl()); remoteCommandHandler.registerCommand(command); } } };
command.setTargetPeerGuid(state.getGuid()); command.setReadable(state.isReadable()); remoteCommandHandler.registerCommand(command);
command.setTargetPeerGuid(state.getGuid()); command.setWritable(state.isWritable()); remoteCommandHandler.registerCommand(command);
parentCommand.setLeadingIndex(parentState.getLeadingIndex()); parentCommand.setSelectedIndices(parentState.getSelectedIndices()); remoteCommandHandler.registerCommand(parentCommand); } else { RemoteCompositeValueState compositeValueState = ((RemoteCompositeValueState) ((IRemoteStateOwner) connector) command.setLeadingIndex(compositeValueState.getLeadingIndex()); command.setSelectedIndices(compositeValueState.getSelectedIndices()); remoteCommandHandler.registerCommand(command);