icza / gowut Goto Github PK
View Code? Open in Web Editor NEWGo Web UI Toolkit - Public Releases and Development
License: GNU General Public License v3.0
Go Web UI Toolkit - Public Releases and Development
License: GNU General Public License v3.0
// RadioGroup interface defines the group for grouping radio buttons.
type RadioGroup interface {
// Name returns the name of the radio group.
Name() string
// Selected returns the selected radio button of the group.
Selected() RadioButton
// PrevSelected returns the radio button that was selected
// before the current selected radio button.
PrevSelected() RadioButton
// setSelected sets the selected radio button of the group,
// and before that sets the current selected as the prev selected
setSelected(selected RadioButton)
}
In the file [state_buttons.go]
Hi,
Could you tell me why you didn't put your method in public? Is it a deliberate choice or a mistake?
Thx for your good job !
Warning in the browser console:
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
gowut-v1.3.0.js:244 :
xhr.open("GET", _pathSessCheck, false); // synch call (else we can't catch connection error)
Maybe there is an option to make the call asynchronous to avoid problems with the browser hang when the connection is lost during a call?
When deselecting all items from a listbox using ctrl+click, the last item deselected remains active despite no longer being highlighted on the list. This can be demonstrated by going to https://gowut-demo.appspot.com/show and clicking the "ListBox" link on the left, then using ctrl+click to select and deselect items on the list. sum=? will always equal the last item deselected.
Starting with,
sudo go run -race login_demo.go
Then logging in from two separate Clients and then waiting for the sessions to timeout yields the attached log file.
[deleted issue]
Hi,
i get this error:
go get -u github.com/icza/gowut
package github.com/icza/gowut
imports github.com/icza/gowut: no buildable Go source files in /Users/geri/Work/gopath
After creating a panel and setting it to LayoutNatural, I wanted to add components inside of it. However, I ran into an issue when adding the elements. The first one, which is another panel, got added correctly. The second one however, a link, seems to get skipped when the page is rendered. The page structure goes something like this:
window := gwu.NewWindow("window", "title")
window.SetLayout(gwu.LayoutNatural)
windowPanel := gwu.NewPanel()
windowPanel.SetLayout(gwu.LayoutNatural)
mainPanel := gwu.NewPanel()
mainPanel.SetLayout(gwu.LayoutNatural)
// add things into mainPanel
windowPanel.Add(mainPanel)
confirm := gwu.NewLink("confirm", "url")
windowPanel.Add(confirm)
window.Add(windowPanel)
gowutServer := gwu.NewServer("test", "localhost:8081")
gowutServer.SetText("Test app")
gowutServer.AddWin(window)
gowutServer.Start("window")
The affected panel is windowPanel
. The confirm
link that should get added doesn't appear on the page nor on the html itself. However, adding a link element manually where it should be using dev tools works as expected.
Is there something wrong with how I add the link to the panel, or is this a bug?
Thank you.
What steps will reproduce the problem?
b := gwu.NewButton("QUIT")
b.AddEHandlerFunc(func(e gwu.Event) {
panic("try to show goroutines and quit")
}, gwu.ETYPE_CLICK)
What is the expected output? What do you see instead?
I wish there is a method to let me quit program when button pressed
What version of the product are you using? On what operating system?
go 1.1
gowut 6cc150b5189d
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Jun 2013 at 8:30
I do not think mouse wheel events are supported.
It would be useful to support these kinds of events, to allow for richer GUI interaction.
I have two applications running on a backend server. They open their gowut servers on different ports (same IP/hostname). I open a browser and connect to the first app and authenticate, everything is ok. Starting a second browser instance/tab and authenticating to the second application stops the first browser session from working. There are no errors, and re-authenticating fixes it but breaks the other session.
However if I use a different browser to connect to the second application, everything works as expected and both applications work as intended.
Brainstorming. Consider exposing the http.Request
associated with the processing of the Event
.
It could be useful for informational purposes such as getting client's IP.
Consider not adding it to the Event
interface, so users won't "overuse" it, but document that the dynamic type of Event
s may have a method something like GetRequest()
which could be called after a type assertion.
Fantastic lib, thank you!
Some of the logging goes directly to the default log implementation, like this:
(
Line 57 in 59696fa
I define server's logger so I can control the output. the log.Println just goes where it wants.
Also, there is a bunch of debug logging not possible to turn off :
here
Line 800 in 59696fa
and here
Line 759 in 59696fa
This seems like a problem if you want to, say, include a feature to change the port via the gowut interface, but can't actually shut down and restart the server.
Googling indicates that it is possible. See for example https://github.com/tylerb/graceful
Im expanding on the login demo.
In server.go in serveHTTP there is a code:
if win == nil {
// 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>`)
return
}
Please make an opportunity to appoint the handler for formation of the page of a nonexistent window.
For long running actions, it would be helpful to have a built-in way to disable components while their event is processed. For example, currently the user could press a button multiple times while the first long running action is happening creating successive events using the same selections on the GUI.
I have used the following workaround for a button (which can be extended for other components/paradigms):
Use a timer to continually call MarkDirty() on the button, then on the button click event run a long running action in a goroutine (which will return immediately). Calls to SetEnabled() within the goroutine will be updated as quickly as the timer repeats..
I have a Panel in a TabPanel that I want to update went the panel becomes visible. The can occur if its TabPanel's tab is clicked on or when SetSelected() is called. Whenever either of these occur I want to update the panel. Using an event handler for ETypeFocus seems like the correct way to go but does not work. Looking at the code I believe that SetSelected() in TabPanel.go should include code to activate such a handler if present but it does not currently do so.
If this is the correct direction, I'd be happy to put together a pull request.
Less a bug than a feature request.
If instead of choosing between "text" and "password" at render time these were
set at "type" attributes (c.SetAttr("type", "text"), for example), then the
user could over-ride the text box to, say "number". It also shrinks the code
quite a bit.
I don't have a full implementation of this change, but I have tested it and
could flesh it out to submit a patch if you approve of the direction.
Original issue reported on code.google.com by [email protected]
on 6 Jan 2014 at 11:59
Code example:
this.gwuSvr = gwu.NewServer("guitest", "0.0.0.0:3434")
this.gwuSvr.AddSessCreatorName("login", "Login Window")
this.gwuSvr.AddSHandler(MySessHandler{this, nil})
this.gwuSvr.Start("login")
When Start is called, gowut opens a browser page to the ip and port that were specified in NewServer. In this case, it attempts (and fails) to connect to 0.0.0.0, because that isn't a real IP that can be connected to, it's just a way of saying "listen on all interfaces instead of just one."
Hello
There is no 'native' gowut way to upload a document. There are work-arounds that I have thought of, but they are not too elegant.
Any chance a native file upload widget might be added?
Thanks,
Glen
Hi dev team,
I am developing a simple monitoring dashboard which updates the values every minute using golang thicker. I would like to know how to refresh/update the gwu component when the thicker is about to execute like below sample code:
ticker := time.NewTicker(time.Second * 60)
go func() {
for t := range ticker.C {
log.Println(t)
serverCheck() //retrieve values somewhere and set gwu components values
//missing line that should update the gwu component in the browser to current value
}
}()
I know I can do this using gwu.NewTimer and call e.MarkDirty(...). But I instead opt to use golang thicker so that there is no delays when updating the components.
Can you please suggest, thanks!
Hi Dev team,
Thanks for this wonderful golang project.
I am currently developing a simple dashboard using this project.
However, part of the code needs to loop through objects.
I used Expander and set the content as Table.
My concern is that, I want to access the Expander content(table) and be able to loop through its components (cells). How can I do that? What is the reverse of Expander.setContent()?
I am new to golang in general.
Can you provide a simple code to achieve this? Thanks alot! :)
-Cris
If a table is constructed without all cells being populated, it will display fine, but the lack of cell contents causes a nil pointer dereference when performing a Clear() operation at table.go+169
Wrapping that line in an if c2 != nil {} solves the problem for me, but I don't know if that's the proper way to address the issue.
OWASP 10 https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project "The OWASP Top Ten represents a broad consensus about what the most critical web application security flaws are."
I applied a tool that tests for OWASP 10 vulnerabilities: https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
It found a couple, mostly medium level. They involve some headers not being set:
Is there any chance the gowut.Server interface could allow setting the underlying http.Response.Header? i.e. setting one or more headers that are sent with every response?
The report for the tool is here: https://drive.google.com/file/d/0B9uNae3afGInUnI2VEI3aENVZEk/view?usp=sharing
Since network latency is a real obstacle for gowut responsiveness, how about adding support for QUIC protocol?
https://github.com/lucas-clemente/quic-go
Would it be very hard to include feature?
Hi,
I decided to use Gowut for a simple UI I have to make that needs to display a pdf and some input fields, with the goal of refreshing the pdf after changes have been applied.
However, using the gwu.NewHTML
method with both object
and embed
tags, my local pdf never gets loaded. Here is what I tried:
path, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
gwu.NewHTML("<object data=\"file:///" + path + "/public/out.pdf\" type=\"application/pdf\">")
gwu.NewHTML("<embed src=\"file:///" + path + "/public/out.pdf\" type=\"application/pdf\">")
Both elements appear in the source html, but not on the page. Only when I replace the file link with a pdf uploaded online does everything work, and yet the pdf file is accessible on my computer at the exact location in the tags, since if I open that location in my browser it shows up just fine.
For some additional context, this program will only be ran on windows machines.
Is this a problem with Gowut, or am I getting my html wrong? Any help would be appreciated.
Thank you.
Feature request:
1. add canvas component that supports rendering image or svg.
To learn Go, I am porting a python utility based on matplotlib to Go.
Matplotlib provides browser-based rendering backend using a canvas element.
http://matplotlib.org/users/whats_new.html#backends And, I was attracted to
Gowut as a way to create the UI with Go.
The issue I encountered with reloading the current gowut image component within
a gowut page is that there was obvious blinking as the image was removed and
reloaded. Drawing to a canvas element could avoid this.
Would adding minimal support for a canvas component to Gowut that allows
drawing images be welcome?
If you do not have time to make this change, but think it would be a good idea,
can you recommend how to approach it within the Gowut framework? I'd be happy
to give it a "go".
Thank you.
Original issue reported on code.google.com by [email protected]
on 6 Mar 2014 at 5:04
Website out of order
https://sites.google.com/site/gowebuitoolkit/
Original issue reported on code.google.com by [email protected]
on 25 Sep 2013 at 11:03
Hi,
in example 'Gowut - Showcase of Features'/'Advanced table structure with modified alignment, row and col spans' (see table container)
I expect cells 22 and 41 to miss and example table to be rectangular.
If i not set content for cells 2,2 & 4,1 gowut still produce empty <td></td>
I'd like to use OAuth2 Authentication Flow (esp. OpenID Connect) for user authentication.
It needs a redirect URL to handle the token exchange.
Either Server should expose a Handle(http.Handler) function (become a Muxer), or expose its ServeHTTP method (become a http.Handler).
Is there a way to amend the contents of a listbox during an event called from the same page?
I'd like a refresh button that would rebuild the contents of a listbox based on the current values in a slice on the server.
I can do this with a textbox using tb.SetText(var) followed by marking the tb as dirty but cant work out how to do this for a list box.
I've managed to achieve this by doing a .Remove(listbox) then creating a new listbox with the new values, adding it to the parent container then marking the parent container dirty. I could do this as the parent container was a table, but not sure how you would reinsert it into the middle of a normal panel? Adding a SetContents(slice) as a listbox method would make things a lot simpler.
Are there any plans to support Webview as a backend?
This could be a viable alternative to sciter.
What steps will reproduce the problem?
1. Use IE 6 to try login_demo
2. for example, when press login, sometimes, it can not login
3. after login, the google picture layout is wrong.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Jun 2013 at 7:03
Am new for Golang and find this as an extraordinary product. We are planning to use Gowut for our product. Will you continue this further and provide more widgets (Datepicker and Menu very importantly) and keep this upgraded to Golang versions? Please share your views.
I'm currently trying to write an Event Handler function such that after the event has triggered and a fixed time period has passed, some code is executed and the affected part of the page is refreshed. Therefore, I tried to use time.AfterFunc()
inside the event handler, like so:
var timer *time.Timer
textBox := gwu.NewTextBox("")
textBox.AddSyncOnETypes(gwu.ETypeKeyUp)
textBox.AddEHandlerFunc(func(e gwu.Event) {
if timer != nil {
if !timer.Stop() {
<-timer.C
}
timer = nil
}
timer = time.AfterFunc(3*time.Second, func() {
// some code affecting a panel
e.MarkDirty(panel)
timer = nil
})
}, gwu.ETypeKeyUp)
I checked already that the afterfunc is correctly called after the defined time period using some logs. However, the components are never updated.
This code, that doesn't use the afterfunc call, works:
textBox := gwu.NewTextBox("")
textBox.AddSyncOnETypes(gwu.ETypeKeyUp)
textBox.AddEHandlerFunc(func(e gwu.Event) {
// some code affecting a panel
e.MarkDirty(panel)
}, gwu.ETypeKeyUp)
Which led me to suspect the fact that time.AfterFunc()
calls the code in its own goroutine.
Is it possible to call MarkDirty()
and update components from a goroutine? If not, is there any other way to delay component updates?
Thank you.
What steps will reproduce the problem?
func (c *expanderImpl) Content() Comp {
return c.header
}
What version of the product are you using? On what operating system?
go 1.1.2 for windows/amd64
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Nov 2013 at 7:19
For path (window name) with accent:
2016/11/27 09:13:52 Starting GUI server on: http://localhost:8081/Számlázó/
[szamlazo] 2016/11/27 09:13:52 Starting GUI server on: http://localhost:8081/Számlázó/
[szamlazo] 2016/11/27 09:13:52 Incoming: /Számlázó/
[szamlazo] 2016/11/27 09:13:52 Rendering windows list.
[szamlazo] 2016/11/27 09:14:02 Incoming: /Számlázó/main
[szamlazo] 2016/11/27 09:14:18 Incoming: /Számlázó/login
2016/11/27 09:14:18 SESSION created: AaeLFcMlzZ2cle4mGK0Bh0
[szamlazo] 2016/11/27 09:14:18 SESSION created: AaeLFcMlzZ2cle4mGK0Bh0
2016/11/27 09:14:18 net/http: invalid byte 'Ã' in Cookie.Path; dropping invalid bytes
So it seems that that path is used as-is in cookie path - it should be escaped!
Is there any plans to implement mutual authentication such that the gowut server can be configures to request or require client certificate?
Hello,
I get the above panic when I try and mark two things dirty at nearly the same time. I can fix the above myself by changing my program but I think it would be good for you to implement a locking system if at all possible to prevent this.
Thank you!
Line 52 in 7dde321
Hi,
i'm annoyed with dragable images,
is it good idea to make images undraggable ?
strImgCl = []byte(`" draggable="false">`)
If not, just close issue and sorry for noise.
Regards
I use sessions in my application. However, when the session expires, the gui is unresponsive. I would like to update/replace the gui contents when the session expires with a button that says something like "Start again", which starts a new session and presents the starting state of the gui. I have tried a number of things but have not been able to do this.
As the Session.Removed(gwu.Session) does not expose any functions of use (those in Event like Event.ReloadWin(string)) I don't see how I can do this...
Thanks,
Glen
Line 38 in 7dde321
Hi,
it should be ETypeMouseDown, in all other event names last word is upper case.
Regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.