本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignStaticText.getText方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignStaticText.getText方法的具体用法?Java JRDesignStaticText.getText怎么用?Java JRDesignStaticText.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignStaticText
的用法示例。
在下文中一共展示了JRDesignStaticText.getText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}
示例5: 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());
}
}
示例6: getPropertyValue
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
@Override
public Object getPropertyValue(Object id) {
JRDesignStaticText jrElement = (JRDesignStaticText) getValue();
if (id.equals(JRBaseStaticText.PROPERTY_TEXT))
return jrElement.getText();
return super.getPropertyValue(id);
}
示例7: cloneTextField
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
/**
* Copy all the common attributes from the static text to the new text field element
*
* @param textObject the new text field element, that will substitute the static text
* @param labelObject the substituted static text
*/
private void cloneTextField(JRDesignTextField textObject, JRDesignStaticText labelObject)
{
String staticTextValue = labelObject.getText();
//If the text is not valid for an expression it will be handled as a string
if (!isValidExpression(staticTextValue)){
if (!staticTextValue.startsWith("\"")) staticTextValue = "\"".concat(staticTextValue); //$NON-NLS-1$ //$NON-NLS-2$
if (!staticTextValue.endsWith("\"")) staticTextValue = staticTextValue.concat("\""); //$NON-NLS-1$ //$NON-NLS-2$
}
textObject.setExpression(ExprUtil.setValues(textObject.getExpression(), staticTextValue));
textObject.setHeight(labelObject.getHeight());
textObject.setWidth(labelObject.getWidth());
textObject.setX(labelObject.getX());
textObject.setY(labelObject.getY());
textObject.setFontName(labelObject.getFontName());
textObject.setFontSize(labelObject.getFontsize());
textObject.setBackcolor(labelObject.getBackcolor());
textObject.setForecolor(labelObject.getForecolor());
JRStyle originStyle = labelObject.getStyle();
textObject.setStyle(originStyle != null ? (JRStyle)originStyle.clone() : null);
textObject.setStyleNameReference(labelObject.getStyleNameReference());
textObject.setBold(labelObject.isBold());
textObject.setItalic(labelObject.isItalic());
textObject.setUnderline(labelObject.isUnderline());
textObject.setStrikeThrough(labelObject.isStrikeThrough());
textObject.setHorizontalAlignment(labelObject.getHorizontalAlignmentValue());
textObject.setVerticalAlignment(labelObject.getVerticalAlignmentValue());
textObject.setMode(labelObject.getModeValue());
textObject.setRotation(labelObject.getRotationValue());
textObject.setStretchType(labelObject.getStretchTypeValue());
textObject.setKey(labelObject.getKey());
textObject.setMarkup(labelObject.getMarkup());
textObject.setPdfEmbedded(labelObject.isPdfEmbedded());
textObject.setPdfEncoding(labelObject.getPdfEncoding());
textObject.setPdfFontName(labelObject.getPdfFontName());
textObject.setPositionType(labelObject.getPositionTypeValue());
textObject.setPrintInFirstWholeBand(labelObject.isPrintInFirstWholeBand());
textObject.setPrintRepeatedValues(labelObject.isPrintRepeatedValues());
textObject.setPrintWhenDetailOverflows(labelObject.isPrintWhenDetailOverflows());
cloneBox(textObject.getLineBox(),labelObject.getLineBox());
cloneParagraph(textObject.getParagraph(), labelObject.getParagraph());
JRExpression originExpression = labelObject.getPrintWhenExpression();
textObject.setPrintWhenExpression(originExpression != null ? (JRExpression)originExpression.clone() : null);
JRGroup originGroup = labelObject.getPrintWhenGroupChanges();
textObject.setPrintWhenGroupChanges(originGroup != null ? (JRGroup)originGroup.clone() : null);
textObject.setRemoveLineWhenBlank(labelObject.isRemoveLineWhenBlank());
}
示例8: isColumnHeaderPlaceholder
import net.sf.jasperreports.engine.design.JRDesignStaticText; //导入方法依赖的package包/类
/**
* Check if a JRDesignText element is a placeholder for the static text appearance in
* the column header
*
* @param element the element
* @return true if it is a place holder, false otherwise
*/
private boolean isColumnHeaderPlaceholder(JRDesignStaticText element){
if (element.getText() != null && element.getText().toLowerCase().equals(TEXT_MARKER)){
return true;
}
return false;
}