本文整理汇总了Java中org.apache.wicket.WicketRuntimeException类的典型用法代码示例。如果您正苦于以下问题:Java WicketRuntimeException类的具体用法?Java WicketRuntimeException怎么用?Java WicketRuntimeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WicketRuntimeException类属于org.apache.wicket包,在下文中一共展示了WicketRuntimeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResources
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
@Override
public Iterator<URL> getResources(final String name) {
Set<URL> resultSet = new TreeSet<>(new UrlExternalFormComparator());
try {
// Try the classloader for the wicket jar/bundle
Enumeration<URL> resources = Application.class.getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the classloader for the user's application jar/bundle
resources = Application.get().getClass().getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the context class loader
resources = getClassLoader().getResources(name);
loadResources(resources, resultSet);
} catch (Exception e) {
throw new WicketRuntimeException(e);
}
return resultSet.iterator();
}
示例2: populateItem
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
@Override
protected final void populateItem(final Item<T> item) {
RepeatingView cells = new RepeatingView(CELL_REPEATER_ID);
item.add(cells);
int populatorsNumber = populators.size();
for (int i = 0; i < populatorsNumber; i++) {
ICellPopulator<T> populator = populators.get(i);
IModel<ICellPopulator<T>> populatorModel = new Model<>(populator);
Item<ICellPopulator<T>> cellItem = newCellItem(cells.newChildId(), i, populatorModel);
cells.add(cellItem);
populator.populateItem(cellItem, CELL_ITEM_ID, item.getModel());
if (cellItem.get("cell") == null) {
throw new WicketRuntimeException(
populator.getClass().getName()
+ ".populateItem() failed to add a component with id [" + CELL_ITEM_ID + "] to the provided"
+ " [cellItem] object. Make sure you call add() on cellItem and make sure you gave the added"
+ " component passed in 'componentId' id."
+ " (*cellItem*.add(new MyComponent(*componentId*, rowModel) )");
}
}
}
示例3: updateJpaAddresses
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
@Override
public void updateJpaAddresses(ConfigurationDao dao) {
StringBuilder sb = new StringBuilder();
String delim = "";
for (Member m : hazelcast.getCluster().getMembers()) {
sb.append(delim).append(m.getAddress().getHost());
delim = ";";
}
if (Strings.isEmpty(delim)) {
sb.append("localhost");
}
try {
dao.updateClusterAddresses(sb.toString());
} catch (UnknownHostException e) {
log.error("Uexpected exception while updating JPA addresses", e);
throw new WicketRuntimeException(e);
}
}
示例4: initIds
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
/**
* Synchronize ids collection from the palette's model
*/
private void initIds() {
// construct the model string based on selection collection
final IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
final StringBuilder modelStringBuffer = new StringBuilder();
final Collection<T> modelCollection = getPalette().getModelCollection();
if (modelCollection == null) {
throw new WicketRuntimeException("Expected getPalette().getModelCollection() to return a non-null value."
+ " Please make sure you have model object assigned to the palette");
}
final Iterator<T> selection = modelCollection.iterator();
int i = 0;
while (selection.hasNext()) {
modelStringBuffer.append(renderer.getIdValue(selection.next(), i++));
if (selection.hasNext()) {
modelStringBuffer.append(',');
}
}
// set model and update ids array
final String modelString = modelStringBuffer.toString();
setDefaultModel(new Model<String>(modelString));
updateIds(modelString);
}
示例5: newView
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
public ExceptionView newView(Exception e) {
Throwable rootCause = (ExceptionUtils.getRootCause(e) != null ? ExceptionUtils.getRootCause(e) : e);
if (rootCause instanceof AuthorizationException) {
return webPageFactory.getAuthorizationExceptionPage();
}
if (rootCause instanceof InvalidApplicationException) {
return webPageFactory.getInvalidApplicationExceptionPage();
}
if (rootCause instanceof InvalidReleaseException) {
return webPageFactory.getInvalidReleaseExceptionPage();
}
if (rootCause instanceof ObjectNotFoundException) {
return webPageFactory.getObjectNotFoundExceptionPage();
}
if (rootCause instanceof WicketRuntimeException && rootCause.getMessage() != null && rootCause.getMessage().contains("Pagemap null is still locked")) {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
logger.debug("dumping threads for page map issue");
logger.debug(threadMXBean.dumpAllThreads(true, true).toString());
return webPageFactory.getUnknownExceptionPage();
}
return webPageFactory.getUnknownExceptionPage();
}
示例6: getDateTextField
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
/**
* Gets the DateTextField inside this datepicker wrapper.
*
* @return the date field
*/
public DateTextField getDateTextField()
{
DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() {
@Override
public void component(DateTextField arg0, IVisit<DateTextField> arg1) {
arg1.stop(arg0);
}
});
if (component == null) {
throw new WicketRuntimeException("BootstrapDateTimepicker didn't have any DateTextField child!");
}
return component;
}
示例7: StringQueryManager
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
public StringQueryManager(String sql) {
this.sql = sql;
Matcher matcher = PROJECTION_PATTERN.matcher(sql);
if(matcher.find()) {
projection = matcher.group(1).trim();
Matcher expandMatcher = EXPAND_PATTERN.matcher(projection);
containExpand = expandMatcher.find();
if(containExpand) {
countSql = matcher.replaceFirst("select sum("+expandMatcher.group(1)+".size()) as count from");
}
else {
countSql = matcher.replaceFirst("select count(*) from");
}
}
else {
throw new WicketRuntimeException("Can't find 'object(<.>)' part in your request: "+sql);
}
hasOrderBy = ORDER_CHECK_PATTERN.matcher(sql).find();
managers = Maps.newHashMap();
}
示例8: apply
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
@Override
public ODocument apply(F input) {
if(input==null)
{
return null;
}
else if(input instanceof ODocument)
{
return (ODocument)input;
}
else if(input instanceof ORID)
{
return ((ORID)input).getRecord();
}
else if(input instanceof CharSequence)
{
return new ORecordId(input.toString()).getRecord();
}
else
{
throw new WicketRuntimeException("Object '"+input+"' of type '"+input.getClass()+"' can't be converted to ODocument");
}
}
示例9: setCollection
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
protected void setCollection(List<T> object)
{
if(object==null) model.setObject(null);
else
{
M collection = model.getObject();
if(collection!=null)
{
collection.clear();
collection.addAll(object);
}
else
{
throw new WicketRuntimeException("Creation of collection is not supported. Please override this method of you need support.");
}
}
}
示例10: createOrThrow
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
private <C extends IRequestablePage> C createOrThrow(final Class<C> pageClass, final PageParameters parameters) {
try {
if(parameters == null) {
return pageClass.getConstructor().newInstance();
} else {
return pageClass.getConstructor(PageParameters.class).newInstance(parameters);
}
} catch (final InstantiationException |
IllegalAccessException |
IllegalArgumentException |
InvocationTargetException |
NoSuchMethodException |
SecurityException e) {
throw new WicketRuntimeException("Error creating page " + pageClass, e);
}
}
示例11: initIds
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
/**
* Synchronize ids collection from the palette's model
*/
private void initIds() {
// construct the model string based on selection collection
IChoiceRenderer<? super T> renderer = getPalette().getChoiceRenderer();
StringBuilder modelStringBuffer = new StringBuilder();
Collection<T> modelCollection = getPalette().getModelCollection();
if (modelCollection == null) {
throw new WicketRuntimeException("Expected getPalette().getModelCollection() to return a non-null value."
+ " Please make sure you have model object assigned to the palette");
}
Iterator<T> selection = modelCollection.iterator();
int i = 0;
while (selection.hasNext()) {
modelStringBuffer.append(renderer.getIdValue(selection.next(), i++));
if (selection.hasNext()) {
modelStringBuffer.append(",");
}
}
// set model and update ids array
String modelString = modelStringBuffer.toString();
setDefaultModel(new Model<>(modelString));
updateIds(modelString);
}
示例12: getResources
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
public Iterator<URL> getResources(final String name) {
Set<URL> resultSet = new TreeSet<URL>(new UrlExternalFormComparator());
try {
// Try the classloader for the wicket jar/bundle
Enumeration<URL> resources = Application.class.getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the classloader for the user's application jar/bundle
resources = Application.get().getClass().getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the context class loader
resources = getClassLoader().getResources(name);
loadResources(resources, resultSet);
} catch (Exception e) {
throw new WicketRuntimeException(e);
}
return resultSet.iterator();
}
示例13: getChild
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
private Entity getChild(Entity node, String name) {
Entity[] children;
try {
children = storageService.getEntityChildren(node.getPath());
} catch (NotFoundException e) {
throw new WicketRuntimeException(e);
}
for (Entity tmp : children) {
if (name.equals(tmp.getName())) {
return tmp;
}
}
return null;
}
示例14: throwAmbiguousMethodsException
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
/**
* Throw an exception if two o more methods have the same "score" for the
* current request. See method selectMostSuitedMethod.
*
* @param list
* the list of ambiguous methods.
*/
private void throwAmbiguousMethodsException(List<MethodMappingInfo> list) {
WebRequest request = (WebRequest) RequestCycle.get().getRequest();
String methodsNames = "";
for (MethodMappingInfo urlMappingInfo : list) {
if (!methodsNames.isEmpty())
methodsNames += ", ";
methodsNames += urlMappingInfo.getMethod().getName();
}
throw new WicketRuntimeException("Ambiguous methods mapped for the current request: URL '"
+ request.getClientUrl() + "', HTTP method " + HttpUtils.getHttpMethod(request)
+ ". " + "Mapped methods: " + methodsNames);
}
示例15: getResources
import org.apache.wicket.WicketRuntimeException; //导入依赖的package包/类
@Override
public Iterator<URL> getResources(final String name) {
Set<URL> resultSet = new TreeSet<URL>(new UrlExternalFormComparator());
try {
// Try the classloader for the wicket jar/bundle
Enumeration<URL> resources = Application.class.getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the classloader for the user's application jar/bundle
resources = Application.get().getClass().getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the context class loader
resources = getClassLoader().getResources(name);
loadResources(resources, resultSet);
} catch (Exception e) {
throw new WicketRuntimeException(e);
}
return resultSet.iterator();
}