/** * Creates a remote card container. * * @param viewDescriptor * the card view descriptor. * @return the created remote component. */ protected RCardContainer createRCardContainer(ICardViewDescriptor viewDescriptor) { RCardContainer cardContainer = new RCardContainer(getGuidGenerator().generateGUID()); return cardContainer; }
/** * {@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); }
/** * {@inheritDoc} */ @Override protected IView<RComponent> createCardView(ICardViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { RCardContainer viewComponent = createRCardContainer(viewDescriptor); viewComponent.setState(((IRemoteValueStateFactory) getConnectorFactory()) .createRemoteValueState(getGuidGenerator().generateGUID(), viewDescriptor.getPermId())); List<String> cardNames = new ArrayList<>(); List<RComponent> cards = new ArrayList<>(); cardNames.add(ICardViewDescriptor.DEFAULT_CARD); cards.add(createEmptyComponent()); cardNames.add(ICardViewDescriptor.SECURITY_CARD); cards.add(createSecurityComponent()); BasicMapView<RComponent> view = constructMapView(viewComponent, viewDescriptor); viewComponent.setCardNames(cardNames.toArray(new String[cardNames.size()])); viewComponent.setCards(cards.toArray(new RComponent[cards.size()])); view.setConnector(createCardViewConnector(view, actionHandler, locale)); return view; }