use of org.apache.tapestry5.Block in project tapestry-5 by apache.
the class BlockImplTest method to_string.
@Test
public void to_string() {
Resource r = new ClasspathResource("foo/pages/MyPage.tml");
Location l = new LocationImpl(r, 23);
BlockImpl block = new BlockImpl(l, "test block");
assertEquals(block.toString(), "Block[test block, at classpath:foo/pages/MyPage.tml, line 23]");
}
use of org.apache.tapestry5.Block in project tapestry-5 by apache.
the class Error method updateElement.
@HeartbeatDeferred
private void updateElement(final Element element) {
// The field may add an id attribute because of this call.
element.attribute("data-error-block-for", field.getClientId());
String id = field.getClientId() + "-help-block";
element.attribute("id", id);
Element input = element.getDocument().getElementById(field.getClientId());
if (input != null) {
input.attribute("aria-describedby", id);
}
}
use of org.apache.tapestry5.Block in project tapestry-5 by apache.
the class Error method beginRender.
boolean beginRender(final MarkupWriter writer) {
// Initially invisible; will be shown on client if an error exists.
Element element = writer.element("p", "class", !("help-block".equals(cssClass)) ? ("help-block " + cssClass) : cssClass + " invisible", "role", "alert");
resources.renderInformalParameters(writer);
// Wait until the end of the heartbeat to ensure the Field has had a chance to render.
updateElement(element);
writer.end();
return false;
}
use of org.apache.tapestry5.Block in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method ringBell.
@Override
public void ringBell(Bell block) {
org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
Direction face = Direction.byName(bellData.getFacing().name());
Direction dir = Direction.NORTH;
switch(bellData.getAttachment()) {
case DOUBLE_WALL:
case SINGLE_WALL:
switch(face) {
case NORTH:
case SOUTH:
dir = Direction.EAST;
break;
}
break;
case FLOOR:
dir = face;
break;
}
CraftBlock craftBlock = (CraftBlock) block.getBlock();
((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
use of org.apache.tapestry5.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB3100 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
return null;
}
// getData from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
Aggregations