List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java
License:Apache License
public FocusCycleDemo() { addStyleName("division"); String content = "<H2>Focus Cycle</H2>" + "<p>In some browsers you can programmatically override the default tab order. " + "Unsupported browsers use a stub implementation which allows the default behavior.</p>" + "<p>IE, Mozilla (Win) & Safari are currently supported. <br/>" + "<code>asquare.gwt.tk.TabFocusController.gwt.xml</code><br/>" + "<code>asquare.gwt.tk.client.ui.behavior.FocusModel</code><br/>" + "<code>asquare.gwt.tk.client.ui.behavior.TabFocusController</code></p>"; HTML header = new HTML(content); header.addStyleName("description"); add(header);/*from w w w .java 2 s. c o m*/ HorizontalPanel examples = new HorizontalPanel(); examples.setWidth("100%"); examples.addStyleName("example"); examples.add(createFocusCycle1()); examples.add(createFocusCycle2()); add(examples); }
From source file:asquare.gwt.tkdemo.client.demos.GlassPanelDemo.java
License:Apache License
public GlassPanelDemo() { BasicPanel outer = new BasicPanel(); outer.addStyleName("division"); add(outer);/*from w w w .j a v a2 s.co m*/ String content = "<H2>GlassPanel</H2>" + "<p>A GlassPanel covers the entire surface of the document. " + "It prevents user interaction with the document. </p>"; HTML header = new HTML(content); header.addStyleName("description"); outer.add(header); BasicPanel example = new BasicPanel("div", BasicPanel.DISPLAY_BLOCK); example.addStyleName("example"); outer.add(example); class CreateExample implements ClickHandler { private final String m_cssId; private final String m_bodyStyleName; public CreateExample(String cssId) { this(cssId, GlassPanel.DEFAULT_BODY_STYLENAME); } public CreateExample(String cssId, String bodyStyleName) { m_cssId = cssId; m_bodyStyleName = bodyStyleName; } public void onClick(ClickEvent event) { final GlassPanel gp = new GlassPanel(m_bodyStyleName); gp.addStyleName(m_cssId); gp.addController(new HideGlassPanelController()); gp.show(); } } class ShowExample extends SimpleHyperLink { public ShowExample(String label, ClickHandler handler) { super(label); addClickHandler(handler); } } example.add(new ShowExample("Dark", new CreateExample("glasspanel-ex-dark"))); example.add(new ShowExample("Light", new CreateExample("glasspanel-ex-light"))); example.add(new ShowExample("Opaque", new CreateExample("glasspanel-ex-opaque"))); example.add(new ShowExample("Transparent PNG background image", new ClickHandler() { public void onClick(ClickEvent event) { final GlassPanel gp = new GlassPanel(); gp.addStyleName("glasspanel-ex-transparentPNG"); Label content = new Label(); content.setStyleName("Content"); content.setSize("100%", "100%"); gp.setWidget(content); gp.addController(new HideGlassPanelController()); gp.show(); } })); example.add(new ShowExample("Tiled background image", new CreateExample("glasspanel-ex-tiledBG"))); example.add(new ShowExample("Centered background image", new CreateExample("glasspanel-ex-centeredBG"))); example.add(new ShowExample("Foreground text", new ClickHandler() { public void onClick(ClickEvent event) { final GlassPanel gp = new GlassPanel(); gp.addStyleName("glasspanel-ex-text"); HTML contents = new HTML( "<table cellspacing='0' cellpadding='0' style='width: 100%; height: 100%;'>" + "<td align='center' valign='middle'><h1>Wham!</h1></td>" + "</tr></table>"); contents.setSize("100%", "100%"); gp.setWidget(contents); gp.addController(new HideGlassPanelController()); gp.show(); } })); example.add(new ShowExample("Blur (IE only)", new CreateExample("glasspanel-ex-ieBodyBlur", "glasspanel-ex-ieBodyBlur-BODY"))); }
From source file:asquare.gwt.tkdemo.client.demos.MiscPanel.java
License:Apache License
private Widget createSimpleHyperLinkDemo() { BasicPanel panel = new BasicPanel(); panel.addStyleName("division"); String content = "<H2>SimpleHyperLink</H2>" + "A hyperlink based on an anchor. No pesky DIV messing up your text flow. No history tokens in the location bar."; HTML header = new HTML(content); header.addStyleName("description"); panel.add(header);// w w w.j av a2 s . co m BasicPanel example = new BasicPanel(); example.addStyleName("example"); example.add(new SimpleHyperLink("SpongeBob says...", new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("I'm a goofy goober!"); } })); panel.add(example); return panel; }
From source file:asquare.gwt.tkdemo.client.demos.MiscPanel.java
License:Apache License
private Widget createExternalHyperLinkDemo() { BasicPanel panel = new BasicPanel(); panel.addStyleName("division"); String content = "<H2>ExternalHyperLink</H2>" + "An anchor linking to a page (or resource) external to the application."; HTML header = new HTML(content); header.addStyleName("description"); panel.add(header);//from ww w. java 2s.c om BasicPanel example = new BasicPanel("div", "block"); example.addStyleName("example"); example.add(new ExternalHyperLink("Text content, target '_blank'", false, "http://www.google.com", ExternalHyperLink.TARGET_BLANK)); example.add(new ExternalHyperLink("Text content, target 'bob'", false, "http://www.google.com", "bob")); example.add(new ExternalHyperLink("<b>HTML</b> content, target '_self'", true, "http://www.google.com", ExternalHyperLink.TARGET_SELF)); example.add(new ExternalHyperLink("sales@example.com", "mailto:sales@example.com")); ExternalHyperLink styled = new ExternalHyperLink("Styled link", false, "http://www.google.com", ExternalHyperLink.TARGET_BLANK); styled.addStyleName("externalhyperlink-styled"); example.add(styled); panel.add(example); return panel; }
From source file:asquare.gwt.tkdemo.client.demos.MiscPanel.java
License:Apache License
@SuppressWarnings("unused") private Widget createBasicPanelPanel() { BasicPanel panel = new BasicPanel(); panel.addStyleName("division"); String content = "<H2>BasicPanel</H2>" + "A barebones ComplexPanel which allows customization of the root element and <code>display</code> style of added children. "; HTML header = new HTML(content); header.addStyleName("header"); header.addStyleName("description"); panel.add(header);//www. j a v a2 s . c om BasicPanel example = new BasicPanel(); example.addStyleName("example"); BasicPanel panel1 = new BasicPanel("div", BasicPanel.DISPLAY_INLINE); for (int i = 0; i < 5; i++) { panel1.add(new Button("Button")); } for (int i = 0; i < 5; i++) { panel1.add(new Button("Button")); } example.add(panel1); BasicPanel panel2 = new BasicPanel("span", BasicPanel.DISPLAY_BLOCK); for (int i = 0; i < 10; i++) { panel2.add(new Button("Button")); } example.add(panel2); panel.add(example); return panel; }
From source file:at.ac.fhcampuswien.atom.client.gui.attributes.components.RichTextToolbar.java
License:Open Source License
/** Initialize the options on the toolbar **/ private void buildTools() { //Init the TOP Panel forst topPanel.add(bold = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 0, 20, 20, GUI_HOVERTEXT_BOLD)); topPanel.add(italic = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 60, 20, 20, GUI_HOVERTEXT_ITALIC)); topPanel.add(//from ww w . ja v a 2 s .c o m underline = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 140, 20, 20, GUI_HOVERTEXT_UNDERLINE)); topPanel.add(stroke = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 120, 20, 20, GUI_HOVERTEXT_STROKE)); topPanel.add(new HTML(" ")); topPanel.add( subscript = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 600, 20, 20, GUI_HOVERTEXT_SUBSCRIPT)); topPanel.add( superscript = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 620, 20, 20, GUI_HOVERTEXT_SUPERSCRIPT)); topPanel.add(new HTML(" ")); topPanel.add(alignleft = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 460, 20, 20, GUI_HOVERTEXT_ALIGNLEFT)); topPanel.add( alignmiddle = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 420, 20, 20, GUI_HOVERTEXT_ALIGNCENTER)); topPanel.add( alignright = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 480, 20, 20, GUI_HOVERTEXT_ALIGNRIGHT)); topPanel.add(new HTML(" ")); topPanel.add(orderlist = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 80, 20, 20, GUI_HOVERTEXT_ORDERLIST)); topPanel.add( unorderlist = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 20, 20, 20, GUI_HOVERTEXT_UNORDERLIST)); topPanel.add( indentright = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 400, 20, 20, GUI_HOVERTEXT_IDENTRIGHT)); topPanel.add(indentleft = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 540, 20, 20, GUI_HOVERTEXT_IDENTLEFT)); topPanel.add(new HTML(" ")); topPanel.add(generatelink = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 500, 20, 20, GUI_HOVERTEXT_LINK)); topPanel.add(breaklink = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 640, 20, 20, GUI_HOVERTEXT_BREAKLINK)); topPanel.add(new HTML(" ")); topPanel.add(insertline = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 360, 20, 20, GUI_HOVERTEXT_HLINE)); topPanel.add(insertimage = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 380, 20, 20, GUI_HOVERTEXT_IMAGE)); topPanel.add(new HTML(" ")); topPanel.add(removeformatting = createPushButton(HTTP_STATIC_ICONS_GIF, 20, 460, 20, 20, GUI_HOVERTEXT_REMOVEFORMAT)); topPanel.add(new HTML(" ")); topPanel.add( texthtml = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 260, 20, 20, GUI_HOVERTEXT_SWITCHVIEW)); //Init the BOTTOM Panel bottomPanel.add(fontlist = createFontList()); bottomPanel.add(new HTML(" ")); bottomPanel.add(colorlist = createColorList()); }
From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java
License:Apache License
/** * Inserts a widget into the panel. If the Widget is already attached, it will * be moved to the requested index./*from www . j ava 2 s .co m*/ * * @param child the widget to be added * @param text the text to be shown on its tab * @param asHtml <code>true</code> to treat the specified text as HTML * @param beforeIndex the index before which it will be inserted */ public void insert(Widget child, String text, boolean asHtml, int beforeIndex) { Widget contents; if (asHtml) { contents = new HTML(text); } else { contents = new Label(text); } insert(child, contents, beforeIndex); }
From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java
License:Apache License
/** * Sets a tab's HTML contents./*w ww .ja va2 s.co m*/ * * Use care when setting an object's HTML; it is an easy way to expose * script-based security problems. Consider using * {@link #setTabHTML(int, SafeHtml)} or * {@link #setTabText(int, String)} whenever possible. * * @param index the index of the tab whose HTML is to be set * @param html the tab's new HTML contents */ public void setTabHTML(int index, String html) { checkIndex(index); tabs.get(index).setWidget(new HTML(html)); }
From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing //------------------ hue = 0;//from w w w . j a v a 2 s . c o m saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; HorizontalPanel panel = new HorizontalPanel(); FlexTable table = new FlexTable(); // Add the large slider map slidermap = new SliderMap(this); panel.add(slidermap); panel.setCellWidth(slidermap, "258px"); panel.setCellHeight(slidermap, "258px"); // Add the small slider bar sliderbar = new SliderBar(this); panel.add(sliderbar); panel.setCellWidth(sliderbar, "40px"); panel.setCellHeight(sliderbar, "258px"); // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); colorpreview.setWidth("50px"); colorpreview.setHeight("50px"); DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); // Radio buttons rbHue = new RadioButton("color", "H:"); rbHue.addClickHandler(this); rbSaturation = new RadioButton("color", "S:"); rbSaturation.addClickHandler(this); rbBrightness = new RadioButton("color", "V:"); rbBrightness.addClickHandler(this); rbRed = new RadioButton("color", "R:"); rbRed.addClickHandler(this); rbGreen = new RadioButton("color", "G:"); rbGreen.addClickHandler(this); rbBlue = new RadioButton("color", "B:"); rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable table.setWidget(0, 0, colorpreview); table.getFlexCellFormatter().setColSpan(0, 0, 3); table.setWidget(1, 0, rbHue); table.setWidget(1, 1, tbHue); table.setWidget(1, 2, new HTML("°")); table.setWidget(2, 0, rbSaturation); table.setWidget(2, 1, tbSaturation); table.setText(2, 2, "%"); table.setWidget(3, 0, rbBrightness); table.setWidget(3, 1, tbBrightness); table.setText(3, 2, "%"); table.setWidget(4, 0, rbRed); table.setWidget(4, 1, tbRed); table.setWidget(5, 0, rbGreen); table.setWidget(5, 1, tbGreen); table.setWidget(6, 0, rbBlue); table.setWidget(6, 1, tbBlue); table.setText(7, 0, "#:"); table.setWidget(7, 1, tbHexColor); table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); // First event onClick(rbSaturation); initWidget(panel); }
From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationComposite.java
License:EUPL
/** * show hints and create link to help page *//*w ww . java 2s . c o m*/ protected Widget createHeader() { // The parent header panel FlowPanel header = new FlowPanel(); // 'Add your Annotation' label Label addAnnotationLabel = new Label(Application.getConstants().addAnnotation()); addAnnotationLabel.setStyleName("imageAnnotation-add-annotation"); header.add(addAnnotationLabel); // 'Help' link HTML help = new HTML( "<a target=\"_blank\" href=\"userguide_" + LocaleInfo.getCurrentLocale().getLocaleName() + ".html\">" + Application.getConstants().help() + "</a>"); help.setStyleName("imageAnnotation-help"); header.add(help); // Instructions text Label addAnnotationHint = new Label(Application.getConstants().addAnnotationHint()); addAnnotationHint.setStyleName("imageAnnotation-add-annotation-hint"); header.add(addAnnotationHint); // Button panel HorizontalPanel buttons = new HorizontalPanel(); // 'Annotate' button annotateButton.setStyleName("imageAnnotation-button"); annotateButton.setText(Application.getConstants().actionCreate()); annotateButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, false, false)); annotateButton.setEnabled(!Application.getUser().isEmpty()); buttons.add(annotateButton); // 'Annotate Fragment' button annotateFragmentButton.setStyleName("imageAnnotation-button"); annotateFragmentButton.setText(Application.getConstants().actionCreateFragment()); annotateFragmentButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, true, false)); annotateFragmentButton.setEnabled(!Application.getUser().isEmpty()); buttons.add(annotateFragmentButton); // 'Show on Map' button showOnMapButton.setStyleName("imageAnnotation-button"); showOnMapButton.setText(Application.getConstants().actionShowOnMap()); showOnMapButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(550, 300, 500, 300); window.getHeader().setText("Map"); window.setWidget(new GoogleMapsComposite(annotations)); window.setResizable(false); window.show(); } }); showOnMapButton.setVisible(Application.getBbox() != null || Application.isInTileMode()); buttons.add(showOnMapButton); header.add(buttons); header.add(annotationFormPanel); return header; }