⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elementprototypefactory.java

📁 报表设计软件,很好的
💻 JAVA
字号:
/**
 * ========================================
 * JFreeReport : a free Java report library
 * ========================================
 *
 * Project Info:  http://www.jfree.org/jfreereport/index.html
 * Project Lead:  Thomas Morgner (taquera@sherito.org);
 *
 * (C) Copyright 2000-2003, by Simba Management Limited and Contributors.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * ------------------------------
 * ElementPrototypeFactory.java
 * ------------------------------
 * (C)opyright 2003, by Thomas Morgner and Contributors.
 *
 * Original Author:  Thomas Morgner;
 * Contributor(s):   David Gilbert (for Simba Management Limited);
 *
 * $Id: ElementPrototypeFactory.java,v 1.2 2004/04/20 18:54:53 taqua Exp $
 *
 * Changes
 * -------------------------
 * 08.11.2003 : Initial version
 *
 */

package org.jfree.designer.visualeditor;

import org.jfree.designer.util.DowngradeActionMap;
import org.jfree.designer.visualeditor.actions.InsertElementAction;
import org.jfree.report.DrawableElement;
import org.jfree.report.Element;
import org.jfree.report.ImageElement;
import org.jfree.report.ShapeElement;
import org.jfree.report.TextElement;
import org.jfree.report.filter.templates.DateFieldTemplate;
import org.jfree.report.filter.templates.DrawableFieldTemplate;
import org.jfree.report.filter.templates.HorizontalLineTemplate;
import org.jfree.report.filter.templates.ImageFieldTemplate;
import org.jfree.report.filter.templates.ImageURLElementTemplate;
import org.jfree.report.filter.templates.ImageURLFieldTemplate;
import org.jfree.report.filter.templates.LabelTemplate;
import org.jfree.report.filter.templates.NumberFieldTemplate;
import org.jfree.report.filter.templates.RectangleTemplate;
import org.jfree.report.filter.templates.ResourceFieldTemplate;
import org.jfree.report.filter.templates.ResourceLabelTemplate;
import org.jfree.report.filter.templates.ShapeFieldTemplate;
import org.jfree.report.filter.templates.StringFieldTemplate;
import org.jfree.report.filter.templates.VerticalLineTemplate;

public final class ElementPrototypeFactory
{
  public ElementPrototypeFactory ()
  {
  }

  public final void fill (final VisualEditPanel editPanel, final DowngradeActionMap map)
  {
    setupDateField(editPanel, map);
    setupNumberField(editPanel, map);
    setupTextField(editPanel, map);
    setupLabel(editPanel, map);
    setupResourceLabel(editPanel, map);
    setupResourceField(editPanel, map);

    setupStaticImageURLField(editPanel, map);
    setupImageURLField(editPanel, map);
    setupImageField(editPanel, map);

    setupShapeField(editPanel, map);
    setupHLineField(editPanel, map);
    setupVLineField(editPanel, map);
    setupRectangle(editPanel, map);

    setupDrawableField(editPanel, map);
  }

  private void setupRectangle (final VisualEditPanel panel, final DowngradeActionMap map)
  {
    final ShapeElement element = new ShapeElement();
    element.setDataSource(new RectangleTemplate());

    map.put("InsertRectangleField", new InsertElementAction
            (panel, element, "Insert Rectangle"));
  }

  private void setupVLineField (final VisualEditPanel panel,
                                final DowngradeActionMap map)
  {
    final ShapeElement element = new ShapeElement();
    element.setDataSource(new VerticalLineTemplate());

    map.put("InsertVLineField", new InsertElementAction
            (panel, element, "Insert Vertical Line"));
  }

  private void setupHLineField (final VisualEditPanel panel,
                                final DowngradeActionMap map)
  {
    final ShapeElement element = new ShapeElement();
    element.setDataSource(new HorizontalLineTemplate());

    map.put("InsertHLineField", new InsertElementAction
            (panel, element, "Insert Horizontal Line"));
  }

  private void setupDrawableField (final VisualEditPanel panel,
                                   final DowngradeActionMap map)
  {
    final Element element = new DrawableElement();
    element.setDataSource(new DrawableFieldTemplate());

    map.put("InsertDrawableField", new InsertElementAction
            (panel, element, "Insert Drawable Field"));
  }

  private void setupImageField (final VisualEditPanel panel,
                                final DowngradeActionMap map)
  {
    final Element element = new ImageElement();
    element.setDataSource(new ImageFieldTemplate());

    map.put("InsertImageField", new InsertElementAction
            (panel, element, "Insert Image Field"));
  }

  private void setupImageURLField (final VisualEditPanel panel,
                                   final DowngradeActionMap map)
  {
    final Element element = new ImageElement();
    element.setDataSource(new ImageURLFieldTemplate());

    map.put("InsertImageURLField", new InsertElementAction
            (panel, element, "Insert Image URL Field"));
  }

  private void setupLabel (final VisualEditPanel panel, final DowngradeActionMap map)
  {
    final Element element = new TextElement();
    element.setDataSource(new LabelTemplate());

    map.put("InsertLabel", new InsertElementAction
            (panel, element, "Insert Label"));
  }

  private void setupNumberField (final VisualEditPanel panel,
                                 final DowngradeActionMap map)
  {
    final Element element = new TextElement();
    element.setDataSource(new NumberFieldTemplate());

    map.put("InsertNumberField", new InsertElementAction
            (panel, element, "Insert Number Field"));
  }

  private void setupResourceField (final VisualEditPanel panel,
                                   final DowngradeActionMap map)
  {
    final Element element = new TextElement();
    element.setDataSource(new ResourceFieldTemplate());

    map.put("InsertResourceField", new InsertElementAction
            (panel, element, "Insert Resource Field"));
  }

  private void setupResourceLabel (final VisualEditPanel panel,
                                   final DowngradeActionMap map)
  {
    final Element element = new TextElement();
    element.setDataSource(new ResourceLabelTemplate());

    map.put("InsertResourceLabel", new InsertElementAction
            (panel, element, "Insert Resource Label"));
  }

  private void setupShapeField (final VisualEditPanel panel,
                                final DowngradeActionMap map)
  {
    final ShapeElement element = new ShapeElement();
    element.setDataSource(new ShapeFieldTemplate());

    map.put("InsertShapeField", new InsertElementAction
            (panel, element, "Insert Shape Field"));
  }

  private void setupStaticImageURLField (final VisualEditPanel panel,
                                         final DowngradeActionMap map)
  {
    final ImageElement element = new ImageElement();
    element.setDataSource(new ImageURLElementTemplate());

    map.put("InsertStaticImageURL", new InsertElementAction
            (panel, element, "Insert Static Image URL Element"));
  }

  private void setupTextField (final VisualEditPanel panel, final DowngradeActionMap map)
  {
    final TextElement element = new TextElement();
    element.setDataSource(new StringFieldTemplate());

    map.put("InsertTextField", new InsertElementAction
            (panel, element, "Insert Text Field"));
  }

  private void setupDateField (final VisualEditPanel panel, final DowngradeActionMap map)
  {
    final TextElement element = new TextElement();
    element.setDataSource(new DateFieldTemplate());

    map.put("InsertDateField", new InsertElementAction
            (panel, element, "Insert Date Field"));
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -