Class BaseEditor<T,M>
- java.lang.Object
-
- org.uberfire.ext.editor.commons.client.BaseEditor<T,M>
-
- Direct Known Subclasses:
HtmlEditor
public abstract class BaseEditor<T,M> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseEditorViewbaseViewprotected javax.enterprise.event.Event<org.uberfire.client.workbench.events.ChangeTitleWidgetEvent>changeTitleNotificationprotected org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopupconcurrentChangePopupprotected javax.enterprise.event.Event<ConcurrentDeleteAcceptedEvent>concurrentDeleteAcceptedEventprotected javax.enterprise.event.Event<ConcurrentDeleteIgnoredEvent>concurrentDeleteIgnoredEventprotected javax.enterprise.event.Event<ConcurrentRenameAcceptedEvent>concurrentRenameAcceptedEventprotected javax.enterprise.event.Event<ConcurrentRenameIgnoredEvent>concurrentRenameIgnoredEventprotected org.uberfire.backend.vfs.ObservablePath.OnConcurrentUpdateEventconcurrentUpdateSessionInfoprotected DeletePopUpPresenterdeletePopUpPresenterprotected DefaultFileNameValidatorfileNameValidatorprotected booleanisReadOnlyprotected booleanisValidationRunningprotected elemental2.promise.Promise<Void>makeMenuBarPromiseprotected BasicFileMenuBuildermenuBuilderprotected org.jboss.errai.ioc.client.api.ManagedInstance<BasicFileMenuBuilder>menuBuilderManagedInstanceprotected Set<MenuItems>menuItemsprotected org.uberfire.workbench.model.menu.Menusmenusprotected IntegermetadataOriginalHashprotected javax.enterprise.event.Event<org.uberfire.workbench.events.NotificationEvent>notificationprotected IntegeroriginalHashprotected org.uberfire.mvp.PlaceRequestplaceprotected org.uberfire.client.mvp.PlaceManagerplaceManagerprotected org.uberfire.client.promise.Promisespromisesprotected SaveAndRenameCommandBuilder<T,M>saveAndRenameCommandBuilderprotected booleansaveWithCommentsprotected org.uberfire.client.workbench.type.ClientResourceTypetypeprotected VersionRecordManagerversionRecordManager
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseEditor()protectedBaseEditor(BaseEditorView baseView)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddDownloadMenuItem(BasicFileMenuBuilder menuBuilder)protected voidbuildMenuBar()If you want to customize the menu construction override this method.voiddisableMenuItem(MenuItems menuItem)protected org.uberfire.workbench.model.menu.MenuItemdownloadMenuItem()voidenableMenuItem(MenuItems menuItem)protected org.uberfire.mvp.CommandgetBeforeSaveAndRenameCommand()protected Supplier<T>getContentSupplier()protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsCopy>getCopyServiceCaller()ValidatorgetCopyValidator()protected IntegergetCurrentContentHash()protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsDelete>getDeleteServiceCaller()voidgetMenus(Consumer<org.uberfire.workbench.model.menu.Menus> menusConsumer)protected Supplier<M>getMetadataSupplier()protected Supplier<org.uberfire.backend.vfs.Path>getPathSupplier()protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsRename>getRenameServiceCaller()ValidatorgetRenameValidator()protected org.uberfire.mvp.CommandgetSaveAndRename()protected SaveAndRenameCommandBuilder<T,M>getSaveAndRenameCommandBuilder()protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename<T,M>>getSaveAndRenameServiceCaller()org.jboss.errai.common.client.api.RemoteCallback<org.uberfire.backend.vfs.Path>getSaveSuccessCallback(int newHash)protected Supplier<Boolean>getSaveValidator()protected com.google.gwt.user.client.ui.IsWidgetgetTitle()Override this method and use @WorkbenchPartTitleDecorationStringgetTitleText()org.uberfire.mvp.CommandgetValidateCommand()VersionRecordManagergetVersionRecordManager()protected voidinit(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, boolean addFileChangeListeners, boolean displayShowMoreVersions, Collection<MenuItems> menuItems)protected voidinit(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, boolean addFileChangeListeners, boolean displayShowMoreVersions, MenuItems... menuItems)protected voidinit(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, MenuItems... menuItems)booleanisDirty(Integer currentHash)protected Supplier<Boolean>isDirtySupplier()protected abstract voidloadContent()protected elemental2.promise.Promise<Void>makeMenuBar()If you want to customize the menu content override this method.booleanmayClose(Integer currentHash)protected voidonAfterValidate()protected voidonBeforeValidate()protected voidonRename()voidonRestore(org.uberfire.ext.editor.commons.version.events.RestoreEvent restore)protected voidonSave()protected org.uberfire.mvp.ParameterizedCommand<org.uberfire.backend.vfs.Path>onSuccess()protected voidonValidate(org.uberfire.mvp.Command finished)If your editor has validation, overwrite this.voidreload()protected voidsave()Needs to be overwritten for save to workvoidsetMetadataOriginalHash(Integer metadataOriginalHash)voidsetOriginalHash(Integer originalHash)protected voidshowConcurrentUpdatePopup()protected voidshowVersions()
-
-
-
Field Detail
-
isReadOnly
protected boolean isReadOnly
-
baseView
protected BaseEditorView baseView
-
concurrentUpdateSessionInfo
protected org.uberfire.backend.vfs.ObservablePath.OnConcurrentUpdateEvent concurrentUpdateSessionInfo
-
menus
protected org.uberfire.workbench.model.menu.Menus menus
-
makeMenuBarPromise
protected elemental2.promise.Promise<Void> makeMenuBarPromise
-
saveWithComments
protected boolean saveWithComments
-
placeManager
@Inject protected org.uberfire.client.mvp.PlaceManager placeManager
-
changeTitleNotification
@Inject protected javax.enterprise.event.Event<org.uberfire.client.workbench.events.ChangeTitleWidgetEvent> changeTitleNotification
-
notification
@Inject protected javax.enterprise.event.Event<org.uberfire.workbench.events.NotificationEvent> notification
-
versionRecordManager
@Inject protected VersionRecordManager versionRecordManager
-
menuBuilderManagedInstance
@Inject protected org.jboss.errai.ioc.client.api.ManagedInstance<BasicFileMenuBuilder> menuBuilderManagedInstance
-
menuBuilder
@Inject protected BasicFileMenuBuilder menuBuilder
-
fileNameValidator
@Inject protected DefaultFileNameValidator fileNameValidator
-
saveAndRenameCommandBuilder
@Inject protected SaveAndRenameCommandBuilder<T,M> saveAndRenameCommandBuilder
-
concurrentDeleteAcceptedEvent
@Inject protected javax.enterprise.event.Event<ConcurrentDeleteAcceptedEvent> concurrentDeleteAcceptedEvent
-
concurrentDeleteIgnoredEvent
@Inject protected javax.enterprise.event.Event<ConcurrentDeleteIgnoredEvent> concurrentDeleteIgnoredEvent
-
concurrentRenameAcceptedEvent
@Inject protected javax.enterprise.event.Event<ConcurrentRenameAcceptedEvent> concurrentRenameAcceptedEvent
-
concurrentRenameIgnoredEvent
@Inject protected javax.enterprise.event.Event<ConcurrentRenameIgnoredEvent> concurrentRenameIgnoredEvent
-
promises
@Inject protected org.uberfire.client.promise.Promises promises
-
deletePopUpPresenter
@Inject protected DeletePopUpPresenter deletePopUpPresenter
-
concurrentChangePopup
protected org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopup concurrentChangePopup
-
place
protected org.uberfire.mvp.PlaceRequest place
-
type
protected org.uberfire.client.workbench.type.ClientResourceType type
-
originalHash
protected Integer originalHash
-
metadataOriginalHash
protected Integer metadataOriginalHash
-
isValidationRunning
protected boolean isValidationRunning
-
-
Constructor Detail
-
BaseEditor
protected BaseEditor()
-
BaseEditor
protected BaseEditor(BaseEditorView baseView)
-
-
Method Detail
-
init
protected void init(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, MenuItems... menuItems)
-
init
protected void init(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, boolean addFileChangeListeners, boolean displayShowMoreVersions, MenuItems... menuItems)
-
init
protected void init(org.uberfire.backend.vfs.ObservablePath path, org.uberfire.mvp.PlaceRequest place, org.uberfire.client.workbench.type.ClientResourceType type, boolean addFileChangeListeners, boolean displayShowMoreVersions, Collection<MenuItems> menuItems)
-
showVersions
protected void showVersions()
-
makeMenuBar
protected elemental2.promise.Promise<Void> makeMenuBar()
If you want to customize the menu content override this method.
-
addDownloadMenuItem
protected void addDownloadMenuItem(BasicFileMenuBuilder menuBuilder)
-
downloadMenuItem
protected org.uberfire.workbench.model.menu.MenuItem downloadMenuItem()
-
getSaveAndRename
protected org.uberfire.mvp.Command getSaveAndRename()
-
getBeforeSaveAndRenameCommand
protected org.uberfire.mvp.Command getBeforeSaveAndRenameCommand()
-
onSuccess
protected org.uberfire.mvp.ParameterizedCommand<org.uberfire.backend.vfs.Path> onSuccess()
-
getSaveAndRenameCommandBuilder
protected SaveAndRenameCommandBuilder<T,M> getSaveAndRenameCommandBuilder()
-
getPathSupplier
protected Supplier<org.uberfire.backend.vfs.Path> getPathSupplier()
-
buildMenuBar
protected void buildMenuBar()
If you want to customize the menu construction override this method.makeMenuBar()should be used to add items to theBasicFileMenuBuilder. This method then instructsBasicFileMenuBuilder.build()to create theMenus
-
getRenameValidator
public Validator getRenameValidator()
-
getCopyValidator
public Validator getCopyValidator()
-
setOriginalHash
public void setOriginalHash(Integer originalHash)
-
onRename
protected void onRename()
-
getTitle
protected com.google.gwt.user.client.ui.IsWidget getTitle()
Override this method and use @WorkbenchPartTitleDecoration- Returns:
- The widget for the title
-
getTitleText
public String getTitleText()
-
onSave
protected void onSave()
-
showConcurrentUpdatePopup
protected void showConcurrentUpdatePopup()
-
getSaveSuccessCallback
public org.jboss.errai.common.client.api.RemoteCallback<org.uberfire.backend.vfs.Path> getSaveSuccessCallback(int newHash)
-
onRestore
public void onRestore(@Observes org.uberfire.ext.editor.commons.version.events.RestoreEvent restore)
-
reload
public void reload()
-
disableMenuItem
public void disableMenuItem(MenuItems menuItem)
-
enableMenuItem
public void enableMenuItem(MenuItems menuItem)
-
getMenus
public void getMenus(Consumer<org.uberfire.workbench.model.menu.Menus> menusConsumer)
-
getValidateCommand
public org.uberfire.mvp.Command getValidateCommand()
-
onBeforeValidate
protected void onBeforeValidate()
-
onAfterValidate
protected void onAfterValidate()
-
onValidate
protected void onValidate(org.uberfire.mvp.Command finished)
If your editor has validation, overwrite this.- Parameters:
finished- Called when validation is finished.
-
loadContent
protected abstract void loadContent()
-
getCurrentContentHash
protected Integer getCurrentContentHash()
-
save
protected void save()
Needs to be overwritten for save to work
-
getDeleteServiceCaller
protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsDelete> getDeleteServiceCaller()
-
getRenameServiceCaller
protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsRename> getRenameServiceCaller()
-
getSaveAndRenameServiceCaller
protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename<T,M>> getSaveAndRenameServiceCaller()
-
getCopyServiceCaller
protected org.jboss.errai.common.client.api.Caller<? extends org.uberfire.ext.editor.commons.service.support.SupportsCopy> getCopyServiceCaller()
-
mayClose
public boolean mayClose(Integer currentHash)
-
isDirty
public boolean isDirty(Integer currentHash)
-
getVersionRecordManager
public VersionRecordManager getVersionRecordManager()
-
setMetadataOriginalHash
public void setMetadataOriginalHash(Integer metadataOriginalHash)
-
-