Package org.zeroexchange.web.components.toolbar

Examples of org.zeroexchange.web.components.toolbar.ToolbarItem


        Contract contract = (Contract) getDefaultModelObject();
       
        //'Add resource' link
        if(authorizedUserService.isUserLogged() &&
                contractStatusInformant.isContractModificationAllowed(contract)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new LinkPanel(componentId, new ResourceModel(MKEY_ADD_RESOURCE)) {
View Full Code Here


        ListView<ToolbarItem> toolbar = new ListView<ToolbarItem>(componentId, itemsModel) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void populateItem(ListItem<ToolbarItem> item) {
                ToolbarItem toolbarItem = item.getModelObject();
                toolbarItem.onAttach(item);
                item.add(toolbarItem.getComponent(CKEY_TOOLBAR_ITEM));
            }
           
        };
        toolbar.setOutputMarkupId(true);
        return toolbar;
View Full Code Here


        //'Remove Contract' item
        if(contract.getStatus() == ContractStatus.UNCOMPLETED &&
                currentUserId != null && contract.getOwner() != null && contract.getOwner().getId().equals(currentUserId)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new LinkPanel(componentId, new ResourceModel(MKEY_CONTRACT_REMOVE)) {
                        private static final long serialVersionUID = 1L;
                        @Override
                        protected void onClick() {
                            //delete the current contract
                            Contract contract = getContract();
                            contractRemover.remove(contract.getId());
                           
                            //Go to contracts list.
                            setResponsePage(Collaboration.class);
                        }
                    };
                }
            });
        }

        //'Accept Contract' item
        if(contract.getStatus() == ContractStatus.READY &&
                contractStatusInformant.getContractStatus(contract, currentUserId) != ContractStatus.ACCEPTED &&
                !isUserDebtExceeded() &&
                contractInformant.isUserEffective(contract, currentUserId)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new AjaxLinkPanel<Void>(componentId, new ResourceModel(MKEY_CONTRACT_ACCEPT)) {
                        private static final long serialVersionUID = 1L;
                        @Override
                        protected void onClick(AjaxRequestTarget target) {
                            //Mark the current contract as accepted
                           
                            Contract contract = getContract();
                            contract = contractWriter.accept(
                                    authorizedUserService.getCurrentUser(),
                                    contract);

                            eventsDispatcher.publishEvent(new ContractAccepted(contract,
                                    authorizedUserService.getCurrentUser()));

                            if(target != null) {
                                target.add(toolbar.getParent());
                                target.add(statusSign);
                            }
                        }
                   };
                }
            });
        }
       
        //'Cancel Acceptance' item
        if(contractPermissionsInformant.isContractCancelAcceptanceAllowed(
                contract)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new AjaxLinkPanel<Void>(componentId, new ResourceModel(MKEY_CONTRACT_CANCEL_ACCEPT)) {
View Full Code Here

    @Override
    protected List<ToolbarItem> getToolbarItems() {
        List<ToolbarItem> items = super.getToolbarItems();
       
        // 'Delete' action
        items.add(new ToolbarItem() {
           
            private static final long serialVersionUID = 1L;

            @Override
            public Component getComponent(String componentId) {
View Full Code Here

    @Override
    protected List<ToolbarItem> getToolbarItems() {
        List<ToolbarItem> items = super.getToolbarItems();

        // 'Send message' action
        items.add(new ToolbarItem() {
            private static final long serialVersionUID = 1L;

            @Override
            public Component getComponent(String componentId) {
                return new SubmitLinkPanel(
View Full Code Here

        Integer currentUserId = authorizedUserService.getCurrentUserId();
        User resourceOwner = resource.getOwner();
        if(tender.getAcceptDate() == null &&
                resourceOwner != null && currentUserId != null && currentUserId.equals(resourceOwner.getId())
                && !resourceInformant.isAcceptedTendersCountExceeded(resource, tender.getClass())) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new LinkPanel(componentId,
                            new ResourceModel(MKEY_ACCEPT_TENDER)) {
                        private static final long serialVersionUID = 1L;
                        @Override
                        protected void onClick() {
                            if(getTenderType() == TenderType.NEED) {
                                needManager.acceptTender((Need) tender);
                            } else {
                                supplyManager.acceptTender((Supply) tender);
                            }
                            eventsDispatcher.publishEvent(new TenderChanged(
                                    tender.getResource().getContract(), tender, TenderOperation.ACCEPTED));
                            goBack();
                        }
                    };
                }
               
            });
        }
       
        //'Decline' action
        if(contractPermissionsInformant.isTenderDeclineEnabled(tender)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new LinkPanel(componentId,
View Full Code Here


    @Override
    protected List<ToolbarItem> getToolbarItems() {
        List<ToolbarItem> items = super.getToolbarItems();
        items.add(new ToolbarItem() {
            private static final long serialVersionUID = 1L;

            @Override
            public Component getComponent(String toolbarItemId) {
                return new LinkPanel(toolbarItemId, new ResourceModel(MKEY_BACK)) {
View Full Code Here

        toolbar = new ListView<ToolbarItem>(CKEY_TOOLBAR_GROUPS, itemsModel) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void populateItem(ListItem<ToolbarItem> item) {
                ToolbarItem toolbarItem = item.getModelObject();
                toolbarItem.onAttach(item);
                item.add(toolbarItem.getComponent(CKEY_TOOLBAR_ITEM));
            }
           
        };
       
        toolbarContainer = new MarkupContainer(CKEY_TOOLBAR_CONTAINER) {
View Full Code Here

       
        //'Invite participants' item
        Contract persistedContract = contractReader.getContract(contract.getId());
        if(contract.getStatus() == ContractStatus.UNCOMPLETED &&
                contractInformant.isUserEffective(persistedContract, currentUserId)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new PageLinkPanel(componentId, UserSelection.class, new ResourceModel(MKEY_INVITE),
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected List<ToolbarItem> getToolbarItems() {
        List<ToolbarItem> items = super.getToolbarItems();
        items.add(new ToolbarItem() {
            private static final long serialVersionUID = 1L;

            @Override
            public Component getComponent(String toolbarItemId) {
                return new PageLinkPanel(toolbarItemId, EditSkill.class, new ResourceModel(MKEY_ADD_SKILL));
View Full Code Here

TOP

Related Classes of org.zeroexchange.web.components.toolbar.ToolbarItem

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.