https://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwRichText
This is the server code for GWT:
/**
* The constants used in this Content Widget.
*/
public static interface CwConstants extends Constants {
String cwRichTextDescription();
String cwRichTextName();
}
/**
* Initialize this example.
*/
@Override
public Widget onInitialize() {
// Create the text area and toolbar
RichTextArea area = new RichTextArea();
area.ensureDebugId("cwRichText-area");
area.setSize("100%", "14em");
RichTextToolbar toolbar = new RichTextToolbar(area);
toolbar.ensureDebugId("cwRichText-toolbar");
toolbar.setWidth("100%");
// Add the components to a panel
Grid grid = new Grid(2, 1);
grid.setStyleName("cw-RichText");
grid.setWidget(0, 0, toolbar);
grid.setWidget(1, 0, area);
return grid;
}
If gwt
is an open-source project, where's the client-side source that renders that area in the browser?
The sample is really working though does it mean it does it all on the backend? Where's the source for that backend?
because i'd like to indicate which font is currently selected but it just says "font" in the menu.
[upd] no this is definitely not the backend, it's js front so there must be source for that js logic somehwhere.
This widget is written in Java, and compiled to JS using the GWT Web Toolkit, a Java-to-JavaScript optimizing compiler. The standard toolkit comes with an assortment of widgets, which includes the RichTextArea class.
The class itself can be found in the project's GitHub repo, at com.google.gwt.user.client.ui.RichTextArea
Much of the implementation details are delegated to another class, with several subclasses, the base subclass is com.google.gwt.user.client.ui.impl.RichTextAreaImpl
Note also that the CwRichText class can be found in the repository as well, in the samples/
directory as com.google.gwt.sample.showcase.client.content.text.CwRichText
To answer a question you asked in a comment to your own answer: While GWT provides some tools to make calls to a backend (and provides an implementation for Java Servlets), no widgets require this (except through developers adding their own calls, for example for querying a backend for paging data, etc). The RichTextArea
widget is no exception here, the linked Java code above runs only in the browser, after being transpiled to JavaScript.