Beispiel #1
2
 private void search() {
   if (win.getHeight() < RESULT_HEIGHT) {
     win.setHeight(RESULT_HEIGHT);
   }
   win.show();
   win.center();
   results.search(searchInput.getText());
 }
 @Override
 protected void onDestroy() {
   listeners.clear();
   if (selectWindow != null) {
     selectWindow.destroy();
   }
   super.onDestroy();
 }
 protected void onUserDefinedTabAdded() {
   final Window window = new Window();
   window.setTitle("Create your own tab");
   window.setClosable(true);
   window.setPaddings(7);
   window.setCloseAction(Window.HIDE);
   window.add(new CreateUserDefinedTabForm(window));
   window.show();
 }
Beispiel #4
0
  /**
   * Default constructor.
   *
   * @param resultsListView the instance of the results list view to use
   */
  public SearchForm(SearchResultsListView resultsListView) {
    super();
    setBorder(false);
    setHideLabels(true);

    // using an inner panel to customize the layout
    Panel innerPanel = new Panel();
    innerPanel.setBorder(false);
    innerPanel.setLayout(new HorizontalLayout(5));

    searchInput = new TextField();
    searchInput.setName(SearchLookupConfiguration.IN_QUERY);
    searchInput.setWidth(200); // width of search input box
    setFieldListeners(searchInput);
    innerPanel.add(searchInput);

    Button submitButton = makeStandardSubmitButton(UtilUi.MSG.search());
    innerPanel.add(submitButton);

    add(innerPanel);

    win = new Window(UtilUi.MSG.searchResults());
    win.setModal(false);
    win.setResizable(true);
    win.setMinHeight(RESULT_HEIGHT);
    win.setLayout(new FitLayout());
    win.setCloseAction(Window.HIDE);

    results = resultsListView;
    results.setFrame(false);
    results.setAutoHeight(false);
    results.setCollapsible(false);
    results.setHeader(false);
    results.setBorder(false);
    results.setWidth(RESULT_WIDTH);
    win.add(results);
  }
  public Panel getViewPanel() {
    if (panel == null) {
      panel = new Panel();

      // center panel
      TabPanel tabPanel = new TabPanel();
      tabPanel.setActiveTab(0);

      Panel tab1 = new Panel();
      tab1.setTitle("Bogus Tab");
      tab1.setHtml(SampleData.getBogusMarkup());
      tab1.setAutoScroll(true);

      Panel tab2 = new Panel();
      tab2.setTitle("Another Tab");
      tab2.setHtml(SampleData.getBogusMarkup());
      tab2.setAutoScroll(true);

      Panel tab3 = new Panel();
      tab3.setTitle("Closable Tab");
      tab3.setHtml(SampleData.getBogusMarkup());
      tab3.setAutoScroll(true);
      tab3.setClosable(true);

      tabPanel.add(tab1);
      tabPanel.add(tab2);
      tabPanel.add(tab3);

      // west panel
      Panel navPanel = new Panel();
      navPanel.setTitle("Navigation");
      navPanel.setWidth(200);
      navPanel.setCollapsible(true);

      BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
      centerData.setMargins(3, 0, 3, 3);

      BorderLayoutData westData = new BorderLayoutData(RegionPosition.WEST);
      westData.setSplit(true);
      westData.setMargins(3, 3, 0, 3);
      westData.setCMargins(3, 3, 3, 3);

      final Window window = new Window();
      window.setTitle("Layout Window");
      window.setClosable(true);
      window.setWidth(600);
      window.setHeight(350);
      window.setPlain(true);
      window.setLayout(new BorderLayout());
      window.add(tabPanel, centerData);
      window.add(navPanel, westData);
      window.setCloseAction(Window.HIDE);

      Button button = new Button("Show Window");
      button.addListener(
          new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject e) {
              window.show(button.getId());
            }
          });

      panel.add(button);
    }
    return panel;
  }
  protected void onSelectEntity() {
    if (selectWindow == null) {
      selectWindow = new com.gwtext.client.widgets.Window();
      selectWindow.setTitle(getFieldLabel());
      selectWindow.setWidth(600);
      selectWindow.setHeight(480);
      selectWindow.setMinWidth(300);
      selectWindow.setMinHeight(350);
      selectWindow.setLayout(new FitLayout());
      selectWindow.setPaddings(5);
      selectWindow.setButtonAlign(Position.CENTER);

      // window.setCloseAction(Window.HIDE);
      selectWindow.setPlain(true);

      com.gwtext.client.widgets.Button cancelButton =
          new com.gwtext.client.widgets.Button("Cancel");
      cancelButton.addListener(
          new ButtonListenerAdapter() {
            @Override
            public void onClick(Button button, EventObject e) {
              selectWindow.hide();
            }
          });

      com.gwtext.client.widgets.Button selectButton =
          new com.gwtext.client.widgets.Button("Select");
      selectButton.addListener(
          new ButtonListenerAdapter() {
            @Override
            public void onClick(Button button, EventObject e) {
              Collection<EntityData> selection = getSelectable().getSelection();
              if (selection == null || selection.size() == 0) {
                MessageBox.alert(
                    "No selection", "No class selected. Please select a class from the tree.");
                return;
              }
              setClsValues(selection);
              selectWindow.hide();
            }
          });

      selectWindow.add(getSelectable());
      selectWindow.addButton(selectButton);
      selectWindow.addButton(cancelButton);
    }

    if (!selectWindow.isVisible()) {
      selectWindow.show();
      selectWindow.center();
    }
  }