• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JRDesignQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setReportDataAdapter

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public void setReportDataAdapter(ReportBundle bundle, DataAdapterDescriptor dataadapter, JRPropertiesMap properties) {
	JRDesignDataset tableDataset = (JRDesignDataset)bundle.getJasperDesign().getDatasetMap().get("tableDataset"); //$NON-NLS-1$
	JasperDesign jd = bundle.getJasperDesign();
	for (String key : properties.getPropertyNames()){
		jd.setProperty(key, properties.getProperty(key));
		if (key.contains("ireport")) tableDataset.setProperty(key, properties.getProperty(key)); //$NON-NLS-1$
	}
	tableDataset.setProperty(DataQueryAdapters.DEFAULT_DATAADAPTER, dataadapter.getName());
	jd.setProperty(DataQueryAdapters.DEFAULT_DATAADAPTER, dataadapter.getName());

	//Remove the main dataset query
	JRDesignDataset mainDataset = jd.getMainDesignDataset();

	((JRDesignQuery) mainDataset.getQuery()).setText(null);
	((JRDesignQuery) mainDataset.getQuery()).setLanguage(null);
	for (JRField field : mainDataset.getFields())
		mainDataset.removeField(field);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:TableTemplateEngine.java


示例2: changeLanguage

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
private void changeLanguage() {
	if (!isRefresh) {
		qStatus.showInfo("");
		String lang = langCombo.getText();
		((JRDesignQuery) newdataset.getQuery()).setLanguage(lang);
		final IQueryDesigner designer = qdfactory.getDesigner(lang);
		langLayout.topControl = designer.getControl();
		tbLayout.topControl = designer.getToolbarControl();
		tbCompo.layout();
		langComposite.layout();
		currentDesigner = designer;
		currentDesigner.setJasperConfiguration(jConfig);
		UIUtils.getDisplay().asyncExec(new Runnable() {

			@Override
			public void run() {
				currentDesigner.setQuery(jDesign, newdataset, jConfig);
				currentDesigner.setDataAdapter(dscombo.getSelected());
			}
		});
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:DataQueryAdapters.java


示例3: dispose

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public void dispose() {
	String lang = "";
	int selectionIndex = langCombo.getSelectionIndex();
	if (selectionIndex < 0)
		lang = langCombo.getText().trim();
	else
		lang = langCombo.getItem(selectionIndex);
	String text = queryText.getText();

	if (lang.equals("") && (text == null || text.equals("")))
		value = new MQuery(null, null);
	else {
		JRDesignQuery jrQuery = new JRDesignQuery();
		jrQuery.setLanguage(lang);
		jrQuery.setText(text);
		value = new MQuery(jrQuery, null);
	}
	super.dispose();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:JRQueryPage.java


示例4: setWidgets

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
private void setWidgets() {
	String lang = (String) value.getPropertyValue(JRDesignQuery.PROPERTY_LANGUAGE);
	if (lang == null)
		lang = "sql"; //$NON-NLS-1$
	lang = ModelUtils.getLanguage(lang);
	String[] items = langCombo.getItems();
	for (int i = 0; i < items.length; i++) {
		if (items[i].equals(lang)) {
			langCombo.select(i);
			break;
		}
	}
	if (langCombo.getSelectionIndex() < 0)
		langCombo.setText(lang);

	String text = (String) value.getPropertyValue(JRDesignQuery.PROPERTY_TEXT);
	if (text == null)
		text = ""; //$NON-NLS-1$
	queryText.setText(text);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:JRQueryPage.java


示例5: getText

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public String getText(Object element) {
	if (element != null && element instanceof MQuery) {
		MQuery mQuery = (MQuery) element;
		String lang = (String) mQuery.getPropertyValue(JRDesignQuery.PROPERTY_LANGUAGE);
		if (lang == null)
			lang = "";
		else
			lang = "<" + lang + ">";
		String txt = (String) mQuery.getPropertyValue(JRDesignQuery.PROPERTY_TEXT);
		if (txt == null)
			txt = "";
		return lang + txt; //$NON-NLS-1$
	}
	if (element == null || !(element instanceof JRDesignQuery))
		return canBeNull.getName();
	JRDesignQuery query = (JRDesignQuery) element;
	return query.getText();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:JRQueryLabelProvider.java


示例6: setValue

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
public void setValue(Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    
        JRDesignQuery oldValue = (JRDesignQuery)dataset.getQuery();
        String lang = (val == null) ? "SQL" : val+"";
        if (lang.trim().length() == 0) lang = "SQL";
        
        JRDesignQuery newValue = new JRDesignQuery();
        if (oldValue != null && oldValue.getText() != null)
        {
            newValue.setText(oldValue.getText());
        }
        
        newValue.setLanguage(lang);
        
        dataset.setQuery(newValue);
    
        ObjectPropertyUndoableEdit urob =
                new ObjectPropertyUndoableEdit(
                    dataset,
                    "Query", 
                    JRDesignQuery.class,
                    oldValue,newValue);
        // Find the undoRedo manager...
        IReportManager.getInstance().addUndoableEdit(urob);
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:26,代码来源:DatasetNode.java


示例7: propertyChange

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
public void propertyChange(final PropertyChangeEvent evt) {
    
    com.jaspersoft.ireport.designer.IReportManager.getInstance().notifyReportChange();
    if (evt.getPropertyName() == null) return;
    
    if(acceptProperty(evt))
    {
        this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
        if (evt.getPropertyName().equals( JRDesignDataset.PROPERTY_NAME ))
        {
            this.fireDisplayNameChange(null, null);
        }
    }
    
    if (evt.getPropertyName().equals(JRDesignDataset.PROPERTY_QUERY))
    {
        firePropertyChange(JRDesignQuery.PROPERTY_TEXT, evt.getOldValue(), evt.getNewValue());
        firePropertyChange(JRDesignQuery.PROPERTY_LANGUAGE,  evt.getOldValue(), evt.getNewValue());
    }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:21,代码来源:DatasetNode.java


示例8: acceptProperty

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
/**
 *  This method looks if the property name is one of those handled by this node type.
 */
public static boolean acceptProperty(PropertyChangeEvent evt) {
    
    if (evt.getPropertyName() == null) return false;
    if (evt.getPropertyName().equals( JRDesignDataset.PROPERTY_NAME ) ||
        evt.getPropertyName().equals( JRDesignDataset.PROPERTY_RESOURCE_BUNDLE ) ||
        evt.getPropertyName().equals( JRDesignDataset.PROPERTY_SCRIPTLET_CLASS ) ||
        evt.getPropertyName().equals( JRDesignDataset.PROPERTY_FILTER_EXPRESSION) ||
        evt.getPropertyName().equals( "WhenNoDataType") ||
        evt.getPropertyName().equals( JRDesignQuery.PROPERTY_TEXT) ||
        evt.getPropertyName().equals( JRDesignQuery.PROPERTY_LANGUAGE))
    {
        return true;
    }
    return false;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:19,代码来源:DatasetNode.java


示例9: readFields

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
public List<JRDesignField> readFields(String query) throws Exception {
    
    SQLFieldsProvider provider = new SQLFieldsProvider();
    List<JRDesignField> result = new ArrayList<JRDesignField>();
    JRDesignDataset dataset = new JRDesignDataset(true);
    JRDesignQuery dquery = new JRDesignQuery();
    dquery.setLanguage("SQL");
    dquery.setText(query);
    dataset.setQuery(dquery);
    JRField[] fields = provider.getFields(this, dataset, new HashMap());
    for (int i=0; i<fields.length; ++i)
    {
        result.add((JRDesignField)fields[i]);
    }
    
    return result;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:18,代码来源:JDBCConnection.java


示例10: readFields

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public List<JRDesignField> readFields(String query) throws Exception {
	MongoDbFieldsProvider provider = new MongoDbFieldsProvider();
	List<JRDesignField> result = new ArrayList<JRDesignField>();
	JRDesignDataset dataset = new JRDesignDataset(true);
	JRDesignQuery designQuery = new JRDesignQuery();
	designQuery.setLanguage(MongoDbDataSource.QUERY_LANGUAGE);
	designQuery.setText(query);
	dataset.setQuery(designQuery);
	Map<String, String> parameters = new HashMap<String, String>();
	JRField[] fields = provider.getFields(this, dataset, parameters);
	for (int i = 0; i < fields.length; ++i) {
		result.add((JRDesignField) fields[i]);
	}
	return result;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:17,代码来源:MongoDbConnection.java


示例11: createObject

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
	JRDesignQuery query = new JRDesignQuery();

	String language = atts.getValue(JRXmlConstants.ATTRIBUTE_language);
	if (language != null)
	{
		query.setLanguage(language);
	}
	
	return query;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:14,代码来源:JRQueryFactory.java


示例12: gerarRelatorioEstoquePdf

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void gerarRelatorioEstoquePdf(String sql, int totalProdutos){
	try{
		String caminhoSalvar = "";
       	DirectoryChooser directoryChooser = new DirectoryChooser();
           File selectedDirectory = directoryChooser.showDialog(null);
            
           if(selectedDirectory == null){
               System.out.println("N�o selecionou nada");
           }else{
               caminhoSalvar = selectedDirectory.getAbsolutePath();
           }
           if(!caminhoSalvar.isEmpty()){
           	Connection conn = new ConexaoBD().getConnection();
   			HashMap param = new HashMap();
   			param.put("totalProdutos", totalProdutos);
   			JasperDesign jd = JRXmlLoader.load("src/main/java/br/com/buyme/report/VerificaEstoque.jrxml");
   			JRDesignQuery newQuery = new JRDesignQuery();
   			newQuery.setText(sql);
   			jd.setQuery(newQuery);
   			JasperReport jr = JasperCompileManager.compileReport(jd);
   			JasperPrint jp = JasperFillManager.fillReport(jr, param,conn);
   			JasperExportManager.exportReportToPdfFile(jp,caminhoSalvar+"/Estoque.pdf");
   			conn.close();
           }
	}catch(Exception e){
		e.printStackTrace();
	}
}
 
开发者ID:juan0101,项目名称:TG-BUYME,代码行数:30,代码来源:ProdutoProntoDAO.java


示例13: gerarRelatorioPdf

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void gerarRelatorioPdf(String sql){
	try{
		String caminhoSalvar = "";
       	DirectoryChooser directoryChooser = new DirectoryChooser();
           File selectedDirectory = directoryChooser.showDialog(null);
            
           if(selectedDirectory == null){
               System.out.println("N�o selecionou nada");
           }else{
               caminhoSalvar = selectedDirectory.getAbsolutePath();
           }
           if(!caminhoSalvar.isEmpty()){
           	Connection conn = new ConexaoBD().getConnection();
   			HashMap param = new HashMap();
		
			JasperDesign jd = JRXmlLoader.load("src/main/java/br/com/buyme/report/MotivoPerda.jrxml");
   			JRDesignQuery newQuery = new JRDesignQuery();
   			newQuery.setText(sql);
   			jd.setQuery(newQuery);
   			JasperReport jr = JasperCompileManager.compileReport(jd);
   			JasperPrint jp = JasperFillManager.fillReport(jr, param,conn);
   			JasperExportManager.exportReportToPdfFile(jp,caminhoSalvar+"/MotivoPerda.pdf");
		
   			conn.close();
           }
	}catch(Exception e){
		e.printStackTrace();
	}
	
}
 
开发者ID:juan0101,项目名称:TG-BUYME,代码行数:32,代码来源:RelatorioMotivoPerdaLoteDAO.java


示例14: run

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public void run() {
	APropertyNode reportRoot = HandlersUtil.getRootElement();
	if (reportRoot != null) {
		MDataset mdataset = (MDataset) reportRoot.getPropertyValue(JasperDesign.PROPERTY_MAIN_DATASET);
		MQuery mquery = (MQuery) mdataset.getPropertyValue(JRDesignDataset.PROPERTY_QUERY);
		PatternEditor wizard = new PatternEditor();
		wizard.setValue(mquery.getPropertyValue(JRDesignQuery.PROPERTY_TEXT).toString());
		new DatasetDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mdataset, mquery.getJasperConfiguration(), getCommandStack()).open();
	} else
		MessageDialog.openWarning(UIUtils.getShell(), Messages.OpenQueryHandler_message_title, Messages.OpenQueryHandler_message_text);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:13,代码来源:OpenQueryHandler.java


示例15: createButton

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
/**
 * Build the button
 * 
 * @param parent
 *          composite where is placed
 * @param buttonText
 *          text on the button
 */
protected void createButton(Composite parent, String buttonText) {
	editQueryButton = section.getWidgetFactory().createButton(parent, buttonText, SWT.PUSH);
	editQueryButton.setToolTipText(pDescriptor.getDescription());
	editQueryButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			PatternEditor wizard = new PatternEditor();
			Object queryText = mquery.getPropertyValue(JRDesignQuery.PROPERTY_TEXT);
			wizard.setValue(queryText != null ? queryText.toString() : "");
			new DatasetDialog(editQueryButton.getShell(), mdataset, mquery.getJasperConfiguration(), section
					.getEditDomain().getCommandStack()).open();
		}
	});
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:SPQueryButton.java


示例16: doSetValue

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
protected void doSetValue(Object value) {
	super.doSetValue(value);
	if (value instanceof MQuery) {
		MQuery expression = (MQuery) value;

		text.removeModifyListener(getModifyListener());
		String pvalue = (String) expression.getPropertyValue(JRDesignQuery.PROPERTY_TEXT);
		if (pvalue == null)
			pvalue = "";
		text.setText(pvalue);
		text.addModifyListener(getModifyListener());
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:15,代码来源:JRQueryCellEditor.java


示例17: doSourceTextChanged

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
protected void doSourceTextChanged() {
	if (!refresh) {
		refresh = true;
		if (jDataset != null && jDataset.getQuery() != null)
			((JRDesignQuery) jDataset.getQuery()).setText(Misc.nvl(getQueryFromWidget()));
		refresh = false;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:9,代码来源:QueryDesigner.java


示例18: createJRDataset

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
/**
 * Creates the jr dataset.
 * 
 * @param jrDesign
 *          the jr design
 * @return the jR design dataset
 */
public static JRDesignDataset createJRDataset(JasperReportsConfiguration jConfig, JasperDesign jrDesign) {
	JRDesignDataset jrDesignDataset = new JRDesignDataset(jConfig, false);
	jrDesignDataset.setName(ModelUtils.getDefaultName(jrDesign.getDatasetMap(), "Dataset")); //$NON-NLS-1$
	JRDesignQuery jrDesignQuery = new JRDesignQuery();
	jrDesignQuery.setLanguage("sql"); //$NON-NLS-1$
	jrDesignQuery.setText(""); //$NON-NLS-1$
	jrDesignDataset.setQuery(jrDesignQuery);
	return jrDesignDataset;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:MDataset.java


示例19: createPropertyDescriptors

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
	// pen
	NTextPropertyDescriptor textD = new NTextPropertyDescriptor(JRDesignQuery.PROPERTY_TEXT, Messages.common_text);
	textD.setDescription(Messages.MQuery_text_description);
	desc.add(textD);

	languageD = new RWComboBoxPropertyDescriptor(JRDesignQuery.PROPERTY_LANGUAGE, Messages.common_language,
			ModelUtils.getQueryLanguages(getJasperConfiguration()), NullEnum.NOTNULL);
	languageD.setDescription(Messages.MQuery_language_description);
	languageD.setCategory(Messages.common_report);
	desc.add(languageD);

	defaultsMap.put(JRDesignQuery.PROPERTY_LANGUAGE, "SQL"); //$NON-NLS-1$
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:16,代码来源:MQuery.java


示例20: getPropertyValue

import net.sf.jasperreports.engine.design.JRDesignQuery; //导入依赖的package包/类
public Object getPropertyValue(Object id) {
	JRQuery jrQuery = (JRQuery) getValue();
	if (jrQuery != null) {
		if (id.equals(JRDesignQuery.PROPERTY_TEXT))
			return jrQuery.getText();
		if (id.equals(JRDesignQuery.PROPERTY_LANGUAGE))
			return jrQuery.getLanguage();
	}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:MQuery.java



注:本文中的net.sf.jasperreports.engine.design.JRDesignQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UnfoldingMap类代码示例发布时间:2022-05-22
下一篇:
Java PhysicsCollisionListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap