io.overcoded.grid.annotation.GridContextMenuItem Maven / Gradle / Ivy
Show all versions of grid-annotation Show documentation
package io.overcoded.grid.annotation;
import java.lang.annotation.*;
import static io.overcoded.grid.annotation.GridMethod.*;
import static io.overcoded.grid.annotation.GridMethod.D;
/**
* You can put it on a type annotated with GridDialog or GridView.
* With this element you can generate custom context menu items
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(GridContextMenuItems.class)
public @interface GridContextMenuItem {
/**
* Defines the icon in the context menu
* must be upper case and valid VaadinIcon
*
* @return string
*/
String icon();
/**
* defines the label of the context menu item
*
* @return string
*/
String label();
/**
* Optional components which should be displayed in the dialog. Only the first element will be used!
* If the class is a Dialog, this dialog will be displayed and target will be ignored.
* If the class is a Component, a simple dialog will be used to display this value and target also will be ignored
* Other cases this will be ignored.
* @return class which should be used as layout (in case of Vaadin this class should extend Component)
*/
Class>[] components() default {};
/**
* Format string which will be used as
* base of the generated url based on context
*/
String urlFormatter() default "";
/**
* Describes the arguments which should be used in urlFormatter to resolve the final url
*
* As our grid project designed to use with Spring Boot, Hibernate and Vaadin,
* AnchorContextMenuItem designed to use with SPeL.
* If an element starts with ', that means that should be handled as string
* otherwise refers to a variable, which should handled by SPeL.
*
* @return display value array
*/
String[] args() default {};
/**
* Defines where to open the final generated link. By default, this opens the link in a dialog.
*
* @return the target (default: DIALOG)
*/
GridAnchorTarget target() default GridAnchorTarget.DIALOG;
/**
* if we want to organize context menu entries on grid and group the entries
* we can use this by specifying the name of the group
*
* @return string
*/
String menuGroup() default "";
/**
* if we want to configure icon for the menu group, where this dialog belongs,
* we can use this
*
* @return string
*/
String groupIcon() default "COG";
}