ImageAttributes attributes = new ImageAttributes(); for (int i = 1; i < args.length; i++) { String arg = args[i].trim(); attributes.setBorder(Integer.parseInt(m.group(1))); continue; int size = Integer.parseInt(m.group(2)); if (m.group(1) == null || m.group(1).length() == 0 || m.group(1).equalsIgnoreCase("width")) { //$NON-NLS-1$ attributes.setWidth(size); attributes.setWidthPercentage(m.group(3) != null && m.group(3).equals("%")); //$NON-NLS-1$ } else { attributes.setHeight(size); attributes.setHeightPercentage(m.group(3) != null && m.group(3).equals("%")); //$NON-NLS-1$ attributes.appendCssStyle("float:" + m.group(1) + ";"); //$NON-NLS-1$ //$NON-NLS-2$ continue; if (parts.length == 2) { if (parts[0].equalsIgnoreCase("id")) { //$NON-NLS-1$ attributes.setId(parts[1]); attributes.appendCssClass(parts[1]); attributes.setAlt(parts[1]); attributes.setTitle(parts[1]);
private void applyImageAttributes(Attributes imageAttributes) { applyAttributes(imageAttributes); if (imageAttributes instanceof ImageAttributes) { ImageAttributes attributes = (ImageAttributes) imageAttributes; if (attributes.getAlt() != null) { writer.writeAttribute("alt", attributes.getAlt()); //$NON-NLS-1$ } if (attributes.getHeight() > 0) { writer.writeAttribute("height", Integer.toString(attributes.getHeight())); //$NON-NLS-1$ } if (attributes.getWidth() > 0) { writer.writeAttribute("width", Integer.toString(attributes.getWidth())); //$NON-NLS-1$ } if (attributes.getAlign() != null) { switch (attributes.getAlign()) { case Left: writer.writeAttribute("align", "center"); //$NON-NLS-1$ //$NON-NLS-2$ break; case Right: writer.writeAttribute("align", "right"); //$NON-NLS-1$ //$NON-NLS-2$ break; case Center: writer.writeAttribute("align", "center"); //$NON-NLS-1$ //$NON-NLS-2$ break; } writer.writeAttribute("placement", "break"); //$NON-NLS-1$ //$NON-NLS-2$ } } }
public void setOption(String key, String value) { if ("alt".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setAlt(value); } else if ("align".equalsIgnoreCase(key)) { //$NON-NLS-1$ if ("middle".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Middle); } else if ("left".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Left); } else if ("right".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Right); } else if ("center".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Center); } } else { try { if ("border".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setBorder(Integer.parseInt(value)); } else if ("height".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setHeight(Integer.parseInt(value)); } else if ("width".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setWidth(Integer.parseInt(value)); } } catch (NumberFormatException e) { // ignore } } }
@Override public void emit() { String alignment = group(ALIGNMENT_GROUP); String imageUrl = group(CONTENT_GROUP); String altAndTitle = group(CONTENT_GROUP + 1); String href = group(CONTENT_GROUP + 3); String namedLinkUrl = href == null ? null : ((TextileContentState) getState()).getNamedLinkUrl(href); if (namedLinkUrl != null) { href = namedLinkUrl; } ImageAttributes attributes = new ImageAttributes(); attributes.setTitle(altAndTitle); attributes.setAlt(altAndTitle); if (alignment != null) { if ("<".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Left); } else if (">".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Right); } else if ("=".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Center); } } Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); if (href != null) { builder.imageLink(attributes, href, imageUrl); } else { builder.image(attributes, imageUrl); } } }
String imageOptions = group(OPTIONS_GROUP); final ImageAttributes attributes = new ImageAttributes(); attributes.setInline( (getLineStartOffset() == 0) ? false : true ); if (attributes.getAlign() == Align.Center) { attributes.setAlign(null); builder.image(attributes, imageUrl); builder.endBlock();
String imageOptions = group(OPTIONS_GROUP); final ImageAttributes attributes = new ImageAttributes(); if (imageOptions != null) { Options.parseOptions(imageOptions, new Handler() { if (attributes.getAlign() == Align.Center) { attributes.setAlign(null); builder.image(attributes, imageUrl); builder.endBlock();
linkAttributes.setTitle(previous.getLabel()); if (navigationImages) { ImageAttributes imageAttributes = new ImageAttributes(); imageAttributes.setAlt(Messages.getString("SplittingHtmlDocumentBuilder.Previous")); //$NON-NLS-1$ out.imageLink(linkAttributes, imageAttributes, previous.getSplitTarget(), computeNavImagePath(Messages.getString("SplittingHtmlDocumentBuilder.Previous_Image"))); //$NON-NLS-1$ linkAttributes.setTitle(rootBuilder.getTitle()); if (navigationImages) { ImageAttributes imageAttributes = new ImageAttributes(); imageAttributes.setAlt(rootBuilder.getTitle()); out.imageLink(linkAttributes, imageAttributes, rootFile.getName(), computeNavImagePath(Messages.getString("SplittingHtmlDocumentBuilder.Home_Image"))); //$NON-NLS-1$ linkAttributes.setTitle(next.getLabel()); if (navigationImages) { ImageAttributes imageAttributes = new ImageAttributes(); imageAttributes.setAlt(Messages.getString("SplittingHtmlDocumentBuilder.Next")); //$NON-NLS-1$ out.imageLink(linkAttributes, imageAttributes, next.getSplitTarget(), computeNavImagePath(Messages.getString("SplittingHtmlDocumentBuilder.Next_Image"))); //$NON-NLS-1$
/** * @see #imageLink(Attributes, String, String) */ public final void imageLink(String href, String imageUrl) { imageLink(new LinkAttributes(), new ImageAttributes(), href, imageUrl); }
@Override public void emit() { String iconType = group(1); String iconUrl = ((TWikiLanguage) markupLanguage).toIconUrl(iconType); builder.image(new ImageAttributes(), iconUrl); } }
public void setOption(String key, String value) { if ("alt".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setAlt(value); } else if ("align".equalsIgnoreCase(key)) { //$NON-NLS-1$ if ("middle".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Middle); } else if ("left".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Left); } else if ("right".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Right); } else if ("center".equalsIgnoreCase(value)) { //$NON-NLS-1$ attributes.setAlign(Align.Center); } } else { try { if ("border".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setBorder(Integer.parseInt(value)); } else if ("height".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setHeight(Integer.parseInt(value)); } else if ("width".equalsIgnoreCase(key)) { //$NON-NLS-1$ attributes.setWidth(Integer.parseInt(value)); } } catch (NumberFormatException e) { // ignore } } }
@Override public void emit() { String hyperlinkBoundaryText = group(1); String hyperlinkSrc = group(2 + Textile.ATTRIBUTES_GROUP_COUNT); String href = group(3 + Textile.ATTRIBUTES_GROUP_COUNT); String namedLinkUrl = ((TextileContentState) getState()).getNamedLinkUrl(href); if (namedLinkUrl != null) { href = namedLinkUrl; } if (hyperlinkBoundaryText.equals("\"")) { //$NON-NLS-1$ LinkAttributes attributes = new LinkAttributes(); attributes.setHref(href); Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); builder.beginSpan(SpanType.LINK, attributes); getMarkupLanguage().emitMarkupLine(parser, state, start(2), hyperlinkSrc, 0); builder.endSpan(); } else { final ImageAttributes attributes = new ImageAttributes(); Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); builder.imageLink(attributes, href, hyperlinkSrc); } } }
if (attributes instanceof ImageAttributes) { ImageAttributes imageAttributes = (ImageAttributes) attributes; border = imageAttributes.getBorder(); align = imageAttributes.getAlign(); if (imageAttributes.getHeight() != -1) { writer.writeAttribute("height", Integer.toString(imageAttributes.getHeight())); //$NON-NLS-1$ if (imageAttributes.getWidth() != -1) { writer.writeAttribute("width", Integer.toString(imageAttributes.getWidth())); //$NON-NLS-1$ if (imageAttributes.getAlt() != null) { haveAlt = true; writer.writeAttribute("alt", imageAttributes.getAlt()); //$NON-NLS-1$