List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:ar.com.kyol.jet.client.JetPaginatedTable.java
License:Open Source License
public JetPaginatedTable(boolean useHyperlinks, boolean lazyInit) { this.useHyperlinks = useHyperlinks; this.lazyInit = lazyInit; Panel totalPanel = new VerticalPanel(); navigationPanel = new HorizontalPanel(); mainPanel = new AbsolutePanel(); totalPanel.add(mainPanel);/*from ww w .ja v a 2s . c o m*/ this.jetTable = createJetTable(); mainPanel.add(jetTable); this.qty = getPageSize(); refresh(); this.initWidget(totalPanel); }
From source file:ar.com.kyol.jet.client.wrappers.TimestampBoxWrapper.java
License:Open Source License
private void initTimeWidget() { int hour = this.timestamp.getHours(); int minute = this.timestamp.getMinutes(); hoursBox.setSelectedIndex(hour);// w w w. j av a2s .c om minutesBox.setSelectedIndex(minute); hoursBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { refreshTimestamp(); TimestampBoxWrapper.this.timestamp .setHours(Integer.parseInt(hoursBox.getValue(hoursBox.getSelectedIndex()))); setProperty(TimestampBoxWrapper.this.timestamp); } }); minutesBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { refreshTimestamp(); TimestampBoxWrapper.this.timestamp .setMinutes(Integer.parseInt(minutesBox.getValue(minutesBox.getSelectedIndex()))); setProperty(TimestampBoxWrapper.this.timestamp); } }); //ChangeEvent.fireNativeEvent(Document.get().createChangeEvent(), hoursBox); //ChangeEvent.fireNativeEvent(Document.get().createChangeEvent(), minutesBox); HorizontalPanel panel = new HorizontalPanel(); panel.add(hoursBox); panel.add(minutesBox); initWidget(panel); }
From source file:asquare.gwt.debug.client.DebugConsole.java
License:Apache License
/** * Creates the console, installs the enabler key listener. * The console is not yet attached to the DOM. *///from w w w . j a va2 s . c o m protected DebugConsole() { super(false, false); setStyleName("tk-DebugConsole"); DOM.setStyleAttribute(getElement(), "border", "solid black 1px"); DOM.setStyleAttribute(getElement(), "background", "white"); setHTML("<div style='margin: 2px; padding: 3px; background-color: rgb(195, 217, 255); font-weight: bold; font-size: smaller; cursor: default;'>Debug Console</div>"); m_content.setWordWrap(false); DOM.setStyleAttribute(m_content.getElement(), "margin", "2px"); DOM.setStyleAttribute(m_content.getElement(), "padding", "3px"); VerticalPanel outer = new VerticalPanel(); ScrollPanel scrollPanel = new ScrollPanel(m_content); scrollPanel.setAlwaysShowScrollBars(true); scrollPanel.setSize("40em", "20em"); outer.add(scrollPanel); HorizontalPanel controls = new HorizontalPanel(); DOM.setStyleAttribute(controls.getElement(), "margin", "2px"); controls.setWidth("100%"); outer.add(controls); HorizontalPanel controlsLeft = new HorizontalPanel(); controls.add(controlsLeft); controls.setCellHorizontalAlignment(controlsLeft, HorizontalPanel.ALIGN_LEFT); HorizontalPanel controlsRight = new HorizontalPanel(); controls.add(controlsRight); controls.setCellHorizontalAlignment(controlsRight, HorizontalPanel.ALIGN_RIGHT); final Button toggleDebugButton = new Button("Toggle Debug"); DOM.setElementProperty(toggleDebugButton.getElement(), "title", "Toggles output of debug statements"); controlsLeft.add(toggleDebugButton); updateDisableButtonText(); DOM.setElementProperty(m_disableButton.getElement(), "title", "Prevents this console from appearing when debug statements are printed"); controlsLeft.add(m_disableButton); final Button clearButton = new Button("Clear"); DOM.setElementProperty(clearButton.getElement(), "title", "Clears all messages in the console"); controlsRight.add(clearButton); final Button hideButton = new Button("Hide"); DOM.setStyleAttribute(hideButton.getElement(), "textAlign", "right"); controlsRight.add(hideButton); setWidget(outer); m_left = Window.getClientWidth() / 2 - 640 / 2; m_top = Window.getClientHeight() / 2; m_enabler.install(); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (sender == clearButton) { clearMessages(); } else if (sender == hideButton) { hide(); } else if (sender == m_disableButton) { disable(); } else if (sender == toggleDebugButton) { if (Debug.isEnabled()) { Debug.disable(); } else { Debug.enable(); } } else { assert false; } } }; toggleDebugButton.addClickHandler(handler); m_disableButton.addClickHandler(handler); clearButton.addClickHandler(handler); hideButton.addClickHandler(handler); sinkEvents(Event.ONMOUSEDOWN); preventSelectionInIE(getElement()); }
From source file:asquare.gwt.tk.demo.client.DebugPanel.java
License:Apache License
public DebugPanel() { HorizontalPanel outer = new HorizontalPanel(); setWidget(outer);/* w w w . ja va 2 s . c o m*/ Widget docPanel = createDocPanel(); outer.add(docPanel); outer.setCellWidth(docPanel, "33%"); Widget controlPanel = createControlPanel(m_eventListener); outer.add(controlPanel); outer.setCellWidth(controlPanel, "33%"); Widget widgetPanel = createWidgetPanel(); outer.add(widgetPanel); m_eventListener.install(); }
From source file:asquare.gwt.tk.demo.client.DropDownPanelPanel.java
License:Apache License
public DropDownPanelPanel() { HorizontalPanel outer = new HorizontalPanel(); outer.setSize("100%", "100%"); setWidget(outer);//from www.j a v a2s . co m BasicPanel left = new BasicPanel(); DOM.setAttribute(left.getElement(), "id", "dropDown-left"); DropDownPanel dropDown1 = new DropDownPanel(); DOM.setAttribute(dropDown1.getElement(), "id", "dropDown-1"); dropDown1.setHeaderText("Drop Down 1", false); Image image = new Image("icecube.jpg"); image.setSize("100px", "100px"); dropDown1.add(image); dropDown1.setOpen(true); left.add(dropDown1); DropDownPanel dropDown2 = new DropDownPanel(); DOM.setAttribute(dropDown2.getElement(), "id", "dropDown-2"); dropDown2.setHeaderText("Drop Down 2", true); image = new Image("icecube.jpg"); image.setSize("100px", "250px"); dropDown2.add(image); left.add(dropDown2); outer.add(left); outer.setCellWidth(left, "1px"); String content = "<H2>Drop Down Panel</H2>" + "<p>This widget consists of a hideable content DIV and an optional header DIV.</p>" + "<p>The content can be <span id='open'></span> & <span id='close'></span> programatically.</p>" + "<p>The headers prevent selection of the text within them. In IE this is done in a special implementation using an <code>onselectstart</code> listener which returns <code>false</code>. In other browsers, <code>DOM.eventPreventDefault(Event)</code> for <code>Event.ONMOUSEDOWN</code> suffices. </p>" + "<p>You can add a listener to the DropDownPanel and make layout changes when the it opens/closes (e.g. maximize its parent element when it opens). </p>" + "<p>The tip-down arrows on the left are background images applied through CSS rules. <em>Note: we cannot put a border around the header itself because in IE the background image would be obscured by the border.</em></p>" + "<h4>Known problems</h4>" + "<ul><li>In IE, the cursor reverts to the system arrow after opening the headers on the left. This is a result of changing the tipdown arrow background image. (Alternative: insert the image with <code>DropDownPanel.setHeaderText()</code> and then change it via a DropDownListener.)</li></ul>" + "<p>Tested in IE 6 (Win), Firefox 1.5 (Win), Opera 8 (win) and Safari 2.0.4 (Mac) in Strict and Quirks modes.</p>"; DropDownPanel dropDown3 = new DropDownPanel(); DOM.setAttribute(dropDown3.getElement(), "id", "dropDown-3"); dropDown3.setHeaderText("Drop Down 3", true); HTMLPanel center = new HTMLPanel(content); SimpleHyperLink close = new SimpleHyperLink("hidden"); SimpleHyperLink open = new SimpleHyperLink("shown"); center.add(close, "close"); center.add(open, "open"); dropDown3.add(center); dropDown3.setOpen(true); outer.add(dropDown3); final DropDownPanel dropDown4 = new DropDownPanel(); DOM.setAttribute(dropDown4.getElement(), "id", "dropDown-4"); image = new Image("icecube.jpg"); image.setSize("200px", "250px"); dropDown4.add(image); outer.add(dropDown4); outer.setCellWidth(dropDown4, "1px"); open.addClickListener(new ClickListener() { public void onClick(Widget sender) { dropDown4.setOpen(true); } }); close.addClickListener(new ClickListener() { public void onClick(Widget sender) { dropDown4.setOpen(false); } }); }
From source file:asquare.gwt.tk.demo.client.MiscPanel.java
License:Apache License
public MiscPanel() { HorizontalPanel outer = new HorizontalPanel(); DOM.setAttribute(outer.getElement(), "id", "misc"); setWidget(outer);/*from ww w . j a v a 2s . c o m*/ BasicPanel left = new BasicPanel(); BasicPanel right = new BasicPanel(); left.add(createSimpleHyperLinkPanel()); // right.add(createBasicPanelPanel()); outer.add(left); outer.add(right); }
From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java
License:Apache License
public DialogPanel() { HorizontalPanel outer = new HorizontalPanel(); outer.setSize("100%", "100%"); initWidget(outer);//from w w w.j a v a2 s . c o m outer.add(createDoc()); BasicPanel demos = new BasicPanel(); demos.add(createModalDialogDemo()); demos.add(createAlertDialogDemo()); outer.add(demos); }
From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java
License:Apache License
private Widget createModalDialogDemo() { BasicPanel panel = new BasicPanel("div", "block"); panel.setStyleName("example division"); DomUtil.setStyleAttribute(panel, "whiteSpace", "nowrap"); panel.add(new HTML("<h4>ModalDialog examples</h4>")); class CloseListener implements ClickHandler { private final ModalDialog m_dialog; public CloseListener(ModalDialog dialog) { m_dialog = dialog;//from w w w. ja v a 2s. c o m } public void onClick(ClickEvent event) { m_dialog.hide(); } } class CloseButton extends Button { public CloseButton(ModalDialog dialog) { super("Close"); addClickHandler(new CloseListener(dialog)); } public CloseButton(ModalDialog dialog, String text) { super(text); addClickHandler(new CloseListener(dialog)); } } final Button plainDialog = new Button("Plain"); plainDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Caption area", false); dialog.add(new Label("Content area")); dialog.add(new CloseButton(dialog)); dialog.show(plainDialog); } }); panel.add(plainDialog); final Button verboseDialog = new Button("Verbose"); verboseDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Verbose dialog", false); dialog.add(new Label("Twas brillig, and the slithy toves " + " Did gyre and gimble in the wabe: " + "All mimsy were the borogoves, " + " And the mome raths outgrabe " + "Beware the Jabberwock, my son! " + "The jaws that bite, the claws that catch! " + "Beware the Jubjub bird, and shun " + "The frumious Bandersnatch!")); dialog.add(new CloseButton(dialog)); dialog.show(verboseDialog); } }); panel.add(verboseDialog); final Button captionLessDialog = new Button("No caption"); captionLessDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.add(new Label("Captionless dialog")); dialog.add(new CloseButton(dialog)); dialog.show(captionLessDialog); } }); panel.add(captionLessDialog); final Button loadingDialog = new Button("Loading..."); loadingDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); final Label label = new Label("0% loaded"); dialog.add(label); dialog.show(loadingDialog); new Timer() { private int m_count = 0; public void run() { label.setText(++m_count + "% loaded"); if (m_count == 100) { dialog.hide(); cancel(); } } }.scheduleRepeating(1); } }); panel.add(loadingDialog); final Button undraggableDialog = new Button("Drag disabled"); undraggableDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog() { protected List<Controller> createCaptionControllers() { List<Controller> result = new ArrayList<Controller>(); result.add(ControlSurfaceController.getInstance()); return result; } }; dialog.setCaption("Drag disabled", false); dialog.add(new Label( "This dialog uses a custom controller in the header which does not provide drag support.")); dialog.add(new CloseButton(dialog)); dialog.show(undraggableDialog); } }); panel.add(undraggableDialog); final Button styledDragDialog = new Button("Drag style"); styledDragDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); String oldPrimaryName = dialog.getStylePrimaryName(); dialog.setStylePrimaryName("dialog-dragstyle"); dialog.addStyleName(oldPrimaryName); dialog.setCaption("Drag me", false); dialog.add(new Label( "This dialog employs the \"tk-ModalDialog-dragging\" style which is applied while dragging. ")); dialog.add(new CloseButton(dialog)); dialog.show(styledDragDialog); } }); panel.add(styledDragDialog); final Button focusManagementDialog = new Button("Focus management"); focusManagementDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Register", false); FocusModel fModel = dialog.getFocusModel(); final int FIELD_COUNT = 3; Grid table = new Grid(FIELD_COUNT, 2); dialog.add(table); Widget[] labels = new Widget[FIELD_COUNT]; labels[0] = new Label("User name: "); labels[1] = new Label("Password: "); labels[2] = new Label("Retype password: "); FocusWidget[] fields = new FocusWidget[FIELD_COUNT]; fields[0] = new TextBox(); fields[1] = new PasswordTextBox(); fields[2] = new PasswordTextBox(); CellFormatter formatter = table.getCellFormatter(); for (int i = 0; i < labels.length; i++) { table.setWidget(i, 0, labels[i]); formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT); table.setWidget(i, 1, fields[i]); /* * Manually add fields to focus cycle. (The dialog does not * scan the children of panels for focusable widgets.) */ fModel.add(fields[i]); } // this widget will be focused when the dialog is shown fModel.setFocusWidget(fields[0]); ColumnPanel buttonPanel = new ColumnPanel(); buttonPanel.setWidth("100%"); dialog.add(buttonPanel); Button closeButton = new CloseButton(dialog, "Register!"); fModel.add(closeButton); buttonPanel.add(closeButton); Button cancelButton = new CloseButton(dialog, "Cancel"); fModel.add(cancelButton); buttonPanel.addWidget(cancelButton, false); buttonPanel.setCellHorizontalAlignment(ColumnPanel.ALIGN_RIGHT); dialog.show(focusManagementDialog); } }); panel.add(focusManagementDialog); final Button explicitlyPositionedDialog = new Button("Explicitly positioned"); explicitlyPositionedDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.removeController(dialog.getController(ModalDialog.PositionDialogController.class)); int contentWidth = 300; int contentHeight = 100; dialog.setContentWidth(contentWidth + "px"); dialog.setContentHeight(contentHeight + "px"); dialog.setPopupPosition(100, 100); dialog.setCaption("Explicitly positioned dialog", false); dialog.add(new Label( "Automatic positioning is disabled. Dimensions and position are set explicitly. ")); dialog.add(new CloseButton(dialog)); dialog.show(explicitlyPositionedDialog); } }); panel.add(explicitlyPositionedDialog); final Button multipleDialogs = new Button("Multiple dialogs"); multipleDialogs.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ModalDialog dialog = new ModalDialog(); dialog.setCaption("First dialog", false); FocusModel fModel = dialog.getFocusModel(); RowPanel outer = new RowPanel(); dialog.add(new HTML("")); final UrlLocation urlBox = new UrlLocation(); urlBox.setText("http://www.asquare.net"); urlBox.setWidth("350px"); fModel.add(urlBox); outer.add(urlBox); Button goButton = new Button("Go"); fModel.add(goButton); fModel.setFocusWidget(goButton); outer.addWidget(goButton, false); ListBox addressList = new ListBox(); addressList.addItem("Select an address"); addressList.addItem("http://www.asquare.net"); addressList.addItem("http://www.google.com"); addressList.addItem("http://www.sourceforge.net"); addressList.addItem("http://www.apache.org"); fModel.add(addressList); outer.add(addressList); final Frame frame = new Frame(); frame.setSize("400px", "200px"); outer.add(frame); urlBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { frame.setUrl(urlBox.getURL()); } }); goButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { frame.setUrl(urlBox.getURL()); } }); addressList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ListBox list = (ListBox) event.getSource(); if (list.getSelectedIndex() > 0) { urlBox.setText(list.getItemText(list.getSelectedIndex())); frame.setUrl(list.getItemText(list.getSelectedIndex())); } } }); final Button secondDialog = new Button("Show second dialog"); secondDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Second dialog", false); dialog.add(new Label("Note that you cannot manipulate the widgets in the first dialog. ")); dialog.add(new CloseButton(dialog)); dialog.show(secondDialog); } }); fModel.add(secondDialog); outer.add(secondDialog); Button closeButton = new CloseButton(dialog); fModel.add(closeButton); outer.add(closeButton); dialog.add(outer); dialog.show(multipleDialogs); } }); panel.add(multipleDialogs); final Button styledDialog = new Button("Styled"); styledDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.addStyleName("dialog-styled"); HorizontalPanel caption = new HorizontalPanel(); caption.setWidth("100%"); Label captionText = new Label("Oopsie!"); caption.add(captionText); caption.setCellWidth(captionText, "100%"); Image close = new Image("close.gif"); close.addClickHandler(new CloseListener(dialog)); caption.add(close); dialog.setCaption(caption); dialog.add(new Label("I've been a bad, bad browser.")); dialog.add(new Button("Deny ice cream", new CloseListener(dialog))); dialog.show(styledDialog); } }); panel.add(styledDialog); return panel; }
From source file:asquare.gwt.tkdemo.client.demos.DropDownPanelPanel.java
License:Apache License
public DropDownPanelPanel() { HorizontalPanel outer = new HorizontalPanel(); outer.setSize("100%", "100%"); initWidget(outer);/*from w w w . j av a2 s . c o m*/ BasicPanel left = new BasicPanel(); left.addStyleName("division"); DomUtil.setAttribute(left, "id", "dropDown-left"); DropDownPanel dropDown1 = new DropDownPanel(); DomUtil.setAttribute(dropDown1, "id", "dropDown-1"); dropDown1.setHeaderText("Drop Down 1", false); HTML dd1Content = new HTML("This DropDownPanel uses CSS to change the header image."); dropDown1.add(dd1Content); dropDown1.setOpen(true); left.add(dropDown1); final DropDownPanel dropDown2 = new DropDownPanel(); DomUtil.setAttribute(dropDown2, "id", "dropDown-2"); final String closedHeader = "<img src='triangle.gif'/> Drop Down 2"; final String openHeader = "<img src='opentriangle.gif'/> Drop Down 2"; dropDown2.setHeaderText(closedHeader, true); dropDown2.addDropDownListener(new DropDownListener() { public void dropDownClosed(DropDownPanel sender) { dropDown2.setHeaderText(closedHeader, true); } public void dropDownOpened(DropDownPanel sender) { dropDown2.setHeaderText(openHeader, true); } }); HTML dd2Content = new HTML("This DropDownPanel uses a listener to change the header image."); dropDown2.add(dd2Content); dropDown2.setOpen(true); left.add(dropDown2); outer.add(left); outer.setCellWidth(left, "1px"); String content = "<H2>DropDownPanel</H2>" + "<p>This widget consists of a hideable content DIV and an optional header DIV.</p>" + "<p>The content can be <span id='open'></span> & <span id='close'></span> programatically.</p>" + "<p>The headers prevent selection of the text within them. In IE this is done in a special implementation using an <code>onselectstart</code> listener which returns <code>false</code>. In other browsers, <code>DOM.eventPreventDefault(Event)</code> for <code>Event.ONMOUSEDOWN</code> suffices. </p>" + "<p>You can add a listener to the DropDownPanel and make layout changes when the it opens/closes (e.g. maximize its parent element when it opens). </p>" + "<p><em>Note: we cannot put a border around the Drop Down 1 header because in IE the background image would be obscured by the border.</em></p>"; DropDownPanel dropDown3 = new DropDownPanel(); dropDown3.addStyleName("division"); DomUtil.setAttribute(dropDown3, "id", "dropDown-3"); dropDown3.setHeaderText("Drop Down 3", true); HTMLPanel center = new HTMLPanel(content); center.addStyleName("description"); SimpleHyperLink close = new SimpleHyperLink("hidden"); SimpleHyperLink open = new SimpleHyperLink("shown"); center.add(close, "close"); center.add(open, "open"); dropDown3.add(center); dropDown3.setOpen(true); outer.add(dropDown3); final DropDownPanel dropDown4 = new DropDownPanel(); dropDown4.addStyleName("division"); DomUtil.setAttribute(dropDown4, "id", "dropDown-4"); Image image = new Image("icecube.jpg"); image.setSize("200px", "250px"); dropDown4.add(image); outer.add(dropDown4); outer.setCellWidth(dropDown4, "1px"); open.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dropDown4.setOpen(true); } }); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dropDown4.setOpen(false); } }); }
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 ww . j av a 2s .c o m HorizontalPanel examples = new HorizontalPanel(); examples.setWidth("100%"); examples.addStyleName("example"); examples.add(createFocusCycle1()); examples.add(createFocusCycle2()); add(examples); }