本文整理汇总了Java中org.apache.isis.applib.services.i18n.TranslatableString类的典型用法代码示例。如果您正苦于以下问题:Java TranslatableString类的具体用法?Java TranslatableString怎么用?Java TranslatableString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TranslatableString类属于org.apache.isis.applib.services.i18n包,在下文中一共展示了TranslatableString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Action(
domainEvent = DeletedDomainEvent.class,
invokeOn = InvokeOn.OBJECT_AND_COLLECTION
)
public Object delete() {
// obtain title first, because cannot reference object after deleted
final String title = titleService.titleOf(this);
final List<ToDoItem> returnList = actionInvocationContext.getInvokedOn().isCollection() ? toDoItems.notYetComplete() : null;
// there's actually a bug in this method; shouldn't be returning the current object in the list if just deleted.
// however, ISIS-1269 transparently handles this and won't attempt to render a deleted object.
repositoryService.remove(this);
messageService.informUser(
TranslatableString.tr("Deleted {title}", "title", title), this.getClass(), "delete");
return returnList;
}
示例2: validateNewTextTemplate
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
public TranslatableString validateNewTextTemplate(
final DocumentType proposedType,
final LocalDate proposedDate,
final String name,
final String mimeType,
final String fileSuffix,
final ApplicationTenancy proposedApplicationTenancy,
final String templateText,
final RenderingStrategy contentRenderingStrategy,
final String subjectText,
final RenderingStrategy subjectRenderingStrategy,
final boolean previewOnly) {
final DocumentSort documentSort = DocumentSort.TEXT;
return validateNewTemplate(proposedType, proposedDate, proposedApplicationTenancy, contentRenderingStrategy,
documentSort);
}
示例3: validateNewClobTemplate
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
public TranslatableString validateNewClobTemplate(
final DocumentType proposedType,
final LocalDate proposedDate,
final String name,
final String fileSuffix,
final ApplicationTenancy proposedApplicationTenancy,
final Clob clob,
final RenderingStrategy contentRenderingStrategy,
final String subjectText,
final RenderingStrategy subjectRenderingStrategy,
final boolean previewOnly) {
final DocumentSort documentSort = DocumentSort.CLOB;
return validateNewTemplate(
proposedType, proposedDate, proposedApplicationTenancy, contentRenderingStrategy,
documentSort);
}
示例4: validateNewBlobTemplate
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
public TranslatableString validateNewBlobTemplate(
final DocumentType proposedType,
final LocalDate proposedDate,
final String name,
final String fileSuffix,
final ApplicationTenancy proposedApplicationTenancy,
final Blob blob,
final RenderingStrategy contentRenderingStrategy,
final String subjectText,
final RenderingStrategy subjectRenderingStrategy,
final boolean previewOnly) {
final DocumentSort documentSort = DocumentSort.BLOB;
return validateNewTemplate(
proposedType, proposedDate, proposedApplicationTenancy, contentRenderingStrategy, documentSort);
}
示例5: validateNewTemplate
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
private TranslatableString validateNewTemplate(
final DocumentType proposedType,
final LocalDate proposedDate,
final ApplicationTenancy proposedApplicationTenancy,
final RenderingStrategy proposedRenderingStrategy,
final DocumentSort documentSort) {
TranslatableString translatableString = documentTemplateRepository.validateApplicationTenancyAndDate(
proposedType, proposedApplicationTenancy.getPath(), proposedDate, null);
if(translatableString != null) {
return translatableString;
}
translatableString = documentTemplateRepository.validateSortAndRenderingStrategyInputNature(documentSort,
proposedRenderingStrategy);
if(translatableString != null) {
return translatableString;
}
return null;
}
示例6: disableIfIncomingAndCategorisedFor
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void disableIfIncomingAndCategorisedFor(final Document_delete.ActionDomainEvent ev) {
final Document document = (Document) ev.getMixedIn();
switch (ev.getEventPhase()) {
case DISABLE:
if(DocumentTypeData.hasIncomingType(document) && !DocumentTypeData.INCOMING.isDocTypeFor(document)) {
ev.veto(TranslatableString.tr(
"Document has already been categorised (as {documentType})",
"documentType", document.getType().getName()));
}
break;
case EXECUTING:
repository.deleteFor(document);
}
}
示例7: validateRemoveCascade
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Programmatic
public TranslatableString validateRemoveCascade(final Category category) {
List<Classification> classifications = classificationRepository.findByCategory(category);
if (!classifications.isEmpty()) {
return TranslatableString.tr("Child '{child}' is classified by '{object}' and cannot be removed",
"child", category.getFullyQualifiedName(), "object", classifications.get(0).getClassified().toString());
} else {
SortedSet<Category> children = category.getChildren();
for (final Category child : children) {
TranslatableString childValidation = validateRemoveCascade(child);
if (childValidation != null) {
return childValidation;
}
}
return null;
}
}
示例8: determineCharset
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
private Charset determineCharset(final String contentType) {
final String charsetName = parseCharset(contentType);
if(charsetName == null) {
return null;
}
try {
return Charset.forName(charsetName);
} catch (Exception e) {
messageService.warnUser(TranslatableString.tr(
"Could not download from URL (charset '{charsetName}' not recognized)",
"charsetName", charsetName),
UrlDownloadService.class, "determineCharset");
return null;
}
}
示例9: parseCharset
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
private String parseCharset(final String contentType) {
final Iterable<String> values = Splitter.on(";").split(contentType);
for (String value : values) {
value = value.trim();
if (value.toLowerCase().startsWith("charset=")) {
return value.substring("charset=".length());
}
}
messageService.warnUser(TranslatableString.tr(
"Could not download from URL (charset not recognized within content-type header '{contentType}')",
"contentType", contentType),
UrlDownloadService.class, "parseCharset");
return null;
}
示例10: validateApplicationTenancyAndDate
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Programmatic
public TranslatableString validateApplicationTenancyAndDate(
final DocumentType proposedType,
final String proposedAtPath,
final LocalDate proposedDate,
final DocumentTemplate ignore) {
final List<DocumentTemplate> existingTemplates =
findByTypeAndAtPath(proposedType, proposedAtPath);
for (DocumentTemplate existingTemplate : existingTemplates) {
if(existingTemplate == ignore) {
continue;
}
if(java.util.Objects.equals(existingTemplate.getDate(), proposedDate)) {
return TranslatableString.tr("A template already exists for this date");
}
if (proposedDate == null && existingTemplate.getDate() != null) {
return TranslatableString.tr(
"Must provide a date (there are existing templates that already have a date specified)");
}
}
return null;
}
示例11: if_no_background_service
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Test
public void if_no_background_service() throws Exception {
// given
assumeThat(backgroundCommandService, is(nullValue()));
// when
final TranslatableString reason = _createAndAttachDocumentAndScheduleRender(demoObject).disable$$();
// then
assertThat(reason).isNotNull();
// expect
expectedExceptions.expect(DisabledException.class);
// when
final DocumentTemplate anyTemplate = templateFs.getFmkTemplate();
wrap(_createAndAttachDocumentAndScheduleRender(demoObject)).$$(anyTemplate);
}
示例12: onExecutedThrowExceptionIfSet
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
private void onExecutedThrowExceptionIfSet() {
if(getSubscriberBehaviour() == DemoBehaviour.ANY_EXECUTE_VETO_WITH_RECOVERABLE_EXCEPTION) {
throw new RecoverableException(
TranslatableString.tr("Rejecting event (recoverable exception thrown)"),
this.getClass(), "on(ActionDomainEvent)");
}
if(getSubscriberBehaviour() == DemoBehaviour.ANY_EXECUTE_VETO_WITH_NON_RECOVERABLE_EXCEPTION) {
throw new NonRecoverableException(
TranslatableString.tr("Rejecting event (non-recoverable exception thrown)"),
this.getClass(), "on(ActionDomainEvent)");
}
if(getSubscriberBehaviour() == DemoBehaviour.ANY_EXECUTE_VETO_WITH_OTHER_EXCEPTION) {
throw new RuntimeException("Throwing some other exception");
}
}
示例13: notYetComplete
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(
cssClassFa = "fa fa-thumbs-down",
bookmarking = BookmarkPolicy.AS_ROOT
)
@MemberOrder(sequence = "10")
public List<ToDoItem> notYetComplete() {
final List<ToDoItem> items = notYetCompleteNoUi();
if(items.isEmpty()) {
container.informUser(
TranslatableString.tr("All to-do items have been completed :-)"), this.getClass(), "notYetComplete");
}
return items;
}
示例14: complete
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@ActionLayout(
cssClassFa = "fa fa-thumbs-up"
)
@Action(semantics = SemanticsOf.SAFE)
@MemberOrder(sequence = "20")
public List<ToDoItem> complete() {
final List<ToDoItem> items = completeNoUi();
if(items.isEmpty()) {
container.informUser(TranslatableString.tr("No to-do items have yet been completed :-("), this.getClass(), "complete");
}
return items;
}
示例15: satisfiesTranslatableSafely
import org.apache.isis.applib.services.i18n.TranslatableString; //导入依赖的package包/类
@Override
public TranslatableString satisfiesTranslatableSafely(final String obj) {
return TranslatableString.tr(
obj != null && obj.contains(" ")
? "Proposed value '{proposed}' cannot contain spaces!"
: null,
"proposed", obj);
}