Example usage for com.google.gwt.user.rebind SourceWriter println

List of usage examples for com.google.gwt.user.rebind SourceWriter println

Introduction

In this page you can find the example usage for com.google.gwt.user.rebind SourceWriter println.

Prototype

void println(String s);

Source Link

Usage

From source file:org.drools.guvnor.gwtutil.AssetEditorFactoryGenerator.java

License:Apache License

private void generateGetAssetEditorIcon(SourceWriter sourceWriter,
        List<AssetEditorConfiguration> registeredEditors) {
    sourceWriter.println("public ImageResource getAssetEditorIcon(String format) {");
    sourceWriter.indent();/*w  w w.  j a v a2  s.  c om*/

    for (AssetEditorConfiguration a : registeredEditors) {
        String format = a.getFormat();
        String iconName = a.getIcon();
        sourceWriter.println("if(format.equals(\"" + format + "\")) {");
        sourceWriter.indent();
        sourceWriter.println("return " + iconName + ";");
        sourceWriter.outdent();
        sourceWriter.println("}");
    }
    sourceWriter.println("return images.ruleAsset();");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.AssetEditorFactoryGenerator.java

License:Apache License

private void generateGetAssetEditorTitle(SourceWriter sourceWriter,
        List<AssetEditorConfiguration> registeredEditors) {
    sourceWriter.println("public String getAssetEditorTitle(String format) {");
    sourceWriter.indent();/*from  ww w.  jav  a2s . c om*/

    for (AssetEditorConfiguration a : registeredEditors) {
        String format = a.getFormat();
        String title = a.getTitle();
        sourceWriter.println("if(format.equals(\"" + format + "\")) {");
        sourceWriter.indent();
        sourceWriter.println("return " + title + ";");
        sourceWriter.outdent();
        sourceWriter.println("}");
    }
    sourceWriter.println("return \"\";");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetRegisteredAssetEditorFormatsMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public String[] getRegisteredAssetEditorFormats(String moduleType) {");
    sourceWriter.indent();//from  w w  w . jav a  2s.com
    sourceWriter.println("String formats = \"\";");

    for (List<ModuleEditorConfiguration> moduleEditors : registeredEditors.values()) {
        for (ModuleEditorConfiguration moduleEditorConfiguration : moduleEditors) {
            sourceWriter.println("if(\"" + moduleEditorConfiguration.getFormat() + "\".equals(moduleType)) {");
            sourceWriter.indent();
            sourceWriter.println("formats = \"" + moduleEditorConfiguration.getAssetEditorFormats() + "\";");
            sourceWriter.outdent();
            sourceWriter.println("}");
        }
    }

    sourceWriter.println("String[] results = formats.split(\",\");");

    sourceWriter.println("return results;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetRegisteredModuleEditorFormatsMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public String[] getRegisteredModuleEditorFormats(String perspectiveType) {");
    sourceWriter.indent();/*from   w  w w.j  ava2 s  .  co m*/

    for (String perspectiveType : registeredEditors.keySet()) {
        List<ModuleEditorConfiguration> moduleEditors = registeredEditors.get(perspectiveType);
        sourceWriter.println("if(\"" + perspectiveType + "\".equals(perspectiveType)) {");
        sourceWriter.indent();
        sourceWriter.println("String[] formats = new String[] {");
        int i = 0;
        for (ModuleEditorConfiguration a : moduleEditors) {
            String format = a.getFormat();
            sourceWriter.print("\"" + format + "\"");
            if (i < moduleEditors.size() - 1) {
                sourceWriter.print(", ");
            }
            i++;
        }

        sourceWriter.println("};");
        sourceWriter.println("return formats;");
        sourceWriter.outdent();
        sourceWriter.println("}");
    }

    sourceWriter.println("return null;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetRegisteredPerspectiveTypesMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public String[] getRegisteredPerspectiveTypes() {");
    sourceWriter.indent();/*from w  ww  .j a  v a 2  s .  c  om*/
    sourceWriter.println("String[] formats = new String[] {\"soaservice\"};");
    //sourceWriter.println( "String[] formats = new String[] {\"author\", \"runtime\"};" );

    sourceWriter.println("return formats;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetModuleEditorMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println(
            "public AbstractModuleEditor getModuleEditor(Module module, ClientFactory clientFactory, EventBus eventBus, boolean isHistoryReadOnly, Command refreshCommand) {");
    sourceWriter.indent();//  w ww. ja v a  2  s.c  o m

    for (List<ModuleEditorConfiguration> moduleEditorConfigurations : registeredEditors.values()) {
        for (ModuleEditorConfiguration moduleEditorConfiguration : moduleEditorConfigurations) {
            String format = moduleEditorConfiguration.getFormat();
            String editorClassName = moduleEditorConfiguration.getEditorClass();
            sourceWriter.println("if(module.getFormat().equals(\"" + format + "\")) {");
            sourceWriter.indent();
            sourceWriter.println("return new " + editorClassName
                    + "(module, clientFactory, eventBus, isHistoryReadOnly, refreshCommand);");
            sourceWriter.outdent();
            sourceWriter.println("}");
        }
    }
    sourceWriter.println("return null;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetPerspectiveMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public Perspective getPerspective(String perspectiveType) {");
    sourceWriter.indent();//from w w w  . j  a  va  2 s  . com

    sourceWriter.println("if(\"soaservice\".equals(perspectiveType)) {");
    sourceWriter.indent();
    sourceWriter.println("return new org.drools.guvnor.client.perspective.soa.SOAPerspective();");
    sourceWriter.outdent();
    sourceWriter.println("}");

    sourceWriter.println("return null;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetModulesHeaderViewMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public IsWidget  getModulesHeaderView(String perspectiveType) {");
    sourceWriter.indent();// w w w  .  j  a va 2  s.  c om
    sourceWriter.println("String title;");
    sourceWriter.println("ImageResource image;");

    sourceWriter.println("if(\"soaservice\".equals(perspectiveType)) {");
    sourceWriter.indent();
    sourceWriter.println("title = \"Services\";");
    sourceWriter.println("image = images.packages();");
    sourceWriter.outdent();
    sourceWriter.println("}");

    sourceWriter.println("title = \"Services\";");
    sourceWriter.println("image = images.packages();");

    sourceWriter.println("StackItemHeaderViewImpl view = new StackItemHeaderViewImpl();");
    sourceWriter.println("StackItemHeader header = new StackItemHeader( view );");
    sourceWriter.println("header.setName( title );");
    sourceWriter.println("header.setImageResource( image );");
    sourceWriter.println("return view;");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetModulesTreeRootNodeHeaderMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println("public SafeHtml getModulesTreeRootNodeHeader(String perspectiveType) {");
    sourceWriter.indent();//from ww  w .j  a  va 2s. c o m
    sourceWriter.println("String title;");
    sourceWriter.println("ImageResource image;");

    sourceWriter.println("if(\"soaservice\".equals(perspectiveType)) {");
    sourceWriter.indent();
    sourceWriter.println("title = \"Services\";");
    sourceWriter.println("image = images.chartOrganisation();");
    sourceWriter.outdent();
    sourceWriter.println("}");

    sourceWriter.println("title = \"Services\";");
    sourceWriter.println("image = images.packages();");

    sourceWriter.println("return Util.getHeader( image, title );");
    sourceWriter.outdent();
    sourceWriter.println("}");
}

From source file:org.drools.guvnor.gwtutil.PerspectiveFactoryGenerator.java

License:Apache License

private void generateGetModulesNewAssetMenuMethod(SourceWriter sourceWriter,
        Map<String, List<ModuleEditorConfiguration>> registeredEditors) {
    sourceWriter.println(
            "public Widget getModulesNewAssetMenu(String perspectiveType, ClientFactory clientFactory, EventBus eventBus) {");
    sourceWriter.indent();// w  w w  .  j a v a  2 s. c  o  m

    sourceWriter.println("if(\"soaservice\".equals(perspectiveType)) {");
    sourceWriter.indent();
    sourceWriter.println(
            "return (new org.drools.guvnor.client.asseteditor.soa.SOAServicesNewAssetMenu( clientFactory, eventBus )).asWidget();");
    sourceWriter.outdent();
    sourceWriter.println("}");

    sourceWriter.println(
            "return (new org.drools.guvnor.client.asseteditor.soa.SOAServicesNewAssetMenu( clientFactory, eventBus )).asWidget();");

    sourceWriter.outdent();
    sourceWriter.println("}");
}