Package com.gwtplatform.mvp.client.annotations

Examples of com.gwtplatform.mvp.client.annotations.TabInfo


    Integer tabPriority = null;
    String tabLabel = null;
    TabInfoFunctionDescription tabInfoFunctionDescription = null;
    String tabNameToken = null;
    if (proxyInterface.isAssignableTo(tabContentProxyClass)) {
      TabInfo tabInfoAnnotation = proxyInterface.getAnnotation(TabInfo.class);
      tabInfoFunctionDescription = findTabInfoFunction(
          logger, presenterClass, presenterClassName, ginjectorClassName,
          ginjectorClass);
     
      // Ensure @TabInfo is there exactly once
      if (tabInfoAnnotation != null && tabInfoFunctionDescription != null) {
        logger.log(TreeLogger.ERROR, "Presenter " + presenterClassName
            + " contains both a proxy and a method annotated with @' +"
            + TabInfo.class.getSimpleName() + ". This is illegal.", null);
        throw new UnableToCompleteException();
      }
      if (tabInfoFunctionDescription != null) {
        tabInfoAnnotation = tabInfoFunctionDescription.annotation;
      }     
      if (tabInfoAnnotation == null) {
        logger.log(TreeLogger.ERROR, "The proxy for '" + presenterClassName
            + "' is a TabContentProxy, but is not annotated with @' +"
            + TabInfo.class.getSimpleName()
            + " and its presenter has no method annotated with it either.", null);
        throw new UnableToCompleteException();
      }
     
      // Extract the label if its in TabInfo
      if (tabInfoAnnotation.label().length() > 0) {
        tabLabel = tabInfoAnnotation.label();
      }
      if (tabLabel != null && tabInfoFunctionDescription != null) {
        logger.log(TreeLogger.ERROR, "The @" + TabInfo.class.getSimpleName()
            + " in " + presenterClassName + " defines the 'label' parameter and"
            + " annotates a method, this is not permitted.", null);
        throw new UnableToCompleteException();
      }
      if (tabLabel == null && tabInfoFunctionDescription == null) {
        logger.log(TreeLogger.ERROR, "The @" + TabInfo.class.getSimpleName()
            + " in " + presenterClassName + " does not define the 'label' parameter and"
            + " does not annotate a method, this is not permitted.", null);
        throw new UnableToCompleteException();
      }

      // Extract the label if its in TabInfo (it is a negative integer if not set)
      if (tabInfoAnnotation.priority() >= 0) {
        tabPriority = tabInfoAnnotation.priority();
      }
      if (tabPriority != null &&
          tabInfoFunctionDescription != null && !tabInfoFunctionDescription.returnString) {
        logger.log(TreeLogger.ERROR, "The @" + TabInfo.class.getSimpleName()
            + " in " + presenterClassName + " defines the 'priority' parameter and"
            + " annotates a method returning TabData, this is not permitted.", null);
        throw new UnableToCompleteException();
      }
      if (tabPriority == null &&
          (tabInfoFunctionDescription == null || tabInfoFunctionDescription.returnString)) {
        logger.log(TreeLogger.ERROR, "The @" + TabInfo.class.getSimpleName()
            + " in " + presenterClassName + " does not define the 'priority' parameter and"
            + " does not annotate a method returning TabData, this is not permitted.", null);
        throw new UnableToCompleteException();
      }
     
      // Find the container
      tabContainerClass = oracle.findType(tabInfoAnnotation.container().getCanonicalName());
      if (tabContainerClass == null) {
        logger.log(TreeLogger.ERROR, "The container '"
            + tabInfoAnnotation.container().getCanonicalName()
            + "' in the proxy annotation for '" + presenterClassName
            + "' was not found.", null);
        throw new UnableToCompleteException();
      }
      tabContainerClassName = tabContainerClass.getParameterizedQualifiedSourceName();
     
      // Find the name token to use when the tab is clicked
      if (tabInfoAnnotation.nameToken().length() > 0) {
        tabNameToken = tabInfoAnnotation.nameToken();
      }
      if (tabNameToken != null && nameToken != null) {
        logger.log(TreeLogger.ERROR, "The @" + TabInfo.class.getSimpleName()
            + " in " + presenterClassName + " defines the 'nameToken' parameter but"
            + " its proxy is a place, this is not permitted.", null);
View Full Code Here


      String ginjectorClassName, JClassType ginjectorClass)
      throws UnableToCompleteException {
    // Look for the title function in the parent presenter
    TabInfoFunctionDescription result = null;
    for (JMethod method : presenterClass.getMethods()) {
      TabInfo annotation = method.getAnnotation(TabInfo.class);
      if (annotation != null) {
        if (result != null) {
          logger.log(TreeLogger.ERROR, "At least two methods in presenter "
              + presenterClassName + "are annotated with @"
              + TabInfo.class.getSimpleName() + ". This is illegal.");
View Full Code Here

    @Override
    void initSubclass(JClassType proxyInterface) throws UnableToCompleteException {
        tabInfoMethod = presenterInspector.findTabInfoMethod();

        TabInfo tabInfoAnnotation = proxyInterface.getAnnotation(TabInfo.class);
        ensureExactlyOneTabInfoAnnotation(tabInfoAnnotation);

        tabPriority = null;
        tabLabel = null;
        if (tabInfoMethod == null) {
            findTabPriority(tabInfoAnnotation);
            findTabLabel(tabInfoAnnotation);
            targetNameToken = tabInfoAnnotation.nameToken();
            tabContainerClassName = tabInfoAnnotation.container().getCanonicalName();
        } else {
            targetNameToken = tabInfoMethod.getNameToken();
            tabContainerClassName = tabInfoMethod.getTabContainerClassName();
        }
        ensureNameTokenIsValid();
View Full Code Here

  @Override
  void initSubclass(JClassType proxyInterface) throws UnableToCompleteException {
    tabInfoMethod = presenterInspector.findTabInfoMethod();

    TabInfo tabInfoAnnotation = proxyInterface.getAnnotation(TabInfo.class);
    ensureExactlyOneTabInfoAnnotation(tabInfoAnnotation);

    tabPriority = null;
    tabLabel = null;
    if (tabInfoMethod == null) {
      findTabPriority(tabInfoAnnotation);
      findTabLabel(tabInfoAnnotation);
      targetNameToken = tabInfoAnnotation.nameToken();
      tabContainerClassName = tabInfoAnnotation.container().getCanonicalName();
    } else {
      targetNameToken = tabInfoMethod.getNameToken();
      tabContainerClassName = tabInfoMethod.getTabContainerClassName();
    }
    ensureNameTokenIsValid();
View Full Code Here

    @Override
    void initSubclass(JClassType proxyInterface) throws UnableToCompleteException {
        tabInfoMethod = presenterInspector.findTabInfoMethod();

        TabInfo tabInfoAnnotation = proxyInterface.getAnnotation(TabInfo.class);
        ensureExactlyOneTabInfoAnnotation(tabInfoAnnotation);

        tabPriority = null;
        tabLabel = null;
        if (tabInfoMethod == null) {
            findTabPriority(tabInfoAnnotation);
            findTabLabel(tabInfoAnnotation);
            targetNameToken = tabInfoAnnotation.nameToken();
            tabContainerClassName = tabInfoAnnotation.container().getCanonicalName();
        } else {
            targetNameToken = tabInfoMethod.getNameToken();
            tabContainerClassName = tabInfoMethod.getTabContainerClassName();
        }
        ensureNameTokenIsValid();
View Full Code Here

TOP

Related Classes of com.gwtplatform.mvp.client.annotations.TabInfo

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.