001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: */
013: package org.pentaho.designstudio.editors.actionsequence.pages.actions.details.reports;
014:
015: import org.eclipse.swt.SWT;
016: import org.eclipse.swt.layout.GridData;
017: import org.eclipse.swt.layout.GridLayout;
018: import org.eclipse.swt.widgets.Composite;
019: import org.eclipse.swt.widgets.Text;
020: import org.pentaho.actionsequence.dom.ActionSequenceDocument;
021: import org.pentaho.actionsequence.dom.IActionSequenceElement;
022: import org.pentaho.actionsequence.dom.actions.JFreeReportGenAction;
023: import org.pentaho.designstudio.controls.ActionInputCombo;
024: import org.pentaho.designstudio.controls.ActionInputText;
025: import org.pentaho.designstudio.controls.AddActionInputToolbar;
026: import org.pentaho.designstudio.controls.WidgetFactory;
027: import org.pentaho.designstudio.editors.actionsequence.pages.actions.details.ActionDetailsPage;
028: import org.pentaho.designstudio.messages.Messages;
029:
030: /**
031: * The template describing the audit action definition.
032: *
033: * @author Angelo Rodriguez
034: */
035: public class JFreeReportGeneratorDetailsPage extends ActionDetailsPage {
036:
037: public static final String DISPLAY_NAME = Messages
038: .getString("JFreeReportGeneratorDetailsPage.UI_COMPONENT_NAME_JFREE_GEN"); //$NON-NLS-1$
039:
040: ActionInputCombo resultSet;
041: ActionInputText reportConfigXml;
042: AddActionInputToolbar addActionInputToolbar;
043:
044: /**
045: * Create an audit template.
046: */
047: public JFreeReportGeneratorDetailsPage() {
048: super ();
049: }
050:
051: /* (non-Javadoc)
052: * @see org.pentaho.designstudio.editors.actionsequence.pages.actions.templates.ActionDefinitionTemplate#getComponentClassName()
053: */
054: public String getComponentName() {
055: return JFreeReportGenAction.COMPONENT_NAME;
056: }
057:
058: /* (non-Javadoc)
059: * @see org.pentaho.designstudio.editors.actionsequence.pages.actions.templates.ActionDefinitionTemplate#getDisplayName()
060: */
061: public String getName() {
062: return DISPLAY_NAME;
063: }
064:
065: public void createDetailsComposite(Composite parent) {
066: Composite actionConfigComposite = parent;
067: actionConfigComposite.setLayout(new GridLayout());
068:
069: WidgetFactory
070: .createLabel(
071: actionConfigComposite,
072: Messages
073: .getString("JFreeReportGeneratorDetailsPage.UI_INPUT_RESULT_SET_LABEL")); //$NON-NLS-1$
074: resultSet = new ActionInputCombo(actionConfigComposite,
075: new GridData(GridData.FILL_HORIZONTAL));
076:
077: WidgetFactory.createLabel(actionConfigComposite, ""); //$NON-NLS-1$
078:
079: Composite composite = WidgetFactory
080: .createComposite(actionConfigComposite);
081: composite.setLayout(new GridLayout(2, false));
082: composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
083: WidgetFactory
084: .createLabel(
085: composite,
086: Messages
087: .getString("JFreeReportGeneratorDetailsPage.UI_REPORT_CONFIGURATION")).setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //$NON-NLS-1$
088:
089: GridData layoutData = new GridData(GridData.FILL_BOTH);
090: layoutData.heightHint = 150;
091: layoutData.widthHint = 10;
092: reportConfigXml = new ActionInputText(actionConfigComposite,
093: layoutData, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL
094: | SWT.BORDER);
095:
096: addActionInputToolbar = new AddActionInputToolbar(composite,
097: (Text) reportConfigXml.getControl(), null);
098: }
099:
100: public void refresh() {
101: super .refresh();
102: resultSet.setTargetInput(actionDefinition,
103: JFreeReportGenAction.RESULT_SET_ELEMENT, new String[] {
104: ActionSequenceDocument.RESULTSET_TYPE,
105: ActionSequenceDocument.LIST_TYPE });
106: reportConfigXml.setTargetInput(actionDefinition,
107: JFreeReportGenAction.COMPONENT_SETTINGS_ELEMENT);
108: addActionInputToolbar.setActionDefinition(actionDefinition);
109: }
110:
111: public boolean accepts(IActionSequenceElement actionDef) {
112: return actionDef instanceof JFreeReportGenAction;
113: }
114: }
|