// write default attributes
super.writeDesign(design, designContext);
- AbstractOrderedLayout def = (AbstractOrderedLayout) designContext
+ AbstractOrderedLayout def = designContext
.getDefaultInstance(this);
writeMargin(design, getMargin(), def.getMargin(), designContext);
super.writeDesign(design, designContext);
// handle custom attributes (write only if a value is not the
// default value)
- AbstractSplitPanel def = (AbstractSplitPanel) designContext
+ AbstractSplitPanel def = designContext
.getDefaultInstance(this);
if (getSplitPosition() != def.getSplitPosition()
|| !def.getSplitPositionUnit().equals(getSplitPositionUnit())) {
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
- AbstractTextField def = (AbstractTextField) designContext
+ AbstractTextField def = designContext
.getDefaultInstance(this);
Attributes attr = design.attributes();
DesignAttributeHandler.writeAttribute("maxlength", attr, getMaxLength(),
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
Attributes attr = design.attributes();
- Button def = (Button) designContext.getDefaultInstance(this);
+ Button def = designContext.getDefaultInstance(this);
String content = getCaption();
if (content != null) {
design.html(content);
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
- CheckBox def = (CheckBox) designContext.getDefaultInstance(this);
+ CheckBox def = designContext.getDefaultInstance(this);
Attributes attr = design.attributes();
DesignAttributeHandler.writeAttribute("checked", attr, getValue(),
def.getValue(), Boolean.class, designContext);
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
// handle tabindex
- Panel def = (Panel) designContext.getDefaultInstance(this);
+ Panel def = designContext.getDefaultInstance(this);
}
}
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
- TabSheet def = (TabSheet) designContext.getDefaultInstance(this);
+ TabSheet def = designContext.getDefaultInstance(this);
Attributes attr = design.attributes();
// write tabs
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
- AbstractTextField def = (AbstractTextField) designContext
+ AbstractTextField def = designContext
.getDefaultInstance(this);
Attributes attr = design.attributes();
DesignAttributeHandler.writeAttribute("value", attr, getValue(),
return "";
}
@SuppressWarnings("unchecked")
- Converter<String, Object> converter = (Converter<String, Object>) getFormatter()
+ Converter<String, Object> converter = getFormatter()
.findConverterFor(sourceType);
if (converter != null) {
return converter.convertToPresentation(value, new ValueContext());
public void of_noException() {
Result<String> result = Result.of(() -> "", exception -> null);
Assert.assertTrue(result instanceof SimpleResult);
- Assert.assertFalse(((SimpleResult<?>) result).isError());
+ Assert.assertFalse(result.isError());
}
@Test
throw new RuntimeException();
}, exception -> message);
Assert.assertTrue(result instanceof SimpleResult);
- Assert.assertTrue(((SimpleResult<?>) result).isError());
+ Assert.assertTrue(result.isError());
Assert.assertEquals(message, result.getMessage().get());
}
return "bar";
});
Assert.assertTrue(mapResult instanceof SimpleResult);
- Assert.assertFalse(((SimpleResult<?>) mapResult).isError());
+ Assert.assertFalse(mapResult.isError());
mapResult.ifOk(v -> Assert.assertEquals("bar", v));
}
return "somevalue";
});
Assert.assertTrue(mapResult instanceof SimpleResult);
- Assert.assertTrue(((SimpleResult<?>) mapResult).isError());
+ Assert.assertTrue(mapResult.isError());
mapResult.ifError(msg -> Assert.assertEquals("bar", msg));
}
}
ClassBasedViewProvider provider = new ClassBasedViewProvider("test",
TestView.class);
assertNull("Received view name for null view string",
- provider.getViewName((String) null));
+ provider.getViewName(null));
}
@Test