本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignStaticText类的典型用法代码示例。如果您正苦于以下问题:Java JRDesignStaticText类的具体用法?Java JRDesignStaticText怎么用?Java JRDesignStaticText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRDesignStaticText类属于net.sf.jasperreports.engine.design包,在下文中一共展示了JRDesignStaticText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFieldHeader
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
private void addFieldHeader(GridColumnVO columnVO) {
JRDesignBand bHeader = (JRDesignBand) jasperDesign.getColumnHeader();
JRDesignStaticText text = new JRDesignStaticText();
text.setText(columnVO.getTitle());
text.setWidth(columnVO.getWidth());
text.setHeight(bHeader.getHeight());
text.setX(px);
// Set syle
text.setFontName(gridReportVO.getHeaderBandStyle().getFontName());
text.setFontSize(new Float(gridReportVO.getHeaderBandStyle().getFontSize()));
text.setForecolor(gridReportVO.getHeaderBandStyle().getForeColor());
text.setBold(gridReportVO.getHeaderBandStyle().isBold());
text.setItalic(gridReportVO.getHeaderBandStyle().isItalic());
text.setUnderline(gridReportVO.getHeaderBandStyle().isUnderline());
if (log4j.isDebugEnabled())
log4j.debug("Field Header, field: " + columnVO.getTitle() + " Width: " + columnVO.getWidth()
+ " X: " + px);
bHeader.addElement(text);
}
示例2: findStaticTextElement
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Find a JRDesignStaticText element having exp as text.
*
* @param band
* @param exp
* @return the first matching element or null.
*/
public static JRDesignStaticText findStaticTextElement(JRElementGroup parent, String exp) {
JRElement[] elements = parent.getElements();
for (int i = 0; i < elements.length; ++i) {
JRElement ele = elements[i];
if (ele instanceof JRDesignStaticText) {
JRDesignStaticText st = (JRDesignStaticText) ele;
if (st.getText() != null && st.getText().equalsIgnoreCase(exp)) {
return st;
}
} else if (ele instanceof JRElementGroup) {
JRDesignStaticText ele2 = findStaticTextElement((JRElementGroup) ele, exp);
if (ele2 != null)
return ele2;
}
}
return null;
}
示例3: createDesign
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Create a very minimal jasperdesign where the static text is placed. It is cached
* since we don't need to create it everytime
*/
private static void createDesign()
{
jasperDesign = new JasperDesign();
JRDesignBand jrBand = new JRDesignBand();
jasperDesign.setTitle(jrBand);
textElement = new JRDesignStaticText();
jasperDesign.setLeftMargin(0);
jasperDesign.setRightMargin(0);
jasperDesign.setTopMargin(0);
jasperDesign.setBottomMargin(0);
jrBand.addElement(textElement);
jrBand.setSplitType(SplitTypeEnum.STRETCH);
textElement.setStretchType(StretchTypeEnum.NO_STRETCH);
textElement.setPrintRepeatedValues(false);
textElement.setPrintWhenDetailOverflows(true);
}
示例4: findStaticTextElement
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
public static JRDesignStaticText findStaticTextElement(JRElementGroup parent, String exp) {
JRElement[] elements = parent.getElements();
for (int i = 0; i < elements.length; ++i) {
JRElement ele = elements[i];
if (ele instanceof JRDesignStaticText) {
JRDesignStaticText st = (JRDesignStaticText) ele;
if (st.getText() != null && st.getText().equalsIgnoreCase(exp)) {
return st;
}
} else if (ele instanceof JRElementGroup) {
JRDesignStaticText ele2 = findStaticTextElement((JRElementGroup) ele, exp);
if (ele2 != null)
return ele2;
}
}
return null;
}
示例5: execute
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
@Override
public void execute() {
MStaticText modelText = new MStaticText();
JRDesignStaticText labelObject = (JRDesignStaticText)modelText.createJRElement(elementToCopy.getJasperDesign());
JRDesignTextField textObject = (JRDesignTextField)elementToCopy.getValue();
cloneTextField(labelObject, textObject);
modelText.setValue(labelObject);
Rectangle position = new Rectangle(textObject.getX(),textObject.getY(),textObject.getWidth(),textObject.getHeight());
int oldIndex = ModelUtils.getChildrenPosition(elementToCopy);
cmd = new CreateElementCommand(parent, modelText, position, oldIndex);
cmd.setJasperDesign(parent.getJasperDesign());
cmd.execute();
}
示例6: execute
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
@Override
public void execute() {
MTextField modelText = new MTextField();
JRDesignStaticText labelObject = (JRDesignStaticText)elementToCopy.getValue();
JRDesignTextField textObject = (JRDesignTextField)modelText.createJRElement(elementToCopy.getJasperDesign());
cloneTextField(textObject, labelObject);
modelText.setValue(textObject);
Rectangle position = new Rectangle(labelObject.getX(),labelObject.getY(),labelObject.getWidth(),labelObject.getHeight());
int oldIndex = ModelUtils.getChildrenPosition(elementToCopy);
cmd = new CreateElementCommand(parent, modelText, position, oldIndex);
cmd.setJasperDesign(parent.getJasperDesign());
cmd.execute();
}
示例7: getPropertySets
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Convenient way to get all the properties of an element.
* Properties positions could be reordered to have a better order.
*/
public static List<Sheet.Set> getPropertySets(JRDesignElement element, JasperDesign jd)
{
List<Sheet.Set> sets = new ArrayList<Sheet.Set>();
if (element instanceof JRDesignStaticText)
{
sets.add( getStaticTextPropertySet((JRDesignStaticText)element, jd ));
}
else if (element instanceof JRDesignTextField)
{
sets.add( getTextFieldPropertySet((JRDesignTextField)element, jd ));
}
if (element instanceof JRDesignTextElement)
{
sets.add( getTextPropertySet((JRDesignTextElement)element, jd) );
}
return sets;
}
示例8: createLabel
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
private JRDesignStaticText createLabel(JasperDesign jd, String text, int w, int h, String styleName)
{
JRDesignStaticText element = new JRDesignStaticText();
element.setX(0);
element.setY(0);
element.setWidth(w);
element.setHeight(h);
element.setText(text);
element.setHorizontalAlignment( HorizontalAlignEnum.CENTER );
element.setVerticalAlignment( VerticalAlignEnum.MIDDLE);
if (styleName != null && jd.getStylesMap().containsKey(styleName))
{
element.setStyle( (JRStyle) jd.getStylesMap().get(styleName) );
}
return element;
}
示例9: findStaticTextElement
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Find in band a JRDesignStaticText element having exp as text.
* @param band
* @param exp
* @return the first matching element or null.
*/
public static JRDesignStaticText findStaticTextElement(JRElementGroup parent, String exp)
{
JRElement[] elements = parent.getElements();
for (int i=0; i<elements.length; ++i)
{
JRElement ele = elements[i];
if (ele instanceof JRDesignStaticText)
{
JRDesignStaticText st = (JRDesignStaticText)ele;
if (st.getText() != null &&
st.getText().equalsIgnoreCase(exp))
{
return st;
}
}
else if (ele instanceof JRElementGroup)
{
JRDesignStaticText ele2 = findStaticTextElement((JRElementGroup)ele, exp);
if (ele2 != null) return ele2;
}
}
return null;
}
示例10: setValue
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
public void setValue(JRDesignStaticText element,Object val)
{
String oldValue = element.getText();
String newValue = val+"";
if (val == null)
{
newValue = "";
}
element.setText(newValue);
ObjectPropertyUndoableEdit opue = new ObjectPropertyUndoableEdit(
element, "Text", String.class, oldValue, newValue);
IReportManager.getInstance().addUndoableEdit(opue);
}
示例11: createTitle
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
public JRBand createTitle(final ReportInfo report, final String title) throws Exception {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(93);
final JRDesignTextField headerLine1 = h1("$P{report}.getInstitution()").toTextField();
addDesignElementTo(retval, headerLine1, 0, 0, 356, 30);
final JRDesignStaticText headerLine2 = h5(title + " for # ").toStaticText();
addDesignElementTo(retval, headerLine2, 0, 31, 426, 24);
final JRDesignTextField headerLine3 = h5("$P{report}.getTripId()").toTextField();
addDesignElementTo(retval, headerLine3, 275, 31, 146, 24);
final JRDesignStaticText headerLine4 = h5("Purpose: ").toStaticText();
addDesignElementTo(retval, headerLine4, 0, 52, 100, 20);
final JRDesignStaticText headerLine5 = h5("Dates: ").toStaticText();
addDesignElementTo(retval, headerLine5, 0, 72, 100, 20);
final JRDesignTextField headerLine4Field1 = h5("$P{report}.getPurpose()").toTextField();
addDesignElementTo(retval, headerLine4Field1, 65, 52, 472, 20);
final JRDesignTextField headerLine5Field1 = h5("$P{report}.getBeginDate()").toTextField(java.util.Date.class);
addDesignElementTo(retval, headerLine5Field1, 45, 72, 75, 20);
final JRDesignTextField headerLine5Field2 = h5("$P{report}.getEndDate()").toTextField(java.util.Date.class);
addDesignElementTo(retval, headerLine5Field2, 150, 72, 75, 20);
return retval;
}
示例12: createGroupHeader
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Constructs a header for the {@link JRDesignGroup}
*
* @return {@link JRBand} instance that is your header
*/
protected JRBand createGroupHeader(final ReportInfo report) {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(PAGEHEADER_HEIGHT * 4);
final JRDesignTextField expenseType = h4("$F{expenseType}").toTextField();
addDesignElementTo(retval, expenseType, 0, PAGEHEADER_HEIGHT, CT_HEADER_WIDTH, CELL_HEIGHT + 10);
final JRDesignStaticText nameField = h5("Expense").toStaticText();
addDesignElementTo(retval, nameField, (CELL_WIDTH * 3 + 5) * 0, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
final JRDesignStaticText dateField = h5("Date").toStaticText();
addDesignElementTo(retval, dateField, (CELL_WIDTH * 3 + 5) * 1, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
final JRDesignStaticText amountField = h5("Amount").toStaticText();
addDesignElementTo(retval, amountField, (CELL_WIDTH * 3 + 5) * 2, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
return retval;
}
示例13: createObject
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2);
JRDesignStaticText staticText = new JRDesignStaticText(jasperDesign);
return staticText;
}
示例14: applyColumnHeaderData
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
private void applyColumnHeaderData(EditTextElementData textElementData, JRDesignTextElement textElement, boolean execute) {
if (EditTextElementData.APPLY_TO_HEADING.equals(textElementData.getApplyTo())) {
if (textElement instanceof JRDesignTextField) {
JRDesignTextField designTextField = (JRDesignTextField)textElement;
if (execute) {
if (oldText == null) {
oldText = (designTextField.getExpression()).getText();
}
((JRDesignExpression)designTextField.getExpression()).setText("\"" + JRStringUtil.escapeJavaStringLiteral(textElementData.getHeadingName()) + "\"");
} else {
((JRDesignExpression)designTextField.getExpression()).setText(oldText);
}
} else if (textElement instanceof JRDesignStaticText){
JRDesignStaticText staticText = (JRDesignStaticText)textElement;
if (execute) {
if (oldText == null) {
oldText = staticText.getText();
}
staticText.setText(textElementData.getHeadingName());
} else {
staticText.setText(oldText);
}
}
}
textElement.setFontName(textElementData.getFontName());
textElement.setFontSize(textElementData.getFloatFontSize());
textElement.setBold(textElementData.getFontBold());
textElement.setItalic(textElementData.getFontItalic());
textElement.setUnderline(textElementData.getFontUnderline());
textElement.setForecolor(textElementData.getFontColor() != null ? JRColorUtil.getColor("#" + textElementData.getFontColor(), textElement.getForecolor()) : null);
textElement.setHorizontalTextAlign(HorizontalTextAlignEnum.getByName(textElementData.getFontHAlign()));
textElement.setBackcolor(textElementData.getFontBackColor() != null ? JRColorUtil.getColor("#" + textElementData.getFontBackColor(), Color.white) : null);
textElement.setMode(ModeEnum.getByName(textElementData.getMode()));
if (textElement instanceof JRDesignTextField && TableUtil.hasSingleChunkExpression((JRDesignTextField) textElement)) {
((JRDesignTextField) textElement).setPattern(textElementData.getFormatPattern());
}
}
示例15: findStaticTextElement
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入依赖的package包/类
/**
* Find a JRDesignStaticText inside a table element having exp as text.
*
* @param parent table where to search
* @param exp the text of the element
* @return the first matching element or null.
*/
public static JRDesignStaticText findStaticTextElement(StandardTable parent, String exp) {
StandardColumn col = getStandadColumn(parent.getColumns().get(0));
if (col != null){
JRDesignStaticText result = null;
if (col.getTableHeader() != null) result = DefaultTemplateEngine.findStaticTextElement(col.getTableHeader(), exp);
if (col.getColumnHeader() != null && result == null) result = DefaultTemplateEngine.findStaticTextElement(col.getColumnHeader(), exp);
if (col.getDetailCell() != null && result == null) result = DefaultTemplateEngine.findStaticTextElement(col.getDetailCell(), exp);
return result;
}
return null;
}