use of com.google.gwt.user.client.ui.Panel in project blogwt by billy1380.
the class UiHelper method swap.
/**
* Swaps a TextBox with an element of the same type for remember password. The text box needs to be within an panel. The styles of the text box are also
* copied
*
* @param textBox
* @param elementId
* @return
*/
@SuppressWarnings("unchecked")
public static <T extends TextBox> T swap(T textBox, String elementId) {
Panel parent = (Panel) textBox.getParent();
T newTextBox = null;
if (textBox instanceof PasswordTextBox) {
newTextBox = (T) PasswordTextBox.wrap(DOM.getElementById(elementId));
} else if (textBox instanceof TextBox) {
newTextBox = (T) TextBox.wrap(DOM.getElementById(elementId));
}
newTextBox.getElement().setAttribute("class", textBox.getElement().getAttribute("class"));
newTextBox.removeFromParent();
parent.getElement().insertBefore(newTextBox.getElement(), textBox.getElement());
textBox.removeFromParent();
return newTextBox;
}
use of com.google.gwt.user.client.ui.Panel in project ovirt-engine by oVirt.
the class NetworkPanel method createTitlePanel.
private Panel createTitlePanel() {
titleLabel = new Label(item.getName());
titleLabel.getElement().addClassName(style.titleLabel());
Panel titlePanel = new HorizontalPanel();
titlePanel.getElement().addClassName(style.fixedTable());
titlePanel.add(titleLabel);
return titlePanel;
}
use of com.google.gwt.user.client.ui.Panel in project pentaho-platform by pentaho.
the class MantleXul method xulLoaded.
/**
* Callback method for the MantleXulLoader. This is called when the Xul file has been processed.
*
* @param runner
* GwtXulRunner instance ready for event handlers and initializing.
*/
public void xulLoaded(GwtXulRunner runner) {
// handlers need to be wrapped generically in GWT, create one and pass it our reference.
// instantiate our Model and Controller
controller = new MantleController(new MantleModel(this));
// Add handler to container
container = (GwtXulDomContainer) runner.getXulDomContainers().get(0);
container.addEventHandler(controller);
try {
runner.initialize();
} catch (XulException e) {
// $NON-NLS-1$
Window.alert("Error initializing XUL runner: " + e.getMessage());
e.printStackTrace();
return;
}
// Get the toolbar from the XUL doc
// $NON-NLS-1$
Widget bar = (Widget) container.getDocumentRoot().getElementById("mainToolbarWrapper").getManagedObject();
// $NON-NLS-1$
Widget xultoolbar = (Widget) container.getDocumentRoot().getElementById("mainToolbar").getManagedObject();
xultoolbar.getElement().removeClassName("toolbar");
toolbar.setStylePrimaryName("mainToolbar-Wrapper");
toolbar.setWidget(bar);
// Get the menubar from the XUL doc
// $NON-NLS-1$
Widget menu = (Widget) container.getDocumentRoot().getElementById("mainMenubar").getManagedObject();
menubar.setWidget(menu);
// check based on user permissions
final String moduleBaseURL = GWT.getModuleBaseURL();
final String moduleName = GWT.getModuleName();
final String contextURL = moduleBaseURL.substring(0, moduleBaseURL.lastIndexOf(moduleName));
// $NON-NLS-1$
final String url = contextURL + "api/repo/files/canCreate";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
executableTypesRequestBuilder.setHeader("accept", "text/plain");
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
Boolean visible = new Boolean(response.getText());
controller.setMenuBarEnabled("newmenu", visible);
controller.setToolBarButtonEnabled("newButton", visible);
}
}
});
} catch (RequestException e) {
// showError(e);
}
// get the admin perspective from the XUL doc
// $NON-NLS-1$
Widget admin = (Widget) container.getDocumentRoot().getElementById("adminPerspective").getManagedObject();
admin.setStyleName("admin-perspective");
admin.getElement().getStyle().clearHeight();
admin.getElement().getStyle().clearWidth();
adminPerspective.setWidget(admin);
Panel adminContentPanel = (Panel) container.getDocumentRoot().getElementById("adminContentPanel").getManagedObject();
adminContentPanel.add(adminContentDeck);
adminContentDeck.setHeight("100%");
adminContentDeck.getElement().getStyle().setProperty("height", "100%");
fetchPluginOverlays();
}
Aggregations