Package org.openbp.cockpit.generator

Examples of org.openbp.cockpit.generator.GeneratorContext


    // Get the dialog title from the wizard resource
    String title = getPageResourceString(null, "title");
    dialog.setTitle(title);

    // Initializes the subect.
    context = new GeneratorContext();
    if (!isNewItem)
    {
      // Save the original item for name uniqueness check reference and status restoration
      context.setOriginalItem(item);
View Full Code Here


    // Make stdout/stderr print to the output window
    getConsole().mapAll(true);

    // Prepare the context
    GeneratorContext context = getContext();
    context.setProperty("mergeModeRequester", new GeneratorMergeModeRequester());

    // Call the generator
    Generator generator = context.getSelectedGenerator();
    generator.preProcess(context);
  }
View Full Code Here

   */
  protected void process()
    throws Exception
  {
    // Call the generator
    GeneratorContext context = getContext();
    Generator generator = context.getSelectedGenerator();
    generator.performProcess(context);
  }
View Full Code Here

    /**
     * Sets the object to edit in the property browser.
     */
    private void initializePropertyBrowser()
    {
      GeneratorContext context = getContext();
      Item item = context.getItem();

      PropertyBrowser oe = getPropertyBrowser();
      oe.setObjectModified(false);
      oe.setOriginalObject(context.getOriginalItem());

      try
      {
        if (context.isNewItem() && !context.isItemSaved())
        {
          // Make the object name editable if it's a new item

          // Create the property browser tree and clone it
          ObjectNode rootNode = NodeStructureMgr.getInstance().createEditorStructureFor(item.getClass());

          // Set the read-only property of the 'Name' property to false
          changeReadOnlyModeOfPropertyDescriptor(rootNode, "Name", false);
          // TODO Feature 3 Allow for selecting the model for new items; implement setOwningModelQualifier
          // changeReadOnlyModeOfPropertyDescriptor(rootNode, "OwningModelQualifier", false);

          // Set the item; we consider it new (needed for the ModelObjectValidator, which
          // checks name uniqueness) only if the item has not been saved yet.
          boolean newFlag = !context.isItemSaved();
          oe.setObject(item, newFlag, rootNode);
        }
        else
        {
          oe.setObject(item, false);
View Full Code Here

    throws Exception
  {
    if (success)
    {
      // Call the generator
      GeneratorContext context = getContext();
      Generator generator = context.getSelectedGenerator();
      generator.postProcess(context);

      // Reset the template logger streams
      getConsole().unmapAll();
      getConsole().writeText(resourceCollection.getRequiredString("wizard.result.progress.finished"));

      // Stop and hide the progress bar again
      getProgressBar().setIndeterminate(false);
      getProgressBar().setValue(100);

      // Show the 'Run' panel again and update text/description
      TemplateEngineResult resultList = context.getTemplateEngineResult();
      if (resultList != null)
      {
        showStartPanel(MODE_SUCCESS);
      }
      else
View Full Code Here

   *
   * @param event Event to handle
   */
  public void handleWizardEvent(WizardEvent event)
  {
    GeneratorContext context = getContext();

    if (event.eventType == WizardEvent.SHOW)
    {
      Object o = context.getProperty(pageDescriptor.getName());

      try
      {
        getPropertyBrowser().setObject(o, true);
        if (context.isNewItem())
        {
          // For new items, we assume any edited objects to be modified in order to invoke the validator
          getPropertyBrowser().setObjectModified(true);
        }
      }
      catch (XMLDriverException e)
      {
        ExceptionUtil.printTrace(e);
      }
      catch (CloneNotSupportedException e)
      {
        ExceptionUtil.printTrace(e);
      }
    }
    else if (event.eventType == WizardEvent.BACK || event.eventType == WizardEvent.NEXT || event.eventType == WizardEvent.FINISH)
    {
      if (getPropertyBrowser().isObjectModified())
      {
        // Remember that a (re-)generation should be performed when finishing the wizard after changing settings
        context.setNeedGeneration(true);
      }
    }
    else if (event.eventType == WizardEvent.CANCEL)
    {
      // Reset the property browser in order to prevent validation error messages
View Full Code Here

   */
  public boolean executeSave(PropertyBrowser pb)
  {
    Object o = pb.getModifiedObject();

    GeneratorContext context = getContext();
    context.setProperty(pageDescriptor.getName(), o);

    if (o instanceof GeneratorSettings)
    {
      // If we are editing a settings page, save the settings also to the context
      context.setGeneratorSettings((GeneratorSettings) o);
    }

    return true;
  }
View Full Code Here

   */
  public GeneratorWizard(final ResourceCollection resource, final Item item)
  {
    this(resource);

    context = new GeneratorContext();
    context.setItem(item);
  }
View Full Code Here

        defaultDescription = getDescription();
      }

      // Select the tree node corresponding to the currently selected generator
      GeneratorNode currentNode = null;
      GeneratorContext context = getContext();
      Generator generator = context.getSelectedGenerator();
      if (generator != null)
      {
        currentNode = findNode(rootNode, generator);
      }
View Full Code Here

  /**
   * Tree selection has changed.
   */
  public void valueChanged(TreeSelectionEvent e)
  {
    GeneratorContext context = getContext();

    Generator generator = null;

    // Display either the description of the selected element or the default description
    TreePath path = e.getNewLeadSelectionPath();
    if (path != null)
    {
      GeneratorNode node = (GeneratorNode) path.getLastPathComponent();

      generator = node.getGenerator();
      if (generator == context.getSelectedGenerator())
      {
        // No change
        return;
      }
    }

    context.setSelectedGenerator(generator);

    // Remember that a (re-)generation should be performed when finishing the wizard after changing the generator
    context.setNeedGeneration(true);

    ((GeneratorWizard) getWizard()).updateGeneratorPageSequence();

    updatePageStatus();
  }
View Full Code Here

TOP

Related Classes of org.openbp.cockpit.generator.GeneratorContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.