Giter Site home page Giter Site logo

gitter-badger / wff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webfirmframework/wff

0.0 0.0 0.0 7.56 MB

Java framework to develop web applications

Home Page: http://webfirmframework.com

License: Apache License 2.0

Java 98.87% JavaScript 1.13%

wff's Introduction

Build Status Codacy Badge Maven Central

wffweb

wffweb is one of the modules of webfirmframework. It's an open source java framework for realtime application development which can generate html5 and css3 from java code, read more...

Here are some sample codes

Sample1 :-
Html html = new Html(null) {
       	 
        	Head head = new Head(this);
       	 
        	Body body = new Body(this) {
           	 
            	Blank blank = new Blank(this, "Hello World");
           	 
        	};
       	 
};
// prepends the doc type <!DOCTYPE html>
html.setPrependDocType(true);
System.out.println(html.toHtmlString()); 

or the same in another coding style

Html html = new Html(null) {
       {	 
              new Head(this);
       
              new Body(this) {
                     { 
                            new NoTag(this, "Hello World");
                     }
              };
       } 
};
// prepends the doc type <!DOCTYPE html>
html.setPrependDocType(true);
System.out.println(html.toHtmlString()); 

prints the following output

<!DOCTYPE html>
<html>
<head>
</head>
<body>
Hello World
</body>
</html>
Sample2 :-
Div div = new Div(null); 

or

Div div = new Div(null) {
};

prints :-

<div></div>
Sample3 :-
Div div = new Div(null) {
       	 
        	Div div1 = new Div(this);  
       	 
        	Div div2 = new Div(this);
       	 
};

prints :-

<div>
<div>
</div>
<div>
</div>
</div>
Sample4 :-
Div div = new Div(null, new Width(50, CssLengthUnit.PX));

prints :-

<div width="50px"></div>
Sample5 :-
Div div = new Div(null, new Style(new BackgroundColor("green")));

prints :-

<div style="background-color: green;"></div>
Sample6 :-
final Style paragraphStyle = new Style("color:red");

Html html = new Html(null, new CustomAttribute("some", "val"), new Id("htmlId"),
		new Style("background:white;width:15px")) {{

	new Div(this, new Id("outerDivId")) {

		int paragraphCount = 0;

		Div contentDiv = new Div(this) {
			{

				new H1(this) {
					NoTag headerContent = new NoTag(this, "Web Firm Framework");
				};

				for (paragraphCount = 1; paragraphCount < 4; paragraphCount++) {
					new P(this, paragraphStyle) {
						Blank paragraphContent = new Blank(this,
								"Web Firm Framework Paragraph " + paragraphCount);
					};
				}

			}
		};
	};

	new Div(this, new Hidden());
}};

paragraphStyle.addCssProperty(AlignContent.CENTER);

System.out.println(html.toHtmlString());

prints

<html some="val" id="htmlId" style="background:white;width:15px;">
<div id="outerDivId">
    <div>
        <h1>Web Firm Framework</h1>
        <p style="color:red;align-content:center;">Web Firm Framework Paragraph 1</p>
        <p style="color:red;align-content:center;">Web Firm Framework Paragraph 2</p>
        <p style="color:red;align-content:center;">Web Firm Framework Paragraph 3</p>
    </div>
</div>
<div hidden></div>
</html>

and we can add/change styles later, eg:-

paragraphStyle.addCssProperties(new WidthCss(100, CssLengthUnit.PER));

Color color = (Color) paragraphStyle
        .getCssProperty(CssNameConstants.COLOR);
        
color.setCssValue(CssColorName.BROWN.getColorName());

System.out.println(html.toHtmlString());

It will add width 100% in aboutParagraph and will change color to brown, its generated html code will be as follows

<html some="val" id="htmlId" style="background:white;width:15px;">
<div id="outerDivId">
    <div>
        <h1>Web Firm Framework</h1>
        <p style="color:brown;align-content:center;width:100.0%;">Web Firm Framework Paragraph 1</p>
        <p style="color:brown;align-content:center;width:100.0%;">Web Firm Framework Paragraph 2</p>
        <p style="color:brown;align-content:center;width:100.0%;">Web Firm Framework Paragraph 3</p>
    </div>
</div>
<div hidden></div>
</html>
Checkout

Refer Developers Guide to get started

How to resolve wffweb dependency in build tools like maven, ivy, Scala SBT, Leiningen, Grape, Gradle Grails or Apache Buildr

wffweb released versions

You can request features or report bugs here

Feel free to write us @ [email protected] for any assistance.

wff's People

Contributors

webfirmframework avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.