Package org.javlo.component.form
Class SmartGenericForm
- java.lang.Object
-
- org.javlo.component.core.AbstractVisualComponent
-
- org.javlo.component.form.SmartGenericForm
-
- All Implemented Interfaces:
Comparable<IContentVisualComponent>,IAction,IEventRegistration,IContentVisualComponent,IDataContainer,IRestItem
- Direct Known Subclasses:
GenericQuiz,SurveyGenericForm
public class SmartGenericForm extends AbstractVisualComponent implements IAction, IEventRegistration, IDataContainer
-
-
Field Summary
Fields Modifier and Type Field Description static StringFOLDERprotected static ObjectLOCK_ACCESS_FILEstatic StringRECAPTCHAKEYstatic StringRECAPTCHASECRETKEYstatic StringTYPE-
Fields inherited from class org.javlo.component.core.AbstractVisualComponent
CACHE_KEY_SUFFIX_PARAM_NAME, COMPONENT_KEY, config, EDIT_CLASS, FLUID_COL_SIZE, FORCE_COMPONENT_ID, HIDDEN, I18N_FILE, MAX_COL_VALUE, MOBILE_TYPE, NOT_EDIT_PREVIEW_PARAM_NAME, SCROLL_TO_COMP_ID_ATTRIBUTE_NAME, TIME_CACHE_NAME, VALUE_SEPARATOR
-
Fields inherited from interface org.javlo.component.core.IContentVisualComponent
COLORED_WRAPPER_CLASS, COMP_ID_REQUEST_PARAM, COMPLEXITY_ADMIN, COMPLEXITY_EASY, COMPLEXITY_STANDARD, CONTAINER_COLOR, DEFAULT_COLOR, DYN_COMP_COLOR, ECOM_COLOR, EDIT_ACTION_CSS_CLASS, GRAPHIC_COLOR, HIGH_LABEL_LEVEL, ID_SEPARATOR, LINK_COLOR, LOW_LABEL_LEVEL, META_COLOR, MIDDLE_LABEL_LEVEL, SEARCH_LEVEL_HIGH, SEARCH_LEVEL_LOW, SEARCH_LEVEL_MIDDLE, SEARCH_LEVEL_NONE, TEXT_COLOR, VIEW_DEFINITION_REQUEST_ID, WEB2_COLOR
-
-
Constructor Summary
Constructors Constructor Description SmartGenericForm()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleanacceptLinks(ContentContext ctx)protected intdecodeEditNumber(ContentContext ctx, String number)protected intdecodeUserEditNumber(ContentContext ctx, String number)protected voiddelField(String name)protected StringencodeEditNumber(ContentContext ctx, int number)StringgetActionGroupName()the group name of the actionprotected FilegetAttachFolder(ContentContext ctx)protected booleangetColumnableDefaultValue()intgetComplexityLevel(ContentContext ctx)return the complexity level of the component.protected javax.mail.internet.InternetAddressgetConfirmToEmail(ContentContext ctx)intgetCountSubscription(ContentContext ctx)List<Map<String,String>>getData(ContentContext ctx)List<Map<String,String>>getData(ContentContext ctx, String login)get information about a specific user, if exist.protected StringgetDataKey()protected StringgetEditXHTMLCode(ContentContext ctx)protected FieldgetField(ContentContext ctx, String fieldName)List<Field>getFields()Deprecated.List<Field>getFields(ContentContext ctx)protected FilegetFile(ContentContext ctx)StringgetFontAwesome()protected StringgetInputEditLineName(ContentContext ctx)protected StringgetInputValidLineName(ContentContext ctx)PropertiesgetLocalConfig(boolean reload)protected StringgetMailFooter(ContentContext ctx)protected StringgetMailHeader(ContentContext ctx)protected longgetMaxFileSize()protected StringgetNewFieldKey()protected MenuElementgetNextPage(ContentContext ctx)List<IUserInfo>getParticipants(ContentContext ctx)StringgetRecaptchaKey()StringgetRecaptchaSecretKey()StringgetRenderer(ContentContext ctx)get current renderer file.StringgetTableSqlName()StringgetTableSqlNameReference()StringgetTitle()StringgetType()return the type of the element.StringgetUserLink(ContentContext ctx)protected booleanimportFieldAsExcel(ContentContext ctx)booleaninitContent(ContentContext ctx)init the content with a default value. sample : "lorem ipsum" for text component.booleanisCaptcha()protected booleanisCaptcha(ContentContext ctx)booleanisClose(ContentContext ctx)protected booleanisClosedEventSite(ContentContext ctx)booleanisContentCachable(ContentContext ctx)return the part of header needed for this componentbooleanisContentCachableByQuery(ContentContext ctx)booleanisDocument()booleanisEvent()booleanisFile()protected booleanisFilledFromCookies()protected booleanisFormExpire()check if form is expired (too much time for submit)protected booleanisFullEventSite(ContentContext ctx)protected booleanisHTMLMail()booleanisList()booleanisRealContent(ContentContext ctx)return true if component is considered as realContent and the page that contain the component is also considered as real content.protected booleanisSendEmail()protected booleanisStorage()protected booleanisUpdate(ContentContext ctx)protected booleanisWarningEventSite(ContentContext ctx)static StringperformDownloadForm(ContentContext ctx, RequestService rs)StringperformEdit(ContentContext ctx)action call when update the content page.static StringperformSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)voidprepareView(ContentContext ctx)prepare the rendering of a component. default attributes put in request : style, value, type, compidvoidsetValue(String inContent)set the content without renderingprotected voidstore(Field field)voidstore(ContentContext ctx)protected intstoreResult(ContentContext ctx, Map<String,String> data, boolean sort)-
Methods inherited from class org.javlo.component.core.AbstractVisualComponent
applyReplacement, cleanResources, cleanValue, clearReplacement, clone, compareTo, contructViewStyle, countLine, delete, deleteMySelf, drawColumn, equals, equals, executeCurrentRenderer, executeJSP, executeRenderer, executeRenderer, extractFieldsFromRenderer, forceInit, getAjaxId, getArea, getAuthors, getBackgroundColor, getBaseHelpURL, getClassName, getColomnablePrefix, getColomnableSuffix, getColumn, getColumnMaxSize, getColumnSize, getColumnSizes, getColumnStyle, getComponentBean, getComponentCSS, getComponentCssClass, getComponentId, getComponentLabel, getComponentPath, getConfig, getConfigInValue, getConfigMessage, getContainerPage, getContentAsMap, getContentAsText, getContentCache, getContentMessage, getContentName, getContentTimeCache, getCookiesDisplayStatus, getCreationDate, getCSSStyle, getCurrentPage, getCurrentRenderer, getDataAttributes, getDebugHeader, getDefaultHelpURI, getDefaultRenderer, getDeleteDate, getDescription, getDisplayAsInputName, getDisplayMessage, getEditorComplexity, getEditRenderer, getEditText, getEmptyCode, getEmptyXHTMLCode, getErrorMessage, getErrorMessage, getExternalModules, getExternalResources, getFileDirectory, getFirstPrefix, getForcedId, getForcedPrefixViewXHTMLCode, getForcedRenderer, getForcedSuffixViewXHTMLCode, getFormName, getGroup, getHeaderContent, getHelpText, getHelpType, getHelpURI, getHelpURL, getHexColor, getI18nEditableKeys, getIcon, getId, getImportFolderPath, getImportFolderPath, getInlineStyle, getInputName, getInputNameColomn, getInputNameColomnStyle, getInputNameRenderer, getInputNameRendererTitle, getItalicAndStrongLanguageMarkerList, getJSOnSubmit, getKey, getLabelLevel, getLastSufix, getLayout, getListClass, getListGroup, getListItemTag, getListTag, getLocalMessage, getLock, getManualCssClass, getMarkerList, getMessage, getMirrorWrapper, getModificationDate, getNextComponent, getPage, getPageDescription, getPrefixCssClass, getPrefixViewXHTMLCode, getPreviewAttributes, getPreviewCssClass, getPreviewCssId, getPreviousComponent, getQuotationLanguageMarkerList, getReferenceComponent, getRemplacement, getRendererTitle, getRenderes, getRequestComponent, getSearchLevel, getSelectRendererXHTML, getSpecialInputTag, getSpecialPreviewCssId, getSpecialTagTitle, getSpecialTagXHTML, getSpecificClass, getSpecificCssClass, getStyle, getStyleLabel, getStyleLabelList, getStyleList, getStyleTitle, getSuffixViewXHTMLCode, getTag, getTextColor, getTextForSearch, getTextLabel, getTextMessage, getTextPosition, getTextTitle, getTitleLevel, getTypeInputName, getValue, getValue, getVersion, getViewData, getViewDataFile, getViewID, getViewText, getViewXHTMLCode, getWidth, getWordCount, getXHTMLCode, getXHTMLConfig, haveRight, includeComponentJSP, includePage, init, init, insert, isAjaxWrapper, isAskWidth, isAutoDeletable, isAutoRenderer, isBackgroundColored, isCanAddClass, isCloseRow, isColored, isColumnable, isConfig, isContentTimeCachable, isDefaultValue, isDispayEmptyXHTMLCode, isDisplayable, isDisplayHidden, isEditOnCreate, isFirstElementOfRepeatSequence, isFirstRepeated, isFreeInputLayout, isHelpURL, isHiddable, isHidden, isHiddenInMode, isHiddenInModeValue, isInline, isInsertable, isList, isListable, isMetaTitle, isMirroredByDefault, isMirrorWrapped, isModify, isNeedDelete, isNeedRefresh, isNeedRenderer, isNew, isNextSame, isNextSame, isNolink, isNoLinkable, isOpenRow, isPreviousSame, isPreviousSame, isRepeat, isRepeatable, isRestMatch, isReversedLink, isStyleHidden, isUnique, isValueProperties, isValueTranslatable, isViewDataFile, isVisible, isVisible, isVisibleFromCookies, isWrapped, isXML, loadViewData, markAsNew, newInstance, next, onStyleChange, performColumnable, performConfig, performUpdate, prepareEdit, previous, processView, renderOtherComponent, renderViewXHTMLCode, replaceAllInContent, replaceInContent, resetContentCache, resetViewData, setBackgroundColor, setColumnSize, setColumnStyle, setComponentBean, setContainerPage, setContentCache, setContentTimeCache, setDisplayHidden, setForcedId, setForcedRenderer, setGroup, setHidden, setHiddenInMode, setList, setLocalMessage, setMessage, setMirrorWrapped, setModify, setNeedRefresh, setNextComponent, setNolink, setPage, setPreviousComponent, setRenderer, setRepeat, setStyle, setTextColor, setTextPosition, setValid, setWidth, stored, storeViewData, stringToReader, stringToReader, stringToStream, textToXHTML, toString, transflateFrom, updateCache
-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.javlo.actions.IEventRegistration
getId
-
-
-
-
Field Detail
-
RECAPTCHASECRETKEY
public static final String RECAPTCHASECRETKEY
- See Also:
- Constant Field Values
-
RECAPTCHAKEY
public static final String RECAPTCHAKEY
- See Also:
- Constant Field Values
-
FOLDER
public static final String FOLDER
- See Also:
- Constant Field Values
-
LOCK_ACCESS_FILE
protected static final Object LOCK_ACCESS_FILE
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocalConfig
public Properties getLocalConfig(boolean reload)
-
getAttachFolder
protected File getAttachFolder(ContentContext ctx) throws Exception
- Throws:
Exception
-
acceptLinks
protected boolean acceptLinks(ContentContext ctx)
-
getInputEditLineName
protected String getInputEditLineName(ContentContext ctx) throws Exception
- Throws:
Exception
-
getInputValidLineName
protected String getInputValidLineName(ContentContext ctx) throws Exception
- Throws:
Exception
-
encodeEditNumber
protected String encodeEditNumber(ContentContext ctx, int number) throws Exception
- Throws:
Exception
-
decodeEditNumber
protected int decodeEditNumber(ContentContext ctx, String number) throws NumberFormatException, Exception
- Throws:
NumberFormatExceptionException
-
decodeUserEditNumber
protected int decodeUserEditNumber(ContentContext ctx, String number) throws Exception
- Throws:
Exception
-
isCaptcha
protected boolean isCaptcha(ContentContext ctx)
-
isCaptcha
public boolean isCaptcha()
-
getRecaptchaKey
public String getRecaptchaKey()
-
getRecaptchaSecretKey
public String getRecaptchaSecretKey()
-
getCountSubscription
public int getCountSubscription(ContentContext ctx) throws Exception
- Throws:
Exception
-
getData
public List<Map<String,String>> getData(ContentContext ctx) throws Exception
- Specified by:
getDatain interfaceIDataContainer- Throws:
Exception
-
setValue
public void setValue(String inContent)
Description copied from interface:IContentVisualComponentset the content without rendering- Specified by:
setValuein interfaceIContentVisualComponent- Overrides:
setValuein classAbstractVisualComponent
-
isEvent
public boolean isEvent()
-
isDocument
public boolean isDocument()
-
getEditXHTMLCode
protected String getEditXHTMLCode(ContentContext ctx) throws Exception
- Overrides:
getEditXHTMLCodein classAbstractVisualComponent- Throws:
Exception
-
getField
protected Field getField(ContentContext ctx, String fieldName)
-
getFields
@Deprecated public List<Field> getFields()
Deprecated.
-
getFields
public List<Field> getFields(ContentContext ctx)
-
isFile
public boolean isFile()
-
isList
public boolean isList()
-
getRenderer
public String getRenderer(ContentContext ctx)
Description copied from class:AbstractVisualComponentget current renderer file.- Specified by:
getRendererin interfaceIContentVisualComponent- Overrides:
getRendererin classAbstractVisualComponent
-
getTitle
public String getTitle()
-
store
protected void store(Field field)
-
delField
protected void delField(String name)
-
store
public void store(ContentContext ctx) throws IOException
- Throws:
IOException
-
isClose
public boolean isClose(ContentContext ctx) throws Exception
- Throws:
Exception
-
isFilledFromCookies
protected boolean isFilledFromCookies()
-
getDataKey
protected String getDataKey()
-
prepareView
public void prepareView(ContentContext ctx) throws Exception
Description copied from class:AbstractVisualComponentprepare the rendering of a component. default attributes put in request : style, value, type, compid- Specified by:
prepareViewin interfaceIContentVisualComponent- Overrides:
prepareViewin classAbstractVisualComponent- Throws:
Exception
-
isUpdate
protected boolean isUpdate(ContentContext ctx) throws Exception
- Throws:
Exception
-
getMaxFileSize
protected long getMaxFileSize()
-
getNewFieldKey
protected String getNewFieldKey()
-
isWarningEventSite
protected boolean isWarningEventSite(ContentContext ctx) throws Exception
- Throws:
Exception
-
isClosedEventSite
protected boolean isClosedEventSite(ContentContext ctx) throws Exception
- Throws:
Exception
-
isFullEventSite
protected boolean isFullEventSite(ContentContext ctx) throws Exception
- Throws:
Exception
-
importFieldAsExcel
protected boolean importFieldAsExcel(ContentContext ctx) throws Exception
- Throws:
Exception
-
performEdit
public String performEdit(ContentContext ctx) throws Exception
Description copied from interface:IContentVisualComponentaction call when update the content page.- Specified by:
performEditin interfaceIContentVisualComponent- Overrides:
performEditin classAbstractVisualComponent- Returns:
- the error message, null if no error
- Throws:
Exception
-
getMailHeader
protected String getMailHeader(ContentContext ctx)
-
getMailFooter
protected String getMailFooter(ContentContext ctx)
-
isHTMLMail
protected boolean isHTMLMail()
-
isStorage
protected boolean isStorage()
-
getTableSqlName
public String getTableSqlName()
-
getTableSqlNameReference
public String getTableSqlNameReference()
-
getFile
protected File getFile(ContentContext ctx) throws Exception
- Throws:
Exception
-
storeResult
protected int storeResult(ContentContext ctx, Map<String,String> data, boolean sort) throws Exception
- Throws:
Exception
-
isSendEmail
protected boolean isSendEmail()
-
getConfirmToEmail
protected javax.mail.internet.InternetAddress getConfirmToEmail(ContentContext ctx)
-
isFormExpire
protected boolean isFormExpire()
check if form is expired (too much time for submit)- Returns:
-
performSubmit
public static String performSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
- Throws:
Exception
-
getNextPage
protected MenuElement getNextPage(ContentContext ctx)
-
getType
public String getType()
Description copied from interface:IContentVisualComponentreturn the type of the element.- Specified by:
getTypein interfaceIContentVisualComponent- Returns:
- the type of the element.
-
getActionGroupName
public String getActionGroupName()
Description copied from interface:IActionthe group name of the action- Specified by:
getActionGroupNamein interfaceIAction- Returns:
- a group name.
-
isRealContent
public boolean isRealContent(ContentContext ctx)
Description copied from interface:IContentVisualComponentreturn true if component is considered as realContent and the page that contain the component is also considered as real content.- Specified by:
isRealContentin interfaceIContentVisualComponent- Overrides:
isRealContentin classAbstractVisualComponent- Parameters:
ctx- current context- Returns:
-
isContentCachable
public boolean isContentCachable(ContentContext ctx)
Description copied from interface:IContentVisualComponentreturn the part of header needed for this component- Specified by:
isContentCachablein interfaceIContentVisualComponent- Overrides:
isContentCachablein classAbstractVisualComponent- Returns:
-
isContentCachableByQuery
public boolean isContentCachableByQuery(ContentContext ctx)
- Overrides:
isContentCachableByQueryin classAbstractVisualComponent
-
initContent
public boolean initContent(ContentContext ctx) throws Exception
Description copied from interface:IContentVisualComponentinit the content with a default value. sample : "lorem ipsum" for text component.- Specified by:
initContentin interfaceIContentVisualComponent- Overrides:
initContentin classAbstractVisualComponent- Returns:
- true if content is create.
- Throws:
Exception
-
getComplexityLevel
public int getComplexityLevel(ContentContext ctx)
Description copied from interface:IContentVisualComponentreturn the complexity level of the component.- Specified by:
getComplexityLevelin interfaceIContentVisualComponent- Overrides:
getComplexityLevelin classAbstractVisualComponent- Parameters:
ctx- TODO- Returns:
- see contant
-
getParticipants
public List<IUserInfo> getParticipants(ContentContext ctx) throws Exception
- Specified by:
getParticipantsin interfaceIEventRegistration- Throws:
Exception
-
getUserLink
public String getUserLink(ContentContext ctx) throws Exception
- Specified by:
getUserLinkin interfaceIEventRegistration- Throws:
Exception
-
getFontAwesome
public String getFontAwesome()
- Specified by:
getFontAwesomein interfaceIContentVisualComponent- Overrides:
getFontAwesomein classAbstractVisualComponent
-
getData
public List<Map<String,String>> getData(ContentContext ctx, String login) throws Exception
Description copied from interface:IEventRegistrationget information about a specific user, if exist.- Specified by:
getDatain interfaceIDataContainer- Specified by:
getDatain interfaceIEventRegistration- Throws:
Exception
-
performDownloadForm
public static String performDownloadForm(ContentContext ctx, RequestService rs) throws Exception
- Throws:
Exception
-
getColumnableDefaultValue
protected boolean getColumnableDefaultValue()
- Overrides:
getColumnableDefaultValuein classAbstractVisualComponent
-
-