Skip to content

Commit

Permalink
Gowut 0.9.0 public release.
Browse files Browse the repository at this point in the history
  • Loading branch information
icza committed Jul 8, 2015
1 parent d3fdd66 commit 6c1deb0
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 87 deletions.
11 changes: 0 additions & 11 deletions .project

This file was deleted.

14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,35 @@ For News, documentation and examples please visit the **Gowut Home Page** here:

## Quick install ##

To quickly install (or update to) the **latest** version, type: (you need mercurial client installed for it to work)
To quickly install (or update to) the **latest** version, type:
```
go get -u code.google.com/p/gowut/gwu
go get -u github.com/icza/gowut/gwu
```

Check out the [Downloads](http://code.google.com/p/gowut/downloads/list) page for other downloads and older releases.

## Quick test ##

To quickly test it and see it in action, run the following example applications (assuming you're in the root of your GOPATH):

**1. Showcase of Features.** This one auto-opens itself in your default browser.
```
go run src/code.google.com/p/gowut/examples/showcase.go
go run src/github.com/icza/gowut/examples/showcase/showcase.go
```

**2. A single window example.** This one auto-opens itself in your default browser.
```
go run src/code.google.com/p/gowut/examples/simple_demo.go
go run src/github.com/icza/gowut/examples/simple/simple_demo.go
```

**3. Login window example with session management.**
```
go run src/code.google.com/p/gowut/examples/login_demo.go
go run src/github.com/icza/gowut/examples/login/login_demo.go
```
Open the page http://localhost:3434/guitest/ in your browser to see it.

## Godoc of Gowut ##

You can read the godoc of Gowut online here:
http://godoc.org/code.google.com/p/gowut/gwu
http://godoc.org/github.com/icza/gowut/gwu

## +1 Gowut! ##

6 changes: 3 additions & 3 deletions examples/login_demo.go → examples/login/login_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package main

import (
"code.google.com/p/gowut/gwu"
"github.com/icza/gowut/gwu"
"fmt"
"log"
"math/rand"
Expand Down Expand Up @@ -322,8 +322,8 @@ func (h SessHandler) Removed(s gwu.Session) {

func main() {
// Create GUI server
server := gwu.NewServer("guitest", "")
//server := gwu.NewServerTLS("guitest", "", "test_tls/cert.pem", "test_tls/key.pem")
//server := gwu.NewServer("guitest", "")
server := gwu.NewServerTLS("guitest", "", "test_tls/cert.pem", "test_tls/key.pem")
server.SetText("Test GUI Application")

server.AddSessCreatorName("login", "Login Window")
Expand Down
8 changes: 4 additions & 4 deletions examples/showcase.go → examples/showcase/showcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package main

import (
"code.google.com/p/gowut/gwu"
"github.com/icza/gowut/gwu"
"fmt"
"os"
"strconv"
Expand Down Expand Up @@ -493,7 +493,7 @@ func buildButtonDemo(event gwu.Event) gwu.Comp {
func buildHtmlDemo(event gwu.Event) gwu.Comp {
p := gwu.NewPanel()

html := "<span onclick=\"alert('Hi from Html!');\">Hi! I'm inserted as HTML. Click on me!</span>"
html := `<span onclick="alert('Hi from Html!');">Hi! I'm inserted as HTML. Click on me!</span>`

p.Add(gwu.NewLabel("The following HTML code is inserted after the text box as an Html component:"))
ta := gwu.NewTextBox(html)
Expand Down Expand Up @@ -558,7 +558,7 @@ func buildLinkDemo(event gwu.Event) gwu.Comp {
p.SetCellPadding(3)

p.Add(gwu.NewLink("Visit Gowut Home page", "https://sites.google.com/site/gowebuitoolkit/"))
p.Add(gwu.NewLink("Visit Gowut Project page", "http://code.google.com/p/gowut/"))
p.Add(gwu.NewLink("Visit Gowut Project page", "https://github.com/icza/gowut"))

row := gwu.NewHorizontalPanel()
row.SetCellPadding(3)
Expand Down Expand Up @@ -799,7 +799,7 @@ func buildShowcaseWin(sess gwu.Session) {
footer.Style().SetFullWidth().SetBorderTop2(2, gwu.BRD_STYLE_SOLID, "#777777")
footer.Add(hiddenPan)
footer.AddHConsumer()
l = gwu.NewLabel("Copyright © 2013 András Belicza. All rights reserved.")
l = gwu.NewLabel("Copyright © 2013-2015 András Belicza. All rights reserved.")
l.Style().SetFontStyle(gwu.FONT_STYLE_ITALIC).SetFontSize("95%")
footer.Add(l)
footer.AddHSpace(10)
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_demo.go → examples/simple/simple_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package main

import (
"code.google.com/p/gowut/gwu"
"github.com/icza/gowut/gwu"
"strconv"
)

Expand Down
4 changes: 2 additions & 2 deletions gwu/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func newButtonImpl(valueProviderJs []byte, text string) buttonImpl {
}

var (
_STR_BUTTON_OP = []byte("<button type=\"button\"") // "<button type=\"button\""
_STR_BUTTON_CL = []byte("</button>") // "</button>"
_STR_BUTTON_OP = []byte(`<button type="button"`) // `<button type="button"`
_STR_BUTTON_CL = []byte("</button>") // "</button>"
)

func (c *buttonImpl) Render(w writer) {
Expand Down
8 changes: 4 additions & 4 deletions gwu/comp.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ func (c *compImpl) AddSyncOnETypes(etypes ...EventType) {
}

var (
_STR_SE_PREFIX = []byte("=\"se(event,") // "=\"se(event,"
_STR_SE_SUFFIX = []byte(")\"") // ")\""
_STR_SE_PREFIX = []byte(`="se(event,`) // `="se(event,`
_STR_SE_SUFFIX = []byte(`)"`) // `)"`
)

// rendrenderEventHandlers renders the event handlers as attributes.
Expand All @@ -281,8 +281,8 @@ func (c *compImpl) renderEHandlers(w writer) {
continue
}

// To render : " <etypeAttr>=\"se(event,etype,compId,value)\""
// Example (checkbox onclick): " onclick=\"se(event,0,4327,this.checked)\""
// To render : ` <etypeAttr>="se(event,etype,compId,value)"`
// Example (checkbox onclick): ` onclick="se(event,0,4327,this.checked)"`
w.Write(_STR_SPACE)
w.Write(etypeAttr)
w.Write(_STR_SE_PREFIX)
Expand Down
4 changes: 2 additions & 2 deletions gwu/comp_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c *hasEnabledImpl) SetEnabled(enabled bool) {
c.enabled = enabled
}

var _STR_DISABLED = []byte(" disabled=\"disabled\"") // " disabled=\"disabled\""
var _STR_DISABLED = []byte(` disabled="disabled"`) // ` disabled="disabled"`

// renderEnabled renders the enabled attribute.
func (c *hasEnabledImpl) renderEnabled(w writer) {
Expand Down Expand Up @@ -394,7 +394,7 @@ func (c *tableViewImpl) SetCellPadding(padding int) {
c.SetIAttr("cellpadding", padding)
}

var _STR_ST_VALIGN = []byte(" style=\"vertical-align:") // " style=\"vertical-align:"
var _STR_ST_VALIGN = []byte(` style="vertical-align:`) // ` style="vertical-align:`

// renderTr renders an HTML TR tag with horizontal and vertical
// alignment info included.
Expand Down
10 changes: 5 additions & 5 deletions gwu/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ to see the changes.
To quickly test it and see it in action, run the "Showcase of Features"
application by typing: (assuming you're in the root of your GOPATH)
go run src/code.google.com/p/gowut/examples/showcase.go
go run src/github.com/icza/gowut/examples/showcase/showcase.go
Features of Gowut
Expand Down Expand Up @@ -243,7 +243,7 @@ structure) will be seen without page reload.
All written in Go.
Source of this application is available here:
http://code.google.com/p/gowut/source/browse/examples/simple_demo.go
https://github.com/icza/gowut/blob/master/examples/simple/simple_demo.go
type MyButtonHandler struct {
counter int
Expand Down Expand Up @@ -383,7 +383,7 @@ Author email: gmail.com, user name: iczaaa
Home page: https://sites.google.com/site/gowebuitoolkit/
Source code: http://code.google.com/p/gowut/
Source code: https://github.com/icza/gowut
Discussion forum: https://groups.google.com/d/forum/gowebuitoolkit
Expand All @@ -395,7 +395,7 @@ package gwu

// Gowut version information.
const (
GOWUT_VERSION = "0.8.0" // Gowut version (major.minor.maintenance)
GOWUT_RELEASE_DATE = "2013-02-19 CET" // Gowut release date
GOWUT_VERSION = "0.9.0" // Gowut version (major.minor.maintenance)
GOWUT_RELEASE_DATE = "2015-07-08 CET" // Gowut release date
GOWUT_REL_DATE_LAYOUT = "2006-01-02 MST" // Gowut release date layout (for time.Parse())
)
2 changes: 1 addition & 1 deletion gwu/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const (
)

// Empty event handler which does nothing.
const EMPTY_EHANDLER emptyEventHandler = emptyEventHandler(0)
const EMPTY_EHANDLER emptyEventHandler = 0

// EventHandler interface defines a handler capable of handling events.
type EventHandler interface {
Expand Down
2 changes: 1 addition & 1 deletion gwu/expander.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (c *expanderImpl) SetHeader(header Comp) {
}

func (c *expanderImpl) Content() Comp {
return c.header
return c.content
}

func (c *expanderImpl) SetContent(content Comp) {
Expand Down
6 changes: 3 additions & 3 deletions gwu/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func NewImage(text, url string) Image {
}

var (
_STR_IMG_OP = []byte("<img") // "<img"
_STR_ALT = []byte(" alt=\"") // " alt=\""
_STR_IMG_CL = []byte("\">") // "\">"
_STR_IMG_OP = []byte("<img") // "<img"
_STR_ALT = []byte(` alt="`) // ` alt="`
_STR_IMG_CL = []byte(`">`) // `">`
)

func (c *imageImpl) Render(w writer) {
Expand Down
12 changes: 6 additions & 6 deletions gwu/listbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ func (c *listBoxImpl) preprocessEvent(event Event, r *http.Request) {
}

var (
_STR_SELECT_OP = []byte("<select") // "<select"
_STR_MULTIPLE = []byte(" multiple=\"multiple\"") // " multiple=\"multiple\""
_STR_OPTION_OP_SEL = []byte("<option selected=\"selected\">") // "<option selected=\"selected\">"
_STR_OPTION_OP = []byte("<option>") // "<option>"
_STR_OPTION_CL = []byte("</option>") // "</option>"
_STR_SELECT_CL = []byte("</select>") // "</select>"
_STR_SELECT_OP = []byte("<select") // "<select"
_STR_MULTIPLE = []byte(` multiple="multiple"`) // ` multiple="multiple"`
_STR_OPTION_OP_SEL = []byte(`<option selected="selected">`) // `<option selected="selected">`
_STR_OPTION_OP = []byte("<option>") // "<option>"
_STR_OPTION_CL = []byte("</option>") // "</option>"
_STR_SELECT_CL = []byte("</select>") // "</select>"
)

func (c *listBoxImpl) Render(w writer) {
Expand Down
8 changes: 4 additions & 4 deletions gwu/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func (s *serverImpl) serveHTTP(w http.ResponseWriter, r *http.Request) {
// Invalid window name, render an error message with a link to the window list
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusNotFound)
NewWriter(w).Writess("<html><body>Window for name <b>'", winName, "'</b> not found. See the <a href=\"", s.appPath, "\">Window list</a>.</body></html>")
NewWriter(w).Writess("<html><body>Window for name <b>'", winName, `'</b> not found. See the <a href="`, s.appPath, `">Window list</a>.</body></html>`)
return
}

Expand Down Expand Up @@ -586,7 +586,7 @@ func (s *serverImpl) renderWinList(sess Session, wr http.ResponseWriter, r *http

w := NewWriter(wr)

w.Writes("<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>")
w.Writes(`<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>`)
w.Writees(s.text)
w.Writess(" - Window list</title></head><body><h2>")
w.Writees(s.text)
Expand All @@ -602,7 +602,7 @@ func (s *serverImpl) renderWinList(sess Session, wr http.ResponseWriter, r *http
if len(s.sessCreatorNames) > 0 {
w.Writes("Session creators:<ul>") // TODO needs a better name
for name, text := range s.sessCreatorNames {
w.Writess("<li><a href=\"", s.appPath, name, "\">", text, "</a>")
w.Writess(`<li><a href="`, s.appPath, name, `">`, text, "</a>")
}
w.Writes("</ul>")
}
Expand All @@ -616,7 +616,7 @@ func (s *serverImpl) renderWinList(sess Session, wr http.ResponseWriter, r *http
}
w.Writes("<ul>")
for _, win := range session.SortedWins() {
w.Writess("<li><a href=\"", s.appPath, win.Name(), "\">", win.Text(), "</a>")
w.Writess(`<li><a href="`, s.appPath, win.Name(), `">`, win.Text(), "</a>")
}
w.Writes("</ul>")
}
Expand Down
16 changes: 8 additions & 8 deletions gwu/state_buttons.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ func (c *stateButtonImpl) preprocessEvent(event Event, r *http.Request) {
}

var (
_STR_INPUT = []byte("<input type=\"") // "<input type=\""
_STR_ID = []byte("\" id=\"") // "\" id=\""
_STR_NAME = []byte(" name=\"") // " name=\""
_STR_CHECKED = []byte(" checked=\"checked\"") // " checked=\"checked\""
_STR_LABEL_FOR = []byte("><label for=\"") // "><label for=\""
_STR_LABEL_CL = []byte("</label>") // "</label>"
_STR_INPUT = []byte(`<input type="`) // `<input type="`
_STR_ID = []byte(`" id="`) // `" id="`
_STR_NAME = []byte(` name="`) // ` name="`
_STR_CHECKED = []byte(` checked="checked"`) // ` checked="checked"`
_STR_LABEL_FOR = []byte(`><label for="`) // `><label for="`
_STR_LABEL_CL = []byte("</label>") // "</label>"
)

func (c *stateButtonImpl) Render(w writer) {
Expand Down Expand Up @@ -390,8 +390,8 @@ func (c *switchButtonImpl) preprocessEvent(event Event, r *http.Request) {
}

var (
_STR_CL_TR = []byte("><tr>") // "><tr>"
_STR_TD_50 = []byte("<td width=\"50%\">") // "<td width=\"50%\">"
_STR_CL_TR = []byte("><tr>") // "><tr>"
_STR_TD_50 = []byte(`<td width="50%">`) // `<td width="50%">`
)

func (c *switchButtonImpl) Render(w writer) {
Expand Down
16 changes: 8 additions & 8 deletions gwu/textbox_pwbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ func (c *textBoxImpl) Render(w writer) {
}

var (
_STR_INPUT_OP = []byte("<input type=\"") // "<input type=\""
_STR_PASSWORD = []byte("password") // "password"
_STR_TEXT = []byte("text") // "text"
_STR_SIZE = []byte("\" size=\"") // "\" size=\""
_STR_VALUE = []byte(" value=\"") // " value=\""
_STR_INPUT_CL = []byte("\"/>") // "\"/>"
_STR_INPUT_OP = []byte(`<input type="`) // `<input type="`
_STR_PASSWORD = []byte("password") // "password"
_STR_TEXT = []byte("text") // "text"
_STR_SIZE = []byte(`" size="`) // `" size="`
_STR_VALUE = []byte(` value="`) // ` value="`
_STR_INPUT_CL = []byte(`"/>`) // `"/>`
)

// renderInput renders the component as an input HTML tag.
Expand All @@ -229,8 +229,8 @@ func (c *textBoxImpl) renderInput(w writer) {

var (
_STR_TEXTAREA_OP = []byte("<textarea") // "<textarea"
_STR_ROWS = []byte(" rows=\"") // " rows=\""
_STR_COLS = []byte("\" cols=\"") // "\" cols=\""
_STR_ROWS = []byte(` rows="`) // ` rows="`
_STR_COLS = []byte(`" cols="`) // `" cols="`
_STR_TEXTAREA_OP_CL = []byte("\">\n") // "\">\n"
_STR_TEXTAREA_CL = []byte("</textarea>") // "</textarea>"
)
Expand Down
8 changes: 4 additions & 4 deletions gwu/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ func (c *windowImpl) Render(w writer) {
func (win *windowImpl) RenderWin(w writer, s Server) {
// We could optimize this (store byte slices of static strings)
// but windows are rendered "so rarely"...
w.Writes("<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>")
w.Writes(`<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>`)
w.Writees(win.text)
w.Writess("</title><link href=\"", s.AppPath(), _PATH_STATIC)
w.Writess(`</title><link href="`, s.AppPath(), _PATH_STATIC)
if len(win.theme) == 0 {
w.Writes(resNameStaticCss(s.Theme()))
} else {
w.Writes(resNameStaticCss(win.theme))
}
w.Writes("\" rel=\"stylesheet\" type=\"text/css\">")
w.Writes(`" rel="stylesheet" type="text/css">`)
win.renderDynJs(w, s)
w.Writess("<script src=\"", s.AppPath(), _PATH_STATIC, _RES_NAME_STATIC_JS, "\"></script>")
w.Writess(`<script src="`, s.AppPath(), _PATH_STATIC, _RES_NAME_STATIC_JS, `"></script>`)
w.Writess(win.heads...)
w.Writes("</head><body>")

Expand Down
Loading

0 comments on commit 6c1deb0

Please sign in to comment.