本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignTextField类的典型用法代码示例。如果您正苦于以下问题:Java JRDesignTextField类的具体用法?Java JRDesignTextField怎么用?Java JRDesignTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRDesignTextField类属于net.sf.jasperreports.engine.design包,在下文中一共展示了JRDesignTextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyOwnTextElementStyle
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
public static void copyOwnTextElementStyle(EditTextElementData textElementData, JRDesignTextElement textElement, Locale locale) {
textElementData.setFontName(textElement.getOwnFontName());
textElementData.setFontSize(textElement.getOwnFontsize() != null ? NumberFormat.getNumberInstance(locale).format(textElement.getOwnFontsize()) : null);
textElementData.setFloatFontSize(textElement.getOwnFontsize() != null ? textElement.getOwnFontsize() : null);
textElementData.setFontBold(textElement.isOwnBold());
textElementData.setFontItalic(textElement.isOwnItalic());
textElementData.setFontUnderline(textElement.isOwnUnderline());
textElementData.setFontColor(textElement.getOwnForecolor() != null ? JRColorUtil.getColorHexa(textElement.getOwnForecolor()) : null);
textElementData.setFontBackColor(textElement.getOwnBackcolor() != null ? JRColorUtil.getColorHexa(textElement.getOwnBackcolor()) : null);
textElementData.setFontHAlign(textElement.getOwnHorizontalTextAlign() != null ? textElement.getOwnHorizontalTextAlign().getName() : null);
textElementData.setMode(textElement.getOwnModeValue() != null ? textElement.getOwnModeValue().getName() : null);
if (textElement instanceof JRDesignTextField && TableUtil.hasSingleChunkExpression((JRDesignTextField) textElement)) {
textElementData.setFormatPattern(((JRDesignTextField) textElement).getOwnPattern());
}
}
示例2: copyTextElementStyle
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
public static void copyTextElementStyle(EditTextElementData textElementData, JRDesignTextElement textElement, Locale locale) {
textElementData.setFontName(JRStringUtil.htmlEncode(textElement.getFontName()));
textElementData.setFontSize(NumberFormat.getNumberInstance(locale).format(textElement.getFontsize()));
textElementData.setFloatFontSize(textElement.getFontsize());
textElementData.setFontBold(textElement.isBold());
textElementData.setFontItalic(textElement.isItalic());
textElementData.setFontUnderline(textElement.isUnderline());
textElementData.setFontColor(JRColorUtil.getColorHexa(textElement.getForecolor()));
textElementData.setFontBackColor(JRColorUtil.getColorHexa(textElement.getBackcolor()));
textElementData.setFontHAlign(textElement.getHorizontalTextAlign().getName());
textElementData.setMode(textElement.getModeValue().getName());
if (textElement instanceof JRDesignTextField && TableUtil.hasSingleChunkExpression((JRDesignTextField) textElement)) {
textElementData.setFormatPattern(JRStringUtil.htmlEncode(((JRDesignTextField) textElement).getPattern()));
}
}
示例3: createDetailCells
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
private void createDetailCells(JRDesignCrosstab jdc) {
List<JRCrosstabCell> cells = jdc.getCellsList();
JRCrosstabMeasure[] measures = jdc.getMeasures();
if (measures != null && cells != null)
for (JRCrosstabCell c : cells) {
int y = 0;
if (c.getHeight() != null && measures.length > 0) {
int h = c.getHeight() / measures.length;
for (int i = 0; i < measures.length; i++) {
JRDesignExpression exp = new JRDesignExpression();
exp.setText("$V{" + measures[i].getName() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
JRDesignTextField tf = (JRDesignTextField) new MTextField()
.createJRElement(getConfig().getJasperDesign());
tf.setX(0);
tf.setY(y);
tf.setWidth(c.getWidth());
tf.setHeight(h);
tf.setExpression(exp);
((JRDesignCellContents) c.getContents()).addElement(tf);
y += h;
}
}
}
}
示例4: isDetailPlaceholder
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Check if a JRDesignTextField element is a placeholder for the text field appearance in
* the detail
*
* @param element the element
* @return true if it is a place holder, false otherwise
*/
private boolean isDetailPlaceholder(JRDesignTextField element){
JRExpression expression = element.getExpression();
if (expression != null && expression.getText() != null){
String text = expression.getText().toLowerCase();
if (text.startsWith("\"")) { //$NON-NLS-1$
text = text.substring(1);
}
if (text.endsWith("\"")) { //$NON-NLS-1$
text = text.substring(0, text.length() - 1);
}
if (text.equals(FIELD_MARKER) || text.equals(FIELD_COMPATIBILITY_MARKER)){
return true;
}
}
return false;
}
示例5: isGroupPlaceholder
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Check if a JRDesignTextField element is a placeholder for the text field appearance in
* the detail
*
* @param element the element
* @return true if it is a place holder, false otherwise
*/
private boolean isGroupPlaceholder(JRDesignTextField element){
JRExpression expression = element.getExpression();
if (expression != null && expression.getText() != null){
String text = expression.getText().toLowerCase();
if (text.startsWith("\"")) { //$NON-NLS-1$
text = text.substring(1);
}
if (text.endsWith("\"")) { //$NON-NLS-1$
text = text.substring(0, text.length() - 1);
}
if (text.equals(GROUP_MARKER)){
return true;
}
}
return false;
}
示例6: findTextFieldElement
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Find a JRDesignTextField element having exp as expression value.
*
* @param band
* @param exp
* @return the first matching element or null.
*/
public static JRDesignTextField findTextFieldElement(JRElementGroup band, String exp) {
JRElement[] elements = band.getElements();
for (int i = 0; i < elements.length; ++i) {
JRElement ele = elements[i];
if (ele instanceof JRDesignTextField) {
String s = ExprUtil.getExpressionText(((JRDesignTextField) ele).getExpression());
if (s.startsWith("\"")) { //$NON-NLS-1$
s = s.substring(1);
}
if (s.endsWith("\"")) { //$NON-NLS-1$
s = s.substring(0, s.length() - 1);
}
if (s.equalsIgnoreCase(exp))
return (JRDesignTextField) ele;
} else if (ele instanceof JRElementGroup) {
JRDesignTextField ele2 = findTextFieldElement((JRElementGroup) ele, exp);
if (ele2 != null)
return ele2;
}
}
return null;
}
示例7: showDialog
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
public int showDialog() {
if(!ExpressionEditorSupportUtil.isExpressionEditorDialogOpen()) {
JRExpressionEditor wizard = new JRExpressionEditor();
wizard.setValue(JRCloneUtils.nullSafeClone(originalExpression));
ExpressionContext ec = ModelUtils.getElementExpressionContext((JRDesignTextField) textField.getValue(), textField);
wizard.setExpressionContext(ec);
WizardDialog dialog = ExpressionEditorSupportUtil.getExpressionEditorWizardDialog(UIUtils.getShell(), wizard);
if (dialog.open() == Dialog.OK) {
isExpressionChanged = true;
newExpression=wizard.getValue();
return Window.OK;
}
}
isExpressionChanged=false;
return Window.CANCEL;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:EditTextFieldExpressionCommand.java
示例8: propertyChange
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Wait the changes of the expression
*/
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (JRDesignExpression.PROPERTY_TEXT.equals(evt.getPropertyName()) && element != null){
ANode parent = element.getParent();
//Refresh also the container if it is a table or something like that
while (parent != null){
if (parent instanceof IGraphicalPropertiesHandler){
((IGraphicalPropertiesHandler)parent).setChangedProperty(true);
if (parent.getValue() instanceof JRChangeEventsSupport){
((JRChangeEventsSupport)parent.getValue()).getEventSupport().firePropertyChange(FORCE_GRAPHICAL_REFRESH, null, null);
}
}
parent = parent.getParent();
}
//Notify the change to the element, no need to set the the refresh to true, it will be done by
//the property change since the PROPERTY_EXPRESSION is a graphical property
element.getValue().getEventSupport().firePropertyChange(JRDesignTextField.PROPERTY_EXPRESSION, evt.getOldValue(), evt.getNewValue());
}
}
示例9: findTextFieldElement
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Find in band a JRDesignTextField element having exp as expression value.
*
* @param band
* @param exp
* @return the first matching element or null.
*/
public static JRDesignTextField findTextFieldElement(JRElementGroup band, String exp) {
JRElement[] elements = band.getElements();
for (int i = 0; i < elements.length; ++i) {
JRElement ele = elements[i];
if (ele instanceof JRDesignTextField) {
String s = ExprUtil.getExpressionText(((JRDesignTextField) ele).getExpression());
if (s.startsWith("\"")) {
s = s.substring(1);
}
if (s.endsWith("\"")) {
s = s.substring(0, s.length() - 1);
}
if (s.equalsIgnoreCase(exp))
return (JRDesignTextField) ele;
} else if (ele instanceof JRElementGroup) {
JRDesignTextField ele2 = findTextFieldElement((JRElementGroup) ele, exp);
if (ele2 != null)
return ele2;
}
}
return null;
}
示例10: execute
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的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();
}
示例11: execute
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的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();
}
示例12: fixElementsExpressions
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
public static void fixElementsExpressions(JRDesignElementGroup group, String oldName, String newName, byte chunckType, String newClassName) {
List list = group.getChildren();
for (int i=0; i<list.size(); ++i)
{
Object obj = list.get(i);
if (obj == null) continue;
if (obj instanceof JRDesignElementGroup)
{
fixElementsExpressions((JRDesignElementGroup)obj,oldName,newName,chunckType,newClassName);
}
else if (obj instanceof JRDesignTextField)
{
fixElementExpressionText((JRDesignTextField)obj,oldName,newName,chunckType,newClassName);
}
else if (obj instanceof JRDesignImage)
{
fixElementExpressionImage((JRDesignImage)obj,oldName,newName,chunckType,newClassName);
}
}
}
示例13: setString
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
@Override
public void setString(String value) {
if (getBucket().getExpression() != null)
{
getBucket().setValueClassName(value);
((JRDesignExpression)getBucket().getExpression()).setValueClassName(value);
// Introspect the crosstab and change the class for all the expressions which use this group name...
List<JRDesignElement> elements = ModelUtils.getAllElements(crosstab);
for (JRDesignElement ele : elements)
{
if (ele instanceof JRDesignTextField)
{
JRDesignTextField dtf = (JRDesignTextField)ele;
if (dtf.getExpression() != null &&
dtf.getExpression().getText() != null &&
dtf.getExpression().getText().trim().equals("$V{" + group.getName() + "}"))
{
((JRDesignExpression)dtf.getExpression()).setValueClassName(value);
}
}
}
}
}
示例14: getTextFieldPropertySet
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的package包/类
/**
* Get the static text properties...
*/
public static Sheet.Set getTextFieldPropertySet(JRDesignTextField element, JasperDesign jd)
{
JRDesignDataset dataset = ModelUtils.getElementDataset(element, jd);
Sheet.Set propertySet = Sheet.createPropertiesSet();
propertySet.setName("TEXTFIELD_ELEMENT_PROPERTIES");
propertySet.setDisplayName("Text field properties");
propertySet.put(new TextFieldExpressionProperty(element, dataset));
propertySet.put(new TextFieldExpressionClassNameProperty(element));
propertySet.put(new BlankWhenNullProperty(element));
propertySet.put(new TextFieldPatternProperty(element));
propertySet.put(new TextfieldPatternExpressionProperty(element,dataset));
propertySet.put(new StretchWithOverflowProperty( element ));
propertySet.put(new TextFieldEvaluationTimeProperty(element, dataset));
propertySet.put(new TextFieldEvaluationGroupProperty(element, dataset));
//propertySet.put(new LeftProperty( element ));
return propertySet;
}
示例15: getPropertySets
import net.sf.jasperreports.engine.design.JRDesignTextField; //导入依赖的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;
}