Package wicket.markup.html.link

Examples of wicket.markup.html.link.Link


          .getPropertyConfig();
      final App app = viewContext.getApp();

      if (baseEntityPropertyConfig.isReference()
          && !baseEntityPropertyConfig.isRequired()) {
        emptyLink = new Link("emptyLink") {
          static final long serialVersionUID = 200861L;
          public void onClick() {
            ModelContext entityEditFormPageModelContext = new ModelContext(
                modelContext);
            IEntity afterUpdateEntity = entityEditFormPageModelContext
View Full Code Here


      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      App app = viewContext.getApp();

      Link homePageLink = new PageLink("home", app.getHomePage());
      homePageLink.setAutoEnable(true);
      add(homePageLink);

      Link contextLink;
      final Page contextPage = viewContext.getContextPage();
      if (contextPage == null) {
        contextLink = new PageLink("context", app.getHomePage());
      } else {
        contextLink = new Link("context") {
          static final long serialVersionUID = 201081L;
          public void onClick() {
            setResponsePage(contextPage);
          }
        };
      }
      contextLink.setAutoEnable(true);
      add(contextLink);

      ModelConfig modelConfig = modelContext.getDomainModel()
          .getModelConfig();
      String modelKey = modelConfig.getCode();
View Full Code Here

      final Integer currentPageBlock = new Integer(getCurrentPage());

      final ModelContext entityModelContext = new ModelContext(
          modelContext);
      entityModelContext.setEntity(entity);
      Link copyLink = new Link("copy") {
        static final long serialVersionUID = 200741L;

        public void onClick() {
          getAppSession().getClipboard().setEntity(entity);
          ViewContext entityCopyPageContext = new ViewContext(
              viewContext);
          entityCopyPageContext.setPageBlock(currentPageBlock);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage", entityModelContext,
              entityCopyPageContext));
        }
      };
      item.add(copyLink);

      final ViewContext entityUpdatePageContext = new ViewContext(
          viewContext);
      entityUpdatePageContext.setPageBlock(currentPageBlock);
      Link editLink = new PageLink("edit", new IPageLink() {
        static final long serialVersionUID = 200742L;

        public Page getPage() {
          return app.getViewMeta().getPage("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }

        public Class getPageIdentity() {
          return app.getViewMeta().getPageClass("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }
      });
      item.add(editLink);

      final ViewContext entityRemovePageContext = new ViewContext(
          viewContext);
      entityRemovePageContext.setPageBlock(currentPageBlock);
      item.add(new Link("remove") {
        static final long serialVersionUID = 200743L;

        public void onClick() {
          try {
            if (app.isConceptUpdateAllowed(
                getAppSession(), conceptConfig, entity, "remove")) {
              entities.getErrors().empty();
              if (app.getModelConfig().isConfirmRemove()) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityConfirmRemovePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else if (entities.remove(entity)) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityUpdateTablePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else {
                addDmLiteErrorKeys(entities);
              }
            } else {
              String error = getLocalizer().getString(
                  "entities.config.remove", this);
              error(error);
            }
          } catch (DmException e) {
            log.error("Error in EntityUpdateTableListView: "
                + modelContext.getEntitiesCode() + " - "
                + e.getMessage());
          }
        }
      });

      // Neighbor update links
      List<NeighborNameLabelLinkPair> neighborNameLabelLinkPairs = new ArrayList<NeighborNameLabelLinkPair>();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")
            && neighborConfig.isInternal()) {
          NeighborNameLabelLinkPair neighborNameLabelLinkPair = new NeighborNameLabelLinkPair();
          String conceptCode = conceptConfig.getCode();
          String neighborKey = conceptCode + "."
              + neighborConfig.getCode();
          String neighborName = getLocalizer().getString(neighborKey,
              this);
          Label neighborNameLabel = new Label("neighborName",
              neighborName);
          neighborNameLabelLinkPair
              .setNeighborNameLabel(neighborNameLabel);
          Link neighborLink = null;
          IDomainModel domainModel = app.getDomainModel();
          final IOrderedEntities neighborEntities = (IOrderedEntities) domainModel
              .getModelMeta().getNeighborEntities(entity,
                  neighborConfig.getCode());

          final ModelContext neighborModelContext = new ModelContext(
              modelContext);
          neighborModelContext.setContextEntities(entities);
          neighborModelContext.setContextEntity(entity);
          neighborModelContext.setEntities(neighborEntities);
          final ViewContext neighborViewContext = new ViewContext(
              viewContext);
          neighborViewContext.setPageBlock(new Integer(0));

          neighborLink = new PageLink("neighbor", new IPageLink() {
            static final long serialVersionUID = 200744L;

            public Page getPage() {
              return app.getViewMeta().getPage(
                  "EntityUpdateTablePage",
                  neighborModelContext, neighborViewContext);
            }

            public Class getPageIdentity() {
              return app.getViewMeta().getPageClass(
                  "EntityUpdateTablePage",
                  neighborModelContext, neighborViewContext);
            }
          });
          if (!app.isNeighborDisplayAllowed(getAppSession(),
              neighborConfig)) {
            neighborLink.setVisible(false);
          } else if (!app.isNeighborUpdateAllowed(getAppSession(),
              neighborConfig)) {
            neighborLink.setVisible(false);
         

          neighborNameLabelLinkPair.setNeighborLink(neighborLink);
          neighborNameLabelLinkPairs.add(neighborNameLabelLinkPair);
        }
View Full Code Here

      ModelContext entryModelContext = new ModelContext(modelContext);
      ViewContext entryViewContext = new ViewContext(viewContext);
      EntityDisplayPage entryPage = new EntityDisplayPage(
          entryModelContext, entryViewContext);
      Link moreLink = new PageLink("moreLink", entryPage);
      if (completeText) {
        moreLink.setVisible(false);
      }
      add(moreLink);
    } catch (Exception e) {
      log.error("Error in EntryDigestPanel: " + e.getMessage());
    }
View Full Code Here

  public HomePageMenuPanel(final String wicketId) {
    super(wicketId);
    try {
      final App app = (App) getApplication();

      Link homePageLink = new PageLink("home", app.getHomePage());
      homePageLink.setAutoEnable(true);
      add(homePageLink);

      Link loginLink = new PageLink("login", LoginPage.class);
      add(loginLink);
      Link logoutLink = new Link("logout") {
        static final long serialVersionUID = 200971L;

        public void onClick() {
          getAppSession().invalidate();
          setResponsePage(app.getViewMeta().getHomePageClass());
        }
      };
      add(logoutLink);
      if (getAppSession().isMemberLoggedIn()) {
        loginLink.setVisible(false);
      } else {
        logoutLink.setVisible(false);
      }
      if (!app.getModelConfig().isLogin()) {
        loginLink.setVisible(false);
      }

      if (app.getModelConfig().isI18n()) {
        ModelContext countryLanguageModelContext = new ModelContext();
        countryLanguageModelContext
            .setDomainModel(app.getDomainModel());
        CountryLanguages countryLanguages = (CountryLanguages) app
            .getEntry("CountryLanguages");
        countryLanguageModelContext.setEntities(countryLanguages);

        String languageCode = null;
        CountryLanguage defaultCountryLanguage = null;
        languageCode = getSession().getLocale().getLanguage();
        defaultCountryLanguage = (CountryLanguage) countryLanguages
            .retrieveByCode(languageCode);
        countryLanguageModelContext.setEntity(defaultCountryLanguage);
        ViewContext countryLanguageViewContext = new ViewContext();
        countryLanguageViewContext.setApp(app);
        countryLanguageViewContext.setPage(app.getViewMeta()
            .getHomePage());
        countryLanguageViewContext
            .setWicketId("countryLanguageChoicePanel");
        CountryLanguageChoicePanel countryLanguageChoicePanel = new CountryLanguageChoicePanel(
            countryLanguageModelContext, countryLanguageViewContext);
        add(countryLanguageChoicePanel);
      } else {
        Panel panel = new Panel("countryLanguageChoicePanel");
        add(panel);
        panel.setVisible(false);
      }

      ModelContext dmLiteEntryPageModelContext = new ModelContext();
      dmLiteEntryPageModelContext.setDomainModel(app.getDomainModel());

      ViewContext dmLiteEntryPageViewContext = new ViewContext();
      dmLiteEntryPageViewContext.setApp(app);

      WebPage dmLiteEntryPage = new DmLiteEntryPage(
          dmLiteEntryPageModelContext, dmLiteEntryPageViewContext);
      Link dmLiteEntryLink = new PageLink("dmLiteEntry", dmLiteEntryPage);
      add(dmLiteEntryLink);

      ModelConfig modelConfig = app.getDomainModel().getModelConfig();
      String modelKey = modelConfig.getCode();
      String modelName = getLocalizer().getString(modelKey, this);
View Full Code Here

      PropertyConfig baseEntityPropertyConfig = modelContext
          .getPropertyConfig();
      final App app = viewContext.getApp();

      if (baseEntityPropertyConfig.isReference()) {
        lookupLink = new Link("lookupLink") {
          static final long serialVersionUID = 200871L;
          public void onClick() {
            ModelContext lookupModelContext = new ModelContext(
                modelContext);
            ViewContext lookupViewContext = new ViewContext(
View Full Code Here

          "neighborEmptyNameLabelListViewTail",
          childInternalNeighborNames));

      final Integer currentBlock = new Integer(entityUpdateTableListView
          .getCurrentPage());
      Link addLink = new Link("add") {
        static final long serialVersionUID = 200761L;

        public void onClick() {
          if (app.isConceptUpdateAllowed(getAppSession(),
              conceptConfig, null, "add")) {
            ModelContext entityAddFormPageModelContext = new ModelContext(
                modelContext);
            entityAddFormPageModelContext.setEntity(null);
            ViewContext entityAddPageContext = new ViewContext(
                viewContext);
            entityAddPageContext.setPageBlock(currentBlock);
            setResponsePage(app.getViewMeta().getPage(
                "EntityAddFormPage",
                entityAddFormPageModelContext,
                entityAddPageContext));
          } else {
            String error = getLocalizer().getString(
                "entities.config.add", this);
            error(error);
          }
        }
      };
      add(addLink);

      final IEntity clipboardEntity = getAppSession().getClipboard()
          .getEntity();
      Link pasteLink = new Link("paste") {
        static final long serialVersionUID = 200762L;

        public void onClick() {
          try {
            if (clipboardEntity != null) {
              if (app.isConceptUpdateAllowed(getAppSession(),
                  conceptConfig, clipboardEntity, "add")
                  && clipboardEntity.getConceptConfig() == entities
                      .getConceptConfig()) {
                if (entities.add(clipboardEntity)) {
                  ViewContext entityUpdateTablePageContext = new ViewContext(
                      viewContext);
                  entityUpdateTablePageContext
                      .setPageBlock(currentBlock);
                  setResponsePage(app.getViewMeta().getPage(
                      "EntityUpdateTablePage",
                      modelContext,
                      entityUpdateTablePageContext));
                } else {
                  addDmLiteErrorKeys(entities);
                }
              } else {
                String error = getLocalizer().getString(
                    "entities.config.add", this);
                error(error);
              }
            }
          } catch (DmException e) {
            log
                .error("Problem with pasting entity in EntityUpdateTablePanel: "
                    + e.getMessage());
          }
        }
      };
      if (clipboardEntity == null) {
        pasteLink.setVisible(false);
      }
      add(pasteLink);
    } catch (Exception e) {
      log.error("Error in EntityUpdateTablePanel: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
View Full Code Here

TOP

Related Classes of wicket.markup.html.link.Link

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.