View Javadoc
1   /**
2    * This file Copyright (c) 2015-2018 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.blossom.annotation;
35  
36  import java.lang.annotation.ElementType;
37  import java.lang.annotation.Retention;
38  import java.lang.annotation.RetentionPolicy;
39  import java.lang.annotation.Target;
40  
41  /**
42   * Declares a method to be called after creation of a dialog. By default the method is called after all @TabFactory
43   * annotated methods in the same class have been called, or after all subclasses have had their tab factories called.
44   * The method can declare arguments of types:
45   * <ul>
46   * <li>{@link info.magnolia.ui.dialog.config.DialogBuilder}
47   * <li>{@link info.magnolia.ui.dialog.definition.ConfiguredDialogDefinition}
48   * <li>{@link info.magnolia.ui.dialog.definition.ConfiguredFormDialogDefinition}
49   * <li>{@link info.magnolia.module.blossom.dialog.DialogCreationContext}
50   * <li>{@link javax.jcr.Node}
51   * <li>{@link com.vaadin.data.Item}
52   * <li>{@link info.magnolia.ui.framework.config.UiConfig}
53   * <li>info.magnolia.dam.app.ui.config.DamConfig or info.magnolia.dam.asset.config.DamConfig
54   * <li>{@link info.magnolia.context.WebContext}
55   * <li>{@link info.magnolia.context.Context}
56   * <li>{@link info.magnolia.cms.security.User}
57   * <li>{@link info.magnolia.cms.security.MgnlUser}
58   * </ul>
59   *
60   * For example:
61   * <pre>
62   * &#064;PostCreate
63   * public void postCreate(DialogBuilder dialog) {
64   * }
65   * </pre>
66   *
67   * @see info.magnolia.module.blossom.annotation.Area
68   * @see info.magnolia.module.blossom.annotation.Template
69   * @see info.magnolia.module.blossom.annotation.DialogFactory
70   * @since 3.0.5
71   */
72  @Retention(RetentionPolicy.RUNTIME)
73  @Target(ElementType.METHOD)
74  public @interface PostCreate {
75  
76      /**
77       * Defines phases in which dialog post create callbacks can be called.
78       *
79       * @since 3.0.5
80       */
81      public enum Phase {
82  
83          /**
84           * The method is called after all &#64;TabFactory methods in the same class have been called.
85           */
86          AFTER_TAB_FACTORIES_IN_SAME_CLASS,
87  
88          /**
89           * The method is called after all subclasses have added tabs to the dialogs.
90           */
91          AFTER_SUB_CLASSES
92      }
93  
94      /**
95       * Specifies in which phase the method is called. The default is {@link PostCreate.Phase#AFTER_TAB_FACTORIES_IN_SAME_CLASS}.
96       */
97      Phase value() default Phase.AFTER_TAB_FACTORIES_IN_SAME_CLASS;
98  }