Package net.sf.gluebooster.java.booster.essentials.meta

Examples of net.sf.gluebooster.java.booster.essentials.meta.ApplicationDescription


    ObjectAnalyzingCodeGenerator generator = new ObjectAnalyzingCodeGenerator();
    InputStream appDescriptionXml = getClass().getResourceAsStream(
        "Sample.ApplicationDescription.xml");
    Assert.assertNotNull(appDescriptionXml);
    ApplicationDescription appDescription = XmlBoostUtils
        .readFromXml(appDescriptionXml);


    Collection<BoostedStringBuilder<String, JavaFeatureDescription>> generatedClasses = generator
        .generateApplicationDescriptionClasses(appDescription, "sample");
View Full Code Here


  @Example(clasz = SimpleBeanEditor.class)
  public void startApplicationDescriptionEditor() throws Exception {

    // [gb:useInDocumentation]

    ApplicationDescription app = new ApplicationDescription();

    SimpleBeanEditor editor = SimpleBeanEditor.startEditor(app);

    // [/gb:useInDocumentation]
View Full Code Here

    // [gb:useInDocumentation]

    // Use BoostedHashSets instead of normal HashSets, so that new elements
    // will be created automatically by the editor
    ApplicationDescription app = new ApplicationDescription(
        new BoostedHashSet<ObjectDescription>(ObjectDescription.class),
        new BoostedHashSet<ObjectDescription>(ObjectDescription.class),
        new BoostedHashSet<ApplicationDescription>(
            ApplicationDescription.class));

    editor = SimpleBeanEditor.startEditor(app);

    editor.getListeners().addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent event) {
        Object bean = event.getSource();
        if (bean instanceof ApplicationDescription) {
          // The BoostedHashSets should not be saved, so that the
          // default classes are stored.
          // So modify the default HashSet to BoostedHashSets after
          // loading and back to HashSet before storing.

          // modify sets to BoostedHashSets after loading
          // modify sets to HashSet before saving
          // modify sets to BoostedHashSets after saving

          ApplicationDescription app = (ApplicationDescription) bean;

          if (SimpleBeanEditor.ACTION_LOAD_BEAN.equals(event
              .getActionCommand()))
            changeToBoostedHashSet(app);
          else if (SimpleBeanEditor.ACTION_SAVE_BEAN.equals(event
              .getActionCommand())) {
            if (event.getID() == GeneralConstants.START)
              changeToHashSet(app);
            else
              changeToBoostedHashSet(app);
          }

        }

      }

      /**
       * Changes the HashSets to BoostedHashSets
       */
      private void changeToBoostedHashSet(ApplicationDescription app) {
        BoostedHashSet<ObjectDescription> actions = new BoostedHashSet<ObjectDescription>(
            ObjectDescription.class);
        BoostedHashSet<ObjectDescription> values = new BoostedHashSet<ObjectDescription>(
            ObjectDescription.class);
        BoostedHashSet<ApplicationDescription> subApplications = new BoostedHashSet<ApplicationDescription>(
            ApplicationDescription.class);

        changeTo(app, actions, values, subApplications);

      }

      /**
       * Changes the BoostedHashSets to HashSets.
       */
      private void changeToHashSet(ApplicationDescription app) {

        changeTo(app, new HashSet<ObjectDescription>(),
            new HashSet<ObjectDescription>(),
            new HashSet<ApplicationDescription>());
      }

      /**
       * Exchanges the sets of actions, values and subapplications
       */
      private void changeTo(ApplicationDescription app,
          Set<ObjectDescription> actions,
          Set<ObjectDescription> values,
          Set<ApplicationDescription> subApplications) {

        actions.addAll(app.getActions());
        values.addAll(app.getValues());
        subApplications.addAll(app.getSubApplications());

        app.setActions(actions);
        app.setValues(values);
        app.setSubApplications(subApplications);

      }

    });

View Full Code Here

    ObjectDescription description2 = XmlBoostUtils
        .readFromXml(new ByteArrayInputStream(
        xml.toByteArray()));
    Assert.assertEquals(objectDescription.getName(), description2.getName());

    ApplicationDescription app1 = new ApplicationDescription();
    app1.setName("Application 1");

    ApplicationDescription app2 = new ApplicationDescription();
    app2.setName("Application 2");
    app2.getSubApplications().add(app1);

    xml = new ByteArrayOutputStream();
    XmlBoostUtils.writeAsUtf8Xml(app2, xml, true, 0);

    xmlText = TextBoostUtils.toStringFromUtf8(xml.toByteArray());

    ApplicationDescription app2a = XmlBoostUtils
        .readFromXml(new ByteArrayInputStream(xml.toByteArray()));
    Assert.assertNotNull(app2a);
    Assert.assertNotNull(app2a.getSubApplications());
    Assert.assertEquals(1, app2a.getSubApplications().size());
  }
View Full Code Here

                source,
                getTargetFile(source, targetRootResources,
                    packagePath));

        // the generate the java class
        ApplicationDescription appDescription = XmlBoostUtils
            .readFromXml(new FileInputStream(source));

        // BoostedStringBuilder<String> constantsSourcecode = new
        // BoostedStringBuilder<String>(
        // new StringBuilder());
View Full Code Here

TOP

Related Classes of net.sf.gluebooster.java.booster.essentials.meta.ApplicationDescription

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.