• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LayoutContext类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.xhtmlrenderer.layout.LayoutContext的典型用法代码示例。如果您正苦于以下问题:Java LayoutContext类的具体用法?Java LayoutContext怎么用?Java LayoutContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

LayoutContext类属于org.xhtmlrenderer.layout包,在下文中一共展示了LayoutContext类的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getParentForm

点赞 3

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
protected Element getParentForm(Element e, LayoutContext context) {
    Node node = e;
    XhtmlNamespaceHandler nsh = (XhtmlNamespaceHandler) context
            .getNamespaceHandler();

    do {
        node = node.getParentNode();
    } while (node.getNodeType() == Node.ELEMENT_NODE
            && !nsh.isFormElement((Element) node));

    if (node.getNodeType() != Node.ELEMENT_NODE) {
        return null;
    }

    return (Element) node;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:17,
代码来源:XHTMLReplacedElementFactoryImpl.java

示例2: layout

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
private void layout(int width) {
	Rectangle rect = new Rectangle(0, 0, width, DEFAULT_HEIGHT);
	sharedContext.set_TempCanvas(rect);
	LayoutContext c = newLayoutContext();
	BlockBox root = BoxBuilder.createRootBox(c, doc);
	root.setContainingBlock(new ViewportBox(rect));
	root.layout(c);
	this.root = root;
}
 

开发者ID:TIBCOSoftware,
项目名称:jasperreports,
代码行数:10,
代码来源:CustomJava2DRenderer.java

示例3: newLayoutContext

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
private LayoutContext newLayoutContext() {
	LayoutContext result = sharedContext.newLayoutContextInstance();
	result.setFontContext(new Java2DFontContext(outputDevice.getGraphics()));

	sharedContext.getTextRenderer().setup(result.getFontContext());

	return result;
}
 

开发者ID:TIBCOSoftware,
项目名称:jasperreports,
代码行数:9,
代码来源:CustomJava2DRenderer.java

示例4: calculateSize

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public void calculateSize(LayoutContext c, CalculatedStyle style, int cssWidth, int cssHeight) {
	width = cssWidth;
	height = cssHeight;
	if (width < 0) {
		width = control.getIdealWidth();
	}
	if (height < 0) {
		height = control.getIdealHeight();
	}
	final BaseElement element = control.getUIElement();
	element.setDimensions(width, height);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:13,
代码来源:XHTMLFormControlReplacementElement.java

示例5: createReplacedElement

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
public ReplacedElement createReplacedElement(LayoutContext c, BlockBox box,
           UserAgentCallback uac, int cssWidth, int cssHeight) {
       Element e = box.getElement();
       if (e == null) {
           return null;
       }

       if (c.getNamespaceHandler().isImageElement(e)) {
           return replaceImage(uac, c, e, cssWidth, cssHeight);
       }

       return null;
   }
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:15,
代码来源:XHTMLReplacedElementFactory.java

示例6: newLayoutcontext

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
protected LayoutContext newLayoutcontext() {
	LayoutContext result = sharedContext.newLayoutContextInstance();
	if (layoutCanvas == null) {
		layoutCanvas = new XHTMLCanvas(this);
	}
	result.setFontContext(new XHTMLFontContext(layoutCanvas));
	sharedContext.getTextRenderer().setup(result.getFontContext());

	return result;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:11,
代码来源:XHTMLRenderer.java

示例7: getInitialExtents

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
protected java.awt.Rectangle getInitialExtents(LayoutContext c) {
	if (!c.isPrint()) {
		return getClientArea();
	} else {
		PageBox first = Layer.createPageBox(c, "first");
		return new java.awt.Rectangle(0, 0, first.getContentWidth(c), first.getContentHeight(c));
	}
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:9,
代码来源:XHTMLRenderer.java

示例8: createElement

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
protected BaseElement createElement(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac) {

	final ButtonControl bc = (ButtonControl) control;
	final PushButton button = new PushButton(parent.getScreen());
	button.onMouseReleased(evt -> {
		if (bc.getType().equals("submit")) {
			if (bc.press()) {
				bc.getForm().submit();
			}
		} else if (bc.getType().equals("reset")) {
			if (bc.press()) {
				bc.getForm().reset();
			}
		} else {
			bc.press();
		}
	});
	button.setText(bc.getLabel());
	if (bc.isExtended()) {
		// when defined with <button>, allow the first image to be used
		NodeList images = bc.getElement().getElementsByTagName("img");
		if (images.getLength() > 0) {
			org.w3c.dom.Element img = (org.w3c.dom.Element) images.item(0);
			String uri = c.getNamespaceHandler().getImageSourceURI(img);
			ImageResource res = uac.getImageResource(uri);
			XHTMLFSImage fsi = (XHTMLFSImage) res.getImage();
			// copy the image to prevent disposal, and apply a disabled
			// effect if needed
			button.getElementTexture().setImage(_image);
			// _image = new Image(button.getDisplay(), fsi.getImage(), (bc
			// .isEnabled() ? SWT.IMAGE_COPY : SWT.IMAGE_DISABLE));
		}
	}

	return button;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:39,
代码来源:TGGButtonControl.java

示例9: createElement

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
protected BaseElement createElement(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac) {
	final SelectControl sc = (SelectControl) control;
	@SuppressWarnings("unchecked")
	Map<String, String> options = sc.getOptions();
	values = new ArrayList<>(options.keySet());
	labels = new ArrayList<>(options.values());
	if (sc.getSize() > 1 || sc.isMultiple()) {
		return makeList(parent, sc);
	} else {
		return makeCombo(parent, sc);
	}
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:15,
代码来源:TGGSelectControl.java

示例10: layout

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public void layout() {
    LayoutContext c = newLayoutContext();
    BlockBox root = BoxBuilder.createRootBox(c, _doc);
    root.setContainingBlock(new ViewportBox(getInitialExtents(c)));
    root.layout(c);
    _dim = root.getLayer().getPaintingDimension(c);
    root.getLayer().trimEmptyPages(c, _dim.height);
    root.getLayer().layoutPages(c);
    _root = root;
}
 

开发者ID:rmage,
项目名称:gnvc-ims,
代码行数:11,
代码来源:ITextRenderer.java

示例11: newLayoutContext

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
private LayoutContext newLayoutContext() {
    LayoutContext result = _sharedContext.newLayoutContextInstance();
    result.setFontContext(new ITextFontContext());

    _sharedContext.getTextRenderer().setup(result.getFontContext());

    return result;
}
 

开发者ID:rmage,
项目名称:gnvc-ims,
代码行数:9,
代码来源:ITextRenderer.java

示例12: detach

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
public void detach(LayoutContext c) {
   }
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:4,
代码来源:XHTMLImageReplacedElement.java

示例13: createReplacedElement

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
public ReplacedElement createReplacedElement(LayoutContext c, BlockBox box,
        UserAgentCallback uac, int cssWidth, int cssHeight) {
    ReplacedElement replacedElement = super.createReplacedElement(c, box, uac, cssWidth,
            cssHeight);
    if (replacedElement == null
            && c.getNamespaceHandler() instanceof XhtmlNamespaceHandler
            && !c.isPrint()) {
        XhtmlNamespaceHandler nsh = (XhtmlNamespaceHandler) c
                .getNamespaceHandler();
        Element e = box.getElement();
        if (e == null) {
            return null;
        }

        if (controls != null) {
            replacedElement = controls.get(e);
        }
        if (replacedElement != null) {
            if (replacedElement instanceof XHTMLFormControlReplacementElement) {
                ((XHTMLFormControlReplacementElement) replacedElement).calculateSize(c, box
                        .getStyle(), cssWidth, cssHeight);
            }
            return replacedElement;
        }

        Element parentForm = getParentForm(e, c);
        XhtmlForm form = forms.get(parentForm);
        if (form == null) {
            form = nsh.createForm(parentForm);
            forms.put(parentForm, form);
        }

        FormControl control = form.createControl(e);
        if (control == null) {
            return null;
        }
        
        TGGFormControl formControl;
        if (control instanceof TextControl) {
            formControl = new TGGTextControl(control, renderer, c, box
                    .getStyle(), uac, box);
        } else if (control instanceof ButtonControl) {
            formControl = new TGGButtonControl(control, renderer, c, box
                    .getStyle(), uac, box);
        } else if (control instanceof CheckControl) {
            formControl = new TGGCheckControl(control, renderer, c, box
                    .getStyle(), uac, box);
        } else if (control instanceof SelectControl) {
            formControl = new TGGSelectControl(control, renderer, c, box
                    .getStyle(), uac, box);
        } else {
            return null;
        }
        XHTMLFormControlReplacementElement fcre = new XHTMLFormControlReplacementElement(
                formControl, renderer);
        System.err.println("calcing size for " + fcre.getControl().getClass() + " - " + cssWidth + ", " + cssHeight);
        fcre.calculateSize(c, box.getStyle(), cssWidth, cssHeight);
        replacedElement = fcre;
        controls.put(e, replacedElement);
    }
    return replacedElement;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:64,
代码来源:XHTMLReplacedElementFactoryImpl.java

示例14: detach

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
public void detach(LayoutContext c) {
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:4,
代码来源:XHTMLFormControlReplacementElement.java

示例15: getLayoutContext

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public LayoutContext getLayoutContext() {
	return layoutContext;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:4,
代码来源:XHTMLRenderer.java

示例16: TGGCheckControl

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public TGGCheckControl(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac, BlockBox box) {
	super(control, parent, c, style, uac, box);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:5,
代码来源:TGGCheckControl.java

示例17: TGGButtonControl

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public TGGButtonControl(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac, BlockBox box) {
	super(control, parent, c, style, uac, box);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:5,
代码来源:TGGButtonControl.java

示例18: TGGTextControl

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public TGGTextControl(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac, BlockBox box) {
	super(control, parent, c, style, uac, box);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:5,
代码来源:TGGTextControl.java

示例19: getContext

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public LayoutContext getContext() {
	return context;
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:4,
代码来源:TGGControl.java

示例20: createElement

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
protected abstract BaseElement createElement(FormControl control, XHTMLRenderer parent, LayoutContext c,
CalculatedStyle style, UserAgentCallback uac);
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:3,
代码来源:TGGControl.java

示例21: TGGSelectControl

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
public TGGSelectControl(FormControl control, XHTMLRenderer parent, LayoutContext c, CalculatedStyle style,
		UserAgentCallback uac, BlockBox box) {
	super(control, parent, c, style, uac, box);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:5,
代码来源:TGGSelectControl.java

示例22: getTextWidth

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
private int getTextWidth(LayoutContext c, CalculatedStyle cs, String s) {
	return c.getTextRenderer().getWidth(c.getFontContext(), c.getFont(cs.getFont(c)), s);
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:4,
代码来源:XHTMLSelectionHighlighter.java

示例23: getInitialExtents

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
@Override
protected java.awt.Rectangle getInitialExtents(LayoutContext c) {
	PageBox first = Layer.createPageBox(c, "first");
	return new java.awt.Rectangle(0, 0, first.getContentWidth(c), first.getContentHeight(c));
}
 

开发者ID:rockfireredmoon,
项目名称:icetone,
代码行数:6,
代码来源:XHTMLToolTip.java

示例24: getInitialExtents

点赞 2

import org.xhtmlrenderer.layout.LayoutContext; //导入依赖的package包/类
private Rectangle getInitialExtents(LayoutContext c) {
    PageBox first = Layer.createPageBox(c, "first");

    return new Rectangle(0, 0, first.getContentWidth(c), first.getContentHeight(c));
}
 

开发者ID:rmage,
项目名称:gnvc-ims,
代码行数:6,
代码来源:ITextRenderer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)