本文整理汇总了Java中org.uberfire.ext.editor.commons.client.validation.Validator类的典型用法代码示例。如果您正苦于以下问题:Java Validator类的具体用法?Java Validator怎么用?Java Validator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Validator类属于org.uberfire.ext.editor.commons.client.validation包,在下文中一共展示了Validator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetSaveAndRenameCommand
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Test
public void testGetSaveAndRenameCommand() {
final Command expectedCommand = mock(Command.class);
final GuidedDecisionTableGraphEditorPresenter presenter = makePresenter();
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addPathSupplier(any());
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addValidator(any(Validator.class));
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addValidator(any(Supplier.class));
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addRenameService(any());
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addMetadataSupplier(any());
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addContentSupplier(any());
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addIsDirtySupplier(any());
doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addSuccessCallback(any());
doReturn(expectedCommand).when(saveAndRenameCommandBuilder).build();
final Command actualCommand = presenter.getSaveAndRenameCommand();
assertEquals(expectedCommand, actualCommand);
}
示例2: initTest
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Before
public void initTest() {
when(importsContent.getOverview()).thenReturn(overview);
when(recordManager.getCurrentPath()).thenReturn(path);
when(menuBuilder.addSave(any(MenuItem.class))).thenReturn(menuBuilder);
when(menuBuilder.addCopy(any(Path.class),
any(Validator.class))).thenReturn(menuBuilder);
when(menuBuilder.addRename(any(Command.class))).thenReturn(menuBuilder);
when(menuBuilder.addDelete(any(Path.class))).thenReturn(menuBuilder);
when(menuBuilder.addNewTopLevelMenu(any(MenuItem.class))).thenReturn(menuBuilder);
when(workbenchContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty());
when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(workbenchContext.getActiveModule()).thenReturn(Optional.empty());
when(workbenchContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
when(workbenchContext.getActivePackage()).thenReturn(Optional.empty());
}
示例3: show
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
public void show(Path path,
Validator validator,
CommandWithFileNameAndCommitMessage command) {
this.path = checkNotNull("path",
path);
this.validator = checkNotNull("validator",
validator);
this.command = checkNotNull("command",
command);
view.show();
}
示例4: defaultValidator
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
private Validator defaultValidator() {
return new Validator() {
@Override
public void validate(final String value,
final ValidatorCallback callback) {
callback.onSuccess();
}
};
}
示例5: show
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
public void show(final Path path,
final Validator validator,
final CommandWithFileNameAndCommitMessage command,
final String originalFileName) {
this.validator = checkNotNull("validator",
validator);
this.path = checkNotNull("path",
path);
this.command = checkNotNull("command",
command);
this.originalFileName = originalFileName;
view.setOriginalFileName(originalFileName);
view.show();
}
示例6: addDelete
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Override
public BasicFileMenuBuilder addDelete(final Path path,
final Caller<? extends SupportsDelete> deleteCaller,
final Validator validator) {
return addDelete(() -> {
deletePopUpPresenter.show(validator,
(String comment) -> {
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Deleting());
deleteCaller.call(getDeleteSuccessCallback(),
new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).delete(path,
comment);
});
});
}
示例7: addRename
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Override
public BasicFileMenuBuilder addRename(final Path path,
final Validator validator,
final Caller<? extends SupportsRename> renameCaller) {
return addRename(() -> {
CommandWithFileNameAndCommitMessage command = getRenamePopupCommand(renameCaller,
path,
renamePopUpPresenter.getView());
renamePopUpPresenter.show(path,
validator,
command);
});
}
示例8: addCopy
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Override
public BasicFileMenuBuilder addCopy(final Path path,
final Validator validator,
final Caller<? extends SupportsCopy> copyCaller) {
return addCopy(() -> copyPopUpPresenter.show(path,
validator,
getCopyPopupCommand(copyCaller,
path,
copyPopUpPresenter.getView())));
}
示例9: testTagsDisabledByDefault
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Test
public void testTagsDisabledByDefault() {
presenter.onStartup(observablePath, placeRequest);
verify(menuBuilder).addSave(any(Command.class));
verify(menuBuilder).addCopy(any(Path.class), any(Validator.class), any(Caller.class));
verify(menuBuilder).addRename(any(Path.class), any(Validator.class), any(Caller.class));
verify(menuBuilder).addDelete(any(Path.class), any(Caller.class));
verify(menuBuilder).addDelete(any(Path.class), any(Caller.class));
verify(menuBuilder, never()).addNewTopLevelMenu(any());
}
示例10: testTagsEnabled
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Test
public void testTagsEnabled() {
when(settings.isTagsEnabled()).thenReturn(true);
presenter.onStartup(observablePath, placeRequest);
verify(menuBuilder).addSave(any(Command.class));
verify(menuBuilder).addCopy(any(Path.class), any(Validator.class), any(Caller.class));
verify(menuBuilder).addRename(any(Path.class), any(Validator.class), any(Caller.class));
verify(menuBuilder).addDelete(any(Path.class), any(Caller.class));
verify(menuBuilder).addDelete(any(Path.class), any(Caller.class));
verify(menuBuilder).addNewTopLevelMenu(any());
}
示例11: setUp
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
when(copyPopUpPresenter.getView()).thenReturn(copyPopUpPresenterView);
pathArgumentCaptor = ArgumentCaptor.forClass(Path.class);
validatorArgumentCaptor = ArgumentCaptor.forClass(Validator.class);
commandWithFileNameArgumentCaptor = ArgumentCaptor.forClass(CommandWithFileNameAndCommitMessage.class);
}
示例12: renameItem
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
public void renameItem(final FolderItem folderItem) {
final Path path = getFolderItemPath(folderItem);
renamePopUpPresenter.show(path,
new Validator() {
@Override
public void validate(final String value,
final ValidatorCallback callback) {
validationService.call(new RemoteCallback<Object>() {
@Override
public void callback(Object response) {
if (Boolean.TRUE.equals(response)) {
callback.onSuccess();
} else {
callback.onFailure();
}
}
})
.isFileNameValid(path,
value);
}
},
new CommandWithFileNameAndCommitMessage() {
@Override
public void execute(final FileNameAndCommitMessage details) {
baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming());
explorerService.call(
getRenameSuccessCallback(getRenameView()),
getRenameErrorCallback(getRenameView())
)
.renameItem(folderItem,
details.getNewFileName(),
details.getCommitMessage());
}
}
);
}
示例13: showCopyPopup
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
private void showCopyPopup(final FolderItem folderItem,
final Path path) {
copyPopUpPresenter.show(path,
new Validator() {
@Override
public void validate(final String value,
final ValidatorCallback callback) {
validationService.call(new RemoteCallback<Object>() {
@Override
public void callback(Object response) {
if (Boolean.TRUE.equals(response)) {
callback.onSuccess();
} else {
callback.onFailure();
}
}
})
.isFileNameValid(path,
value);
}
},
new CommandWithFileNameAndCommitMessage() {
@Override
public void execute(final FileNameAndCommitMessage details) {
baseView.showBusyIndicator(CommonConstants.INSTANCE.Copying());
explorerService.call(getCopySuccessCallback(getCopyView()),
getCopyErrorCallback(getCopyView()))
.copyItem(folderItem,
details.getNewFileName(),
getCopyView().getTargetPath(),
details.getCommitMessage());
}
}
);
}
示例14: copyPopUpPresenterShowMock
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
private void copyPopUpPresenterShowMock() {
final ArgumentCaptor<CommandWithFileNameAndCommitMessage> commandCaptor = ArgumentCaptor.forClass(CommandWithFileNameAndCommitMessage.class);
doAnswer(invocation -> {
commandCaptor.getValue().execute(new FileNameAndCommitMessage("fileName",
"message"));
return null;
}).when(copyPopUpPresenterMock).show(any(Path.class),
any(Validator.class),
commandCaptor.capture());
}
示例15: renamePopUpPresenterShowMock
import org.uberfire.ext.editor.commons.client.validation.Validator; //导入依赖的package包/类
private void renamePopUpPresenterShowMock() {
final ArgumentCaptor<CommandWithFileNameAndCommitMessage> commandCaptor = ArgumentCaptor.forClass(CommandWithFileNameAndCommitMessage.class);
doAnswer(invocation -> {
commandCaptor.getValue().execute(new FileNameAndCommitMessage("fileName",
"message"));
return null;
}).when(renamePopUpPresenterMock).show(any(Path.class),
any(Validator.class),
commandCaptor.capture());
}