List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java
License:Apache License
private Widget createFocusCycle2() { BasicPanel cycle2 = new BasicPanel("div", "block"); FocusModel focusModel = new FocusModel(); TabFocusController focusController = (TabFocusController) GWT.create(TabFocusController.class); focusController.setModel(focusModel); cycle2.add(new Label("Cycle 2")); Label label = new Label("A custom focus cycle across containers"); DomUtil.setStyleAttribute(label, "fontSize", "smaller"); cycle2.add(label);// w w w. j a va2s. c o m HorizontalPanel containers = new HorizontalPanel(); FocusStyleDecorator[] buttons = new FocusStyleDecorator[6]; for (int i = 0; i < buttons.length; i++) { buttons[i] = new FocusStyleDecorator(new Button("index " + i)); } VerticalPanel container1 = new VerticalPanel(); container1.addStyleName("focus-container"); VerticalPanel container2 = new VerticalPanel(); container2.addStyleName("focus-container"); for (int i = 0; i < buttons.length; i += 2) { container1.add(buttons[i]); focusModel.add(buttons[i]); container2.add(buttons[i + 1]); focusModel.add(buttons[i + 1]); } containers.add(new CWrapper(container1).addController(focusController)); containers.add(new CWrapper(container2).addController(focusController)); cycle2.add(containers); new WidgetFocusStyleController(focusModel); return cycle2; }
From source file:asquare.gwt.tkdemo.client.demos.MiscPanel.java
License:Apache License
public MiscPanel() { HorizontalPanel outer = new HorizontalPanel(); DomUtil.setAttribute(outer, "id", "miscPanel"); initWidget(outer);// w w w . jav a 2 s .c om BasicPanel left = new BasicPanel(); BasicPanel right = new BasicPanel(); left.add(new FocusCycleDemo()); left.add(createSimpleHyperLinkDemo()); right.add(new GlassPanelDemo()); right.add(createExternalHyperLinkDemo()); outer.add(left); outer.setCellWidth(left, "50%"); outer.add(right); outer.setCellWidth(right, "50%"); }
From source file:at.ac.fhcampuswien.atom.client.gui.attributes.components.RichTextToolbar.java
License:Open Source License
/** Constructor of the Toolbar **/ public RichTextToolbar() { //Initialize the main-panel outer = new VerticalPanel(); //Initialize the two inner panels topPanel = new HorizontalPanel(); bottomPanel = new HorizontalPanel(); topPanel.setStyleName(CSS_ROOT_NAME); bottomPanel.setStyleName(CSS_ROOT_NAME); //Set some graphical options, so this toolbar looks how we like it. topPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); bottomPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); //Add the two inner panels to the main panel outer.add(topPanel);/*from w w w. j a v a 2s . com*/ outer.add(bottomPanel); //Some graphical stuff to the main panel and the initialisation of the new widget outer.setWidth("100%"); outer.setStyleName(CSS_ROOT_NAME); initWidget(outer); // evHandler = new EventHandler(); //Now lets fill the new toolbar with life buildTools(); }
From source file:at.ait.dme.yuma.client.Application.java
License:EUPL
/** * show the header (search field and logo) *//*from w w w .j av a 2 s .c om*/ private void showHeader() { if (Application.isInTileMode()) return; final HorizontalPanel hPanel = new HorizontalPanel(); // removed the search since it's not needed by europeana // show the search field /*final TextBox searchTerm = new TextBox(); searchTerm.setStyleName("imageAnnotation-search-term"); searchTerm.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER) startSearch(searchTerm.getText()); } }); hPanel.add(searchTerm); // show the search button Button search = new Button(getConstants().annotationSearch()); search.setStyleName("imageAnnotation-search"); search.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { startSearch(searchTerm.getText()); } }); hPanel.add(search);*/ // show the logo String dbName = getDatabaseName(); if (dbName == null) dbName = "ait"; String logoPath = "images/" + dbName + ".gif"; final Image logo = new Image(logoPath); // workaround for IE caching issue see // http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/11851753ba99454d/6079e2e2b9aea4bf DOM.setElementAttribute(logo.getElement(), "src", logoPath); // see also http://code.google.com/p/google-web-toolkit/issues/detail?id=2149 if (logo.getWidth() > 0) { RootPanel.get().add(hPanel, logo.getWidth() + 20, 50); } else { logo.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent event) { RootPanel.get().add(hPanel, logo.getWidth() + 20, 50); } }); } RootPanel.get().add(logo, 10, 10); }
From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing //------------------ hue = 0;// w w w . ja v a 2 s .c om 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 w w. j a va2s . c om 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; }
From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java
License:EUPL
private HorizontalPanel createTitlePanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) { HorizontalPanel titlePanel = new HorizontalPanel(); Label titleLabel = new Label(Application.getConstants().annotationTitle()); titleLabel.setStyleName("imageAnnotation-form-label"); titleTextBox.setStyleName("imageAnnotation-form-title"); // in case of an update if (update)/* www . java2 s .c o m*/ titleTextBox.setText(annotationTreeNode.getTitle()); //in case of an reply if (!update && annotationTreeNode != null) titleTextBox.setText( Application.getConstants().annotationReplyTitlePrefix() + annotationTreeNode.getTitle()); titlePanel.add(titleLabel); titlePanel.add(titleTextBox); return titlePanel; }
From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java
License:EUPL
private HorizontalPanel createTextPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode, ImageAnnotationComposite annotationComposite) { HorizontalPanel textPanel = new HorizontalPanel(); Label textLabel = new Label(Application.getConstants().annotationText()); textLabel.setStyleName("imageAnnotation-form-label"); textArea.setStyleName("imageAnnotation-form-text"); if (update)/* w w w . j a va 2s.c om*/ textArea.setText(annotationTreeNode.getText()); textPanel.add(textLabel); textPanel.add(textArea); textArea.addKeyDownHandler(createKeyDownHandler(annotationComposite)); return textPanel; }
From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java
License:EUPL
private HorizontalPanel createRadioPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) { Label scopeLabel = new Label(); scopeLabel.setStyleName("imageAnnotation-form-label"); HorizontalPanel radioPanel = new HorizontalPanel(); radioPanel.add(scopeLabel);/*from w ww. j a v a 2 s . c o m*/ radioPanel.add( rdPublic = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + Application.getConstants().publicScope())); radioPanel.add(rdPrivate = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + Application.getConstants().privateScope())); rdPublic.setStyleName("imageAnnotation-form-radiobutton"); rdPrivate.setStyleName("imageAnnotation-form-radiobutton"); if (update && annotationTreeNode.getAnnotation().getScope() == ImageAnnotation.Scope.PRIVATE) rdPrivate.setValue(true, true); else rdPublic.setValue(true, true); return radioPanel; }
From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java
License:EUPL
protected Panel createLinksPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) { HorizontalPanel linksPanel = new HorizontalPanel(); Label linksLabel = new Label(Application.getConstants().annotationLinks()); linksLabel.setStyleName("imageAnnotation-form-label"); linksPanel.add(linksLabel);/*from w w w .j a va 2 s.c om*/ linksStack = new VerticalPanel(); linksStack.setStyleName("imageAnnotation-form-links"); linksPanel.add(linksStack); if (update && annotationTreeNode.getAnnotation().hasSemanticTags()) { for (SemanticTag t : annotationTreeNode.getAnnotation().getSemanticTags()) { addLink(t, linksStack, true); if (!this.tags.contains(t)) { this.tags.add(t); } } } return linksPanel; }