Package org.zeroexchange.model.user

Examples of org.zeroexchange.model.user.User


     */
    private void applyFormData() {
        ConfirmationData confirmationData = confirmationForm.getModelObject();
       
       
        User evaluator = userReader.getUser(authorizedUserService.getCurrentUserId());

        //Create the assessment and remember it in the workflow data

        Resource resource = getResourceModel().getObject();
        resourceAssessor.confirmResourceProvided(
View Full Code Here


            @Override
            public void populateItem(Item<ICellPopulator<CreditLine>> cellItem,
                    String componentId, IModel<CreditLine> rowModel) {
                CreditLine line = rowModel.getObject();
                User debtor = line.getDebtor();
                cellItem.add(new Label(componentId, debtor != null ? debtor.getDisplayName() : "-"));
            }
        });
       
        //Amount
        columns.add(new AbstractColumn<CreditLine, String>(new ResourceModel(MKEY_MAX_AMOUNT)) {
View Full Code Here

            @Override
            public void populateItem(
                    Item<ICellPopulator<CreditPaths>> cellItem,
                    String componentId, IModel<CreditPaths> rowModel) {
                CreditPaths twoPartnersPaths = rowModel.getObject();
                User creditor = twoPartnersPaths.getCreditor();
                cellItem.add(new Label(componentId, creditor == null ? "???" : creditor.getDisplayName()));
            }
        });
       
        //Available amount
        columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_MAX_AMOUNT)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
                    IModel<CreditPaths> rowModel) {
                CreditPaths twoPartnersPaths = rowModel.getObject();
                BigDecimal maxAmount = BigDecimal.ZERO;
                for(CreditPath path: twoPartnersPaths.getPaths()) {
                    maxAmount = maxAmount.add(creditLineReader.getAvailableAmount(path.getPath()));
                }
                cellItem.add(new Label(componentId, maxAmount.toString()));
            }

        });
       
        //Number of paths between two partners
        columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_PATHS_COUNT)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
                    IModel<CreditPaths> rowModel) {
                CreditPaths twoPartnersPaths = rowModel.getObject();
                cellItem.add(new Label(componentId, String.valueOf(twoPartnersPaths.getPaths().size())));
            }
        });
       
        //Amount input column
        columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_AMOUNT)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
                    final IModel<CreditPaths> rowModel) {
                final CreditPaths twoPartnersPathsContainer = rowModel.getObject();
               
                cellItem.add(new AttributeAppender("style", ";width:110px;"));//TODO: constant
                cellItem.add(new AjaxEditorLink<BigDecimal>(componentId,  new Model<BigDecimal>(BigDecimal.ZERO)) {
                    private static final long serialVersionUID = 1L;
                    private NumberTextField<BigDecimal> amountInput;

                    @Override
                    protected boolean onValueSubmit(AjaxRequestTarget target) {
                        BigDecimal newValue = amountInput.getModelObject();
                        boolean success = true;
                        try {
                            rowModel.setObject(
                                    creditLineWriter.roteDebt(twoPartnersPathsContainer, newValue));
                            target.add(creditPathsTable);
                        } catch (DebtRotingException e) {
                            CreditorsPanel.this.error(getString(MKEY_ERROR_DEBT_ROUTNG));
                            target.add(messagesPanel);
                            success = false;
                        }
                        return success;
                    }

                    @Override
                    protected Component getFormControl(String controlId, final IModel<BigDecimal> model) {
                        InputPanel<Void> inputPanel = new InputPanel<Void>(controlId) {
                            private static final long serialVersionUID = 1L;

                            @Override
                            protected Component createControl(String controlId) {
                                amountInput = new NumberTextField<BigDecimal>(controlId, model, BigDecimal.class);
                                amountInput.setOutputMarkupId(true);
                                amountInput.add(new AttributeAppender("style", ";width:80px;"));//TODO: constant
                                return amountInput;
                            }
                        };
                        return inputPanel;
                    }
                   
                });
            }
           
            @Override
            public String getCssClass() {
                return CSSCLASS_AMOUNT_COL;
            }
           
        });
       
        ISortableDataProvider<CreditPaths, String> dataProvider = new ListSortableProvider<CreditPaths>() {
            private static final long serialVersionUID = 1L;

            @Override
            protected List<CreditPaths> getItems() {
                User debtor = authorizedUserService.getCurrentUser();
                Contract contract = (Contract) getDefaultModelObject();
                Contract persistedContract = contractReader.getContract(contract.getId());
                contract = contractReader.getContract(contract.getId());
                Collection<User> creditors = contractInformant.getCreditors(persistedContract);
                return creditPathFinder.findPaths(debtor, creditors, BigDecimal.ZERO);
View Full Code Here

            public void populateItem(Item<ICellPopulator<Contract>> cellItem,
                    String componentId, IModel<Contract> rowModel) {
                String creatorNickName = "";
               
                Contract contract = rowModel.getObject();
                User creator = contract.getOwner();
                if(creator != null) {
                    creatorNickName = creator.getDisplayName();
                }
                cellItem.add(new Label(componentId, creatorNickName));
            }

            @Override
View Full Code Here

                if(contract.getStatus() != ContractStatus.UNCOMPLETED) {
                    return null;
                }

                Integer currentUserId = authorizedUserService.getCurrentUserId();
                User contractOwner = contract.getOwner();
                if(contractOwner == null || currentUserId == null || !currentUserId.equals(contractOwner.getId())) {
                    return null;
                }
               
                return new AjaxLinkPanel(componentId, new ResourceModel(MKEY_CONTRACT_REMOVE)) {
                    private static final long serialVersionUID = 1L;
View Full Code Here

            if(getSort() != null) {
                sortDescriptor = new SortDescriptor(
                        getSort().getProperty(), getSort().isAscending(), localeService.getCurrentLanguage());
            }
            ContractFilter contractFilter = null;
            User currentUser = authorizedUserService.getCurrentUser();
            if(filter != null) {
                Collection<User> includedUsers = filter.isUserContractsOnly() ? Collections.singleton(currentUser) : null;
                contractFilter = new ContractFilter(filter.getSearchQuery(), includedUsers, null);
            }
            SlicingDataSet<Contract> dataSet =  contractReader.getAvailableContracts(
View Full Code Here

        add(new Label(CKEY_LOGIN_INFO, new LoadableDetachableModel<String>() {
            private static final long serialVersionUID = 1L;

            @Override
            protected String load() {
                User user = authorizedUserService.getCurrentUser();
                String userName = user == null ? null : user.getDisplayName();
                if(userName == null) {
                    userName = authorizedUserService.getCurrentUserName();
                }
                return getString(MKEY_LOGIN_INFO, new Model<PipedMap<String, String>>(
                        new PipedMap<String, String>().putObject("displayName", userName)));
            }
        }).setEscapeModelStrings(false));

        // New messages info panel
        newMessagesLabel = new PageLinkPanel(CKEY_NEW_MESSAGES_INFO, UserMaintenance.class, new StringResourceModel(MKEY_NEW_MESSAGES_INFO, null) {
            /** */
            private static final long serialVersionUID = 1L;
            private Object[] parameters = new Object[1];

            @Override
            protected Object[] getParameters() {
                parameters[0] = unreadMessagesCount;
                return parameters;
            }
        }, new PageParameters().add(UserMaintenance.PKEY_TAB, UserMaintenance.TABALIAS_USER_MESSAGES));
        add(newMessagesLabel);
        updateUnreadMessagesCount();
       


        add(new Label(CKEY_USER_BALANCE, new Model<String>() {
            /** */
            private static final long serialVersionUID = 1L;

            @Override
            public String getObject() {
                User user = authorizedUserService.getCurrentUser();
                return moneyManager.getAvailableAmount(moneyManager.getDefaultCurrency(), user).toString();
            }
           
        }));
        add(new Label(CKEY_USER_ALLOWED_DEBT, new Model<String>() {
            private static final long serialVersionUID = 1L;

            @Override
            public String getObject() {
                User user = authorizedUserService.getCurrentUser();
                return moneyManager.getAllowedDebt(moneyManager.getDefaultCurrency(), user).toString();
            }
           
        }));
        add(new Label(CKEY_USER_REPUTATION, new Model<String>() {
            private static final long serialVersionUID = 1L;

            @Override
            public String getObject() {
                User user = authorizedUserService.getCurrentUser();
                return reputationReader.getUserReputation(user).toString();
            }
           
        }));
                                   
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected void updateUser(ProfileData userData)
            throws BusinessLogicException {
        final User user = userFactory.createNewUser();
        user.setDisplayName(userData.getDisplayName());
        user.setEmail(userData.getEmail());
        user.setLocation(userData.getLocation());
        LocalCredential localCredential = new LocalCredential();
        localCredential.setName(((RegistrationData)userData).getName());
        localCredential.setPassword(userData.getPassword());
        User savedUser = userWriter.createUser(user);
        credentialWriter.addCredential(savedUser, localCredential);
    }
View Full Code Here

            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<User>> cellItem,
                    String componentId, IModel<User> rowModel) {
                User user = rowModel.getObject();
                cellItem.add(new Label(componentId, user.getDisplayName()));
            }
        });
       
        //View profile link
        columns.add(new AbstractColumn<User, String>(new Model<String>("")) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<User>> cellItem,
                    String componentId, IModel<User> rowModel) {
                final User user = rowModel.getObject();
                cellItem.add(new PageLinkPanel(componentId, ViewUserProfile.class, new ResourceModel(MKEY_VIEW_PROFILE),
                        new PageParameters().add(ViewUserProfile.PKEY_USER_ID, user.getId())));
            }

            @Override
            public String getCssClass() {
                return CSSCLASS_SELECT;
View Full Code Here

    /**
     * Initializes the UI
     */
    private void initUI() {
       
        User user = authorizedUserService.getCurrentUser();
       
        //User credit amount
        BigDecimal creditAmount = moneyManager.getAvailableAmount(
                moneyManager.getDefaultCurrency(), user);
        add(new Label(CKEY_CREDIT_LABEL, creditAmount != null ? creditAmount.toString() : ""));
View Full Code Here

TOP

Related Classes of org.zeroexchange.model.user.User

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.