Examples of DialogBox


Examples of com.google.gwt.user.client.ui.DialogBox

  public static void show() {
    String panelHeight = "3em";
    String panelWidthLeft = "15em";
    String panelWidthRight = "20em";
    String textBoxWidth = "8em";
    final DialogBox dialogBox = new DialogBox();   
    dialogBox.setText(GuiFactory.strings.settingsLink());   
      
    VerticalPanel settingsPanel = new VerticalPanel();  
    TabPanel tabPanel = new TabPanel();  
       
    final ListBox languageListBox = new ListBox();  
    languageListBox.addItem(GuiFactory.strings.english_US());
    languageListBox.addItem(GuiFactory.strings.german());
    languageListBox.addItem(GuiFactory.strings.catalan());
       
    VerticalPanel generalPanel = new VerticalPanel();
    
    HorizontalPanel languagePanel = new HorizontalPanel();  
    languagePanel.setHeight(panelHeight);
    HorizontalPanel languagePanelLeft = new HorizontalPanel();
    HorizontalPanel languagePanelRight = new HorizontalPanel();
    
    languagePanelLeft.setWidth(panelWidthLeft);
    languagePanelLeft.add(new HTML("<b>" + GuiFactory.strings.language() + "</b>"));  
    languagePanelRight.setWidth(panelWidthRight);
    languagePanelRight.add(new HTML(GuiFactory.strings.displayRestDescribe() + ":&nbsp;"));
    languagePanelRight.add(languageListBox);  
       
    languagePanel.add(languagePanelLeft);
    languagePanel.add(languagePanelRight);  
    generalPanel.add(languagePanel);
    
    final HorizontalPanel confirmLangChange =  new HorizontalPanel();
    confirmLangChange.setVisible(false);
    confirmLangChange.add(new HTML(GuiFactory.strings.cautionChangesGetLost() + "&nbsp;"));
      
    final HTML confirmLink = new HTML("");
    confirmLangChange.add(confirmLink);
    confirmLangChange.add(new HTML("."));  
    generalPanel.add(confirmLangChange);  
    languageListBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {      
        updateAndDisplayConfirmLink(languageListBox.getItemText(languageListBox.getSelectedIndex()), confirmLink, confirmLangChange);
      }
    });
    languageListBox.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        updateAndDisplayConfirmLink(languageListBox.getItemText(languageListBox.getSelectedIndex()), confirmLink, confirmLangChange);
      }    
    });
    
    final CheckBox detailsCheckBox = new CheckBox();
    detailsCheckBox.setChecked(alwaysShowDetails);
    detailsCheckBox.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        if (detailsCheckBox.isChecked()) {
          alwaysShowDetailsTemp = true;       
        }
        else {
          alwaysShowDetailsTemp = false;
        }
      }
    });
      
    final CheckBox treesCheckBox = new CheckBox();
    treesCheckBox.setChecked(treeItemsAlwaysOpen);
    treesCheckBox.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        if (treesCheckBox.isChecked()) {
          treeItemsAlwaysOpenTemp = true;       
        }
        else {
          treeItemsAlwaysOpenTemp = false;
        }
      }
    });
   
    final HorizontalPanel miniSepTextPanel = new HorizontalPanel();
    final CheckBox useSeparationCharacterCheckBox = new CheckBox();
    useSeparationCharacterCheckBox.setChecked(useSeparationCharacter);
    useSeparationCharacterCheckBox.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        if (useSeparationCharacterCheckBox.isChecked()) {
          useSeparationCharacterTemp = true;       
        }
        else {
          useSeparationCharacterTemp = false;
        }
        miniSepTextPanel.setVisible(useSeparationCharacterTemp);
      }
    });
    
    final TextBox timeoutSecondsTextBox = new TextBox();
    timeoutSecondsTextBox.setText(Integer.toString(requestTimeoutSeconds));
    timeoutSecondsTextBox.setWidth(panelHeight);
    timeoutSecondsTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {
        try {
          requestTimeoutSeconds = Integer.parseInt(timeoutSecondsTextBox.getText());
          timeoutSecondsTextBox.removeStyleName("restDescribe-error");
        } catch (NumberFormatException e) {   
          timeoutSecondsTextBox.setStyleName("restDescribe-error");
        }
      }    
    });  
   
    miniSepTextPanel.setVisible(useSeparationCharacter);
    final TextBox separationCharacterTextBox = new TextBox();   
    separationCharacterTextBox.setText(separationCharacter);
    separationCharacterTextBox.setWidth(panelHeight);
    separationCharacterTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {
        separationCharacter = separationCharacterTextBox.getText();
      }    
    });
    
    final TextBox namingDepthTextBox = new TextBox();
    namingDepthTextBox.setText(Integer.toString(namingDepthLevel));
    namingDepthTextBox.setWidth(panelHeight);
    namingDepthTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {
        try {
          namingDepthLevel = Integer.parseInt(namingDepthTextBox.getText());
          namingDepthTextBox.removeStyleName("restDescribe-error");
          if (SettingsDialog.namingDepthLevel == 0) {
            namingDepthTextBox.setStyleName("restDescribe-error");
          }
        } catch (NumberFormatException e) {   
          namingDepthTextBox.setStyleName("restDescribe-error");
        }
      }    
    });
   
    final RadioButton useParameterAsNameRadio = new RadioButton("paramOrEndpoint", GuiFactory.strings.useParam());
    useParameterAsNameRadio.setChecked(!useEndpointAsName);
    useParameterAsNameRadio.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        useEndpointAsName = !useParameterAsNameRadio.isChecked();       
      }     
    });
   
    final RadioButton useEndpointAsNameRadio = new RadioButton("paramOrEndpoint", GuiFactory.strings.useEndpoint());
    useEndpointAsNameRadio.setChecked(useEndpointAsName);
    useEndpointAsNameRadio.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        useEndpointAsName = useEndpointAsNameRadio.isChecked();
      }     
    });
   
    final TextBox indentWidthTextBox = new TextBox();
    indentWidthTextBox.setWidth(panelHeight);
    indentWidthTextBox.setText(indentWidth + "");
    indentWidthTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {
        try {
          indentWidth = Integer.parseInt(indentWidthTextBox.getText());
          indentWidthTextBox.removeStyleName("restDescribe-error");
          if (SettingsDialog.indentWidth == 0) {
            indentWidthTextBox.setStyleName("restDescribe-error");
          }
        } catch (NumberFormatException e) {   
          indentWidthTextBox.setStyleName("restDescribe-error");
        }       
      }     
    });
   
    final HorizontalPanel indentMiniPanel = new HorizontalPanel();
    final RadioButton indentWithSpacesRadio = new RadioButton("indent", GuiFactory.strings.indentSpaces());
    indentWithSpacesRadio.setChecked(indentWithSpaces);
    indentWithSpacesRadio.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        indentWithSpaces = indentWithSpacesRadio.isChecked();
        indentMiniPanel.setVisible(true);
      }     
    });
   
    final RadioButton indentWithTabsRadio = new RadioButton("indent", GuiFactory.strings.indentTabs());
    indentWithTabsRadio.setChecked(!indentWithSpaces);
    indentWithTabsRadio.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        indentWithSpaces = !indentWithTabsRadio.isChecked();
        indentMiniPanel.setVisible(false);
      }     
    });
   
    final TextBox classSuffixTextBox = new TextBox();
    classSuffixTextBox.setText(classDefaultSuffix);
    classSuffixTextBox.setWidth(textBoxWidth);
    classSuffixTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {
        classDefaultSuffix = classSuffixTextBox.getText();       
      }
    });
    
    final TextBox pathToDiscovererTextBox = new TextBox();
    pathToDiscovererTextBox.setText(pathToDiscoverer);
    pathToDiscovererTextBox.setWidth(textBoxWidth);
    pathToDiscovererTextBox.addChangeListener(new ChangeListener() {
      public void onChange(Widget sender) {       
        pathToDiscoverer = pathToDiscovererTextBox.getText();       
      }    
    });
   
    // preferences
    VerticalPanel preferencesPanel = new VerticalPanel();
    preferencesPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    
    // details
    HorizontalPanel detailsPanel = new HorizontalPanel();
    detailsPanel.setHeight(panelHeight);
    HorizontalPanel detailsPanelLeft = new HorizontalPanel();
    HorizontalPanel detailsPanelRight = new HorizontalPanel();  
    detailsPanelLeft.setWidth(panelWidthLeft);
    detailsPanelLeft.add(new HTML("<b>" + GuiFactory.strings.details() + "</b>"));
    detailsPanelRight.setWidth(panelWidthRight);
    detailsPanelRight.add(detailsCheckBox);
    detailsPanelRight.add(new HTML(GuiFactory.strings.displayDetails()));
    detailsPanel.add(detailsPanelLeft);
    detailsPanel.add(detailsPanelRight);  
    preferencesPanel.add(detailsPanel);
    
    // tree items open
    HorizontalPanel treesPanel = new HorizontalPanel();
    treesPanel.setHeight(panelHeight);
    HorizontalPanel treesPanelLeft = new HorizontalPanel();
    HorizontalPanel treesPanelRight = new HorizontalPanel();  
    treesPanelLeft.setWidth(panelWidthLeft);
    treesPanelLeft.add(new HTML("<b>" + GuiFactory.strings.treesOpen() + "</b>"));
    treesPanelRight.setWidth(panelWidthRight);
    treesPanelRight.add(treesCheckBox);
    treesPanelRight.add(new HTML(GuiFactory.strings.treesAlwaysOpen()));
    treesPanel.add(treesPanelLeft);
    treesPanel.add(treesPanelRight);  
    preferencesPanel.add(treesPanel);
        
    // request tab
    VerticalPanel requestPanel = new VerticalPanel();
    requestPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // path to discoverer
    HorizontalPanel pathPanel = new HorizontalPanel();
    pathPanel.setHeight(panelHeight);
    HorizontalPanel pathPanelLeft = new HorizontalPanel();
    HorizontalPanel pathPanelRight = new HorizontalPanel();
    pathPanelLeft.setWidth(panelWidthLeft);
    pathPanelLeft.add(new HTML("<b>" + GuiFactory.strings.pathDiscover() + "</b>"));
    pathPanelRight.setWidth(panelWidthRight);
    pathPanelRight.add(pathToDiscovererTextBox);
    pathPanelRight.add(new HTML(GuiFactory.strings.pathToDiscoverer()));  
    pathPanel.add(pathPanelLeft);
    pathPanel.add(pathPanelRight);  
    requestPanel.add(pathPanel);
   
    // timeout
    HorizontalPanel timeoutPanel = new HorizontalPanel();
    timeoutPanel.setHeight(panelHeight);
    HorizontalPanel timeoutPanelLeft = new HorizontalPanel();
    HorizontalPanel timeoutPanelRight = new HorizontalPanel();
    timeoutPanelLeft.setWidth(panelWidthLeft);
    timeoutPanelLeft.add(new HTML("<b>" + GuiFactory.strings.timeout() + "</b>"));
    timeoutPanelRight.setWidth(panelWidthRight);
    timeoutPanelRight.add(timeoutSecondsTextBox);
    timeoutPanelRight.add(new HTML(GuiFactory.strings.timeoutSeconds()));  
    timeoutPanel.add(timeoutPanelLeft);
    timeoutPanel.add(timeoutPanelRight);  
    requestPanel.add(timeoutPanel);
   
    // code generation tab
    VerticalPanel codeGenerationPanel = new VerticalPanel();
    codeGenerationPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
   
    // naming depth
    HorizontalPanel namingDepthPanel = new HorizontalPanel();
    namingDepthPanel.setHeight(panelHeight);
    HorizontalPanel namingDepthPanelLeft = new HorizontalPanel();
    HorizontalPanel namingDepthPanelRight = new HorizontalPanel();
    namingDepthPanelLeft.setWidth(panelWidthLeft);
    namingDepthPanelLeft.add(new HTML("<b>" + GuiFactory.strings.namingDepth() + "</b>"));
    namingDepthPanelRight.setWidth(panelWidthRight);
    namingDepthPanelRight.add(namingDepthTextBox);
    namingDepthPanelRight.add(new HTML(GuiFactory.strings.namingDepthLevel()));  
    namingDepthPanel.add(namingDepthPanelLeft);
    namingDepthPanel.add(namingDepthPanelRight);  
    codeGenerationPanel.add(namingDepthPanel);
   
    // class default suffix
    HorizontalPanel classSuffixPanel = new HorizontalPanel();
    classSuffixPanel.setHeight(panelHeight);
    HorizontalPanel classSuffixPanelLeft = new HorizontalPanel();
    HorizontalPanel classSuffixPanelRight = new HorizontalPanel();
    classSuffixPanelLeft.setWidth(panelWidthLeft);
    classSuffixPanelLeft.add(new HTML("<b>" + GuiFactory.strings.classSuffix() + "</b>"));
    classSuffixPanelRight.setWidth(panelWidthRight);
    classSuffixPanelRight.add(classSuffixTextBox);
    classSuffixPanelRight.add(new HTML(GuiFactory.strings.classDefaultSuffix()));  
    classSuffixPanel.add(classSuffixPanelLeft);
    classSuffixPanel.add(classSuffixPanelRight);  
    codeGenerationPanel.add(classSuffixPanel);
   
    // source for class names
    HorizontalPanel classNamePanel = new HorizontalPanel();
    classNamePanel.setHeight(panelHeight);
    HorizontalPanel classNamePanelLeft = new HorizontalPanel();
    HorizontalPanel classNamePanelRight = new HorizontalPanel();
    classNamePanelLeft.setWidth(panelWidthLeft);
    classNamePanelLeft.add(new HTML("<b>" + GuiFactory.strings.className() + "</b>"));
    classNamePanelRight.setWidth(panelWidthRight);
    VerticalPanel radioPanel = new VerticalPanel();   
    radioPanel.add(useEndpointAsNameRadio);
    radioPanel.add(useParameterAsNameRadio);
    classNamePanelRight.add(radioPanel);      
    classNamePanel.add(classNamePanelLeft);
    classNamePanel.add(classNamePanelRight);  
    codeGenerationPanel.add(classNamePanel);
   
    // source for class names
    HorizontalPanel indentionPanel = new HorizontalPanel();
    indentionPanel.setHeight(panelHeight);
    HorizontalPanel indentionPanelLeft = new HorizontalPanel();
    HorizontalPanel indentionPanelRight = new HorizontalPanel();
    indentionPanelLeft.setWidth(panelWidthLeft);
    indentionPanelLeft.add(new HTML("<b>" + GuiFactory.strings.indentionStyle() + "</b>"));
    indentionPanelRight.setWidth(panelWidthRight);
    VerticalPanel indentionRadioPanel = new VerticalPanel();
    indentionRadioPanel.add(indentWithSpacesRadio);   
    indentMiniPanel.add(indentWidthTextBox);
    indentMiniPanel.add(new HTML(GuiFactory.strings.indentionWidth()));
    indentionRadioPanel.add(indentMiniPanel);
    indentionRadioPanel.add(indentWithTabsRadio);
    indentionPanelRight.add(indentionRadioPanel);      
    indentionPanel.add(indentionPanelLeft);
    indentionPanel.add(indentionPanelRight);  
    codeGenerationPanel.add(indentionPanel);
   
    // use separation character
    HorizontalPanel useSeparationCharacterPanel = new HorizontalPanel();
    useSeparationCharacterPanel.setHeight(panelHeight);
    HorizontalPanel useSeparationCharacterPanelLeft = new HorizontalPanel();
    HorizontalPanel useSeparationCharacterPanelRight = new HorizontalPanel();  
    useSeparationCharacterPanelLeft.setWidth(panelWidthLeft);
    useSeparationCharacterPanelLeft.add(new HTML("<b>" + GuiFactory.strings.sepChar() + "</b>"));
    useSeparationCharacterPanelRight.setWidth(panelWidthRight);
    VerticalPanel miniSepPanel = new VerticalPanel();   
    HorizontalPanel miniSepCheckPanel = new HorizontalPanel();
    miniSepPanel.add(miniSepCheckPanel);
    miniSepCheckPanel.add(useSeparationCharacterCheckBox);
    miniSepCheckPanel.add(new HTML(GuiFactory.strings.useSepChar()));   
    miniSepTextPanel.add(separationCharacterTextBox);
    miniSepTextPanel.add(new HTML(GuiFactory.strings.sepWithChar()));
    miniSepPanel.add(miniSepTextPanel);
    useSeparationCharacterPanelRight.add(miniSepPanel);   
    useSeparationCharacterPanel.add(useSeparationCharacterPanelLeft);
    useSeparationCharacterPanel.add(useSeparationCharacterPanelRight);  
    codeGenerationPanel.add(useSeparationCharacterPanel);
   
    tabPanel.add(generalPanel, "<a href=\"#\">" + GuiFactory.strings.generalTab() + "</a>", true);
    tabPanel.add(preferencesPanel, "<a href=\"#\">" + GuiFactory.strings.preferencesTab() + "</a>", true);
    tabPanel.add(requestPanel, "<a href=\"#\">" + GuiFactory.strings.requestTab() + "</a>", true);
    tabPanel.add(codeGenerationPanel, "<a href=\"#\">" + GuiFactory.strings.codeGenerationTab() + "</a>", true);
    tabPanel.selectTab(0);
      
    // ok button
    HorizontalPanel buttonPanel = new HorizontalPanel();
    Button okButton = new Button(GuiFactory.strings.ok());
    buttonPanel.add(okButton);
    okButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        // apply changes
        alwaysShowDetails = alwaysShowDetailsTemp;
        treeItemsAlwaysOpen = treeItemsAlwaysOpenTemp;
        useSeparationCharacter = useSeparationCharacterTemp;       
        RestCompilePanel.generateCode(CodeGenerator.language);
        GuiFactory.blockScreen(false);      
        dialogBox.hide();
      }
    });
    
    // cancel button
    Button closeButton = new Button(GuiFactory.strings.cancel());
    buttonPanel.add(closeButton);
    closeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {   
        GuiFactory.blockScreen(false);
        dialogBox.hide();
      }
    });
    
    settingsPanel.add(new HTML("<br />"));
    settingsPanel.add(tabPanel);
    settingsPanel.add(new HTML("<br />"));
    settingsPanel.add(buttonPanel);
    settingsPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    
    dialogBox.setPopupPosition((int) Math.floor(Window.getClientWidth() / 4), (int) Math.floor(Window.getClientHeight() / 4));
    dialogBox.setWidget(settingsPanel);  
    GuiFactory.blockScreen(true);   
    dialogBox.show();  
  }
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

  @Override
  //TODO: when calling this handler, threat required widgets when they implement HasData.
  public Widget handleValidationError(Widget widget, String errorMessage)
  {
    widget.addStyleName("error");
    DialogBox errorMsgDialog = new DialogBox();
    errorMsgDialog.setStyleName("errorMsg");
    errorMsgDialog.showRelativeTo(widget);
    return errorMsgDialog;
  }
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

*/
public class FullscreenDialog
  public static Button leaveFullscreenButton;
 
  public static void show(final ScrollPanel wadlArea) {
    final DialogBox dialogBox = new DialogBox();  
    final HorizontalPanel fullscreenPanel = new HorizontalPanel();
   
    Window.addWindowResizeListener(new WindowResizeListener() {
      public void onWindowResized(int width, int height) {
        dialogBox.setHeight(height + "px");
        dialogBox.setWidth(width + "px");
        fullscreenPanel.setWidth("100%");
        fullscreenPanel.setHeight("100%");       
        wadlArea.setHeight(Window.getClientHeight() - 40 + "px");
        wadlArea.setWidth(Window.getClientWidth() - 120 + "px");
      }
    });
   
    dialogBox.setText(GuiFactory.strings.fullscreenTitle());   
       
    fullscreenPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
   
    VerticalPanel buttonPanel = new VerticalPanel();
    fullscreenPanel.setWidth("100%");
    fullscreenPanel.setHeight("100%");
    fullscreenPanel.add(wadlArea);   
    wadlArea.setHeight(Window.getClientHeight() - 40 + "px");
    wadlArea.setWidth(Window.getClientWidth() - 120 + "px");
   
    String buttonWidth = "8em";
    Button wadlSaveButton = new Button(GuiFactory.strings.dumpXml());
    wadlSaveButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        WadlPanel.save();       
      }     
    });
    wadlSaveButton.setWidth(buttonWidth);
    buttonPanel.add(wadlSaveButton);
   
    Button wadlPreviewButton = new Button(GuiFactory.strings.prettyPrintXml());
    wadlPreviewButton.setWidth(buttonWidth);
    wadlPreviewButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        WadlPanel.preview();       
      }     
    });
    buttonPanel.add(wadlPreviewButton);  
   
    // leave fullscreen button   
    leaveFullscreenButton = new Button(GuiFactory.strings.leaveFullscreen());
    leaveFullscreenButton.setWidth(buttonWidth);
    buttonPanel.add(leaveFullscreenButton);
    leaveFullscreenButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        int width = Window.getClientWidth();
        int height = Window.getClientHeight();
        int panelHeight = height - RequestUriPanel.requestSamplePanel.getOffsetHeight() - MainMenuPanel.menuPanel.getOffsetHeight() - WadlPanel.wadlHeader.getOffsetHeight() - 80;
        WadlPanel.wadlArea.setHeight(panelHeight + "px");
        WadlPanel.wadlArea.setWidth(Math.floor(0.58 * width) + "px");       
       
        WadlPanel.containerPanel.insert(wadlArea, 0);
        WadlPanel.wadlPanel.setHeight("100%");
        WadlPanel.wadlPanel.setWidth("95%");       
       
        ParameterPanel.parameterPanel.setHeight("100%");
        ParameterPanel.parameterPanel.setWidth("100%");
        ParameterPanel.requestArea.setHeight(panelHeight + "px");
        ParameterPanel.requestArea.setWidth(Math.floor(0.28 * width) + "px");       
               
        RequestUriPanel.requestSampleArea.setHeight(Math.floor(0.1 * height) + "px");   
        RequestUriPanel.containerPanel.setWidth(Math.floor(0.97 * width) + "px");
       
        GuiFactory.blockScreen(false);
        dialogBox.hide();
      }
    });       
    fullscreenPanel.add(buttonPanel);
   
    Button generateCodeButton = new Button(GuiFactory.strings.generateCode());
    generateCodeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        WadlPanel.generateCode();       
      }     
    });
    generateCodeButton.setWidth(buttonWidth);   
    buttonPanel.add(generateCodeButton);
   
    Button resetButton = new Button(GuiFactory.strings.resetWadl());
    resetButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        WadlPanel.reset();       
      }     
    });
    resetButton.setWidth(buttonWidth);   
    buttonPanel.add(resetButton);
           
   
    dialogBox.setHeight(Window.getClientHeight() + "px");
    dialogBox.setWidth(Window.getClientWidth() + "px");
    dialogBox.setPopupPosition(0, 0);
    dialogBox.setWidget(fullscreenPanel);
   
    GuiFactory.blockScreen(true);   
    dialogBox.show()
  }
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

    final Button editTypeButton = new Button(GuiFactory.strings.editType());
    final Button closeButton = new Button(GuiFactory.strings.cancel());   
    optionsTextArea.setEnabled(false);
    optionsTextArea.setText("");   
   
    final DialogBox dialog = new DialogBox();
    dialog.setText(GuiFactory.strings.newCustomType());   
   
    final VerticalPanel containerPanel = new VerticalPanel();          
   
    containerPanel.add(new HTML("<br />" + GuiFactory.strings.availableTypes()));
    final ListBox customTypesListBox = new ListBox();
    ParamItem.addCustomTypes(customTypesListBox);
    customTypesListBox.addChangeListener(new ChangeListener() { 
      public void onChange(Widget sender) {
        loadOptions(customTypesListBox.getItemText(customTypesListBox.getSelectedIndex()));
      }     
    });
    String listBoxAndTextBoxWidth = "12em";
    customTypesListBox.setWidth(listBoxAndTextBoxWidth);
   
    containerPanel.add(customTypesListBox);   
   
    // hidden inner panel, pops up and replaces the listbox when a new custom type is entered
    final VerticalPanel innerPanel = new VerticalPanel();
    containerPanel.add(innerPanel);
    innerPanel.setVisible(false);   
    final HorizontalPanel innerContainerPanel = new HorizontalPanel();
    innerPanel.add(innerContainerPanel);
    final TextBox typeTextBox = new TextBox();
    typeTextBox.setText("");
    typeTextBox.setWidth(listBoxAndTextBoxWidth);
    innerContainerPanel.add(typeTextBox);
    final HorizontalPanel innerErrorMessagepanel = new HorizontalPanel();
    innerErrorMessagepanel.setVisible(false);
    innerPanel.add(innerErrorMessagepanel);
    innerErrorMessagepanel.add(new HTML(GuiFactory.strings.fillNamesAndValues()));
   
    //  ok button of the hidden inner panel
    Button okButton = new Button(GuiFactory.strings.ok());   
    okButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        if ((typeTextBox.getText().replaceAll("\n", "").length() > 0) && (optionsTextArea.getText().length() > 0)) {
          innerErrorMessagepanel.setVisible(false);
         
          if (!ParamItem.customTypes.contains(typeTextBox.getText())) {
            ParamItem.customTypes.add(typeTextBox.getText());
          }
          Vector options = new Vector();
          String[] optionStrings = optionsTextArea.getText().split("\n");
          for (int i = 0; i < optionStrings.length; i++) {
            if (!options.contains(optionStrings[i])) options.add(optionStrings[i]);
          }
          ParamItem.customTypeOptions.put(typeTextBox.getText(), options);
          ParamItem.addCustomTypesAndClear(customTypesListBox);
          customTypesListBox.setSelectedIndex(getIndexOf(typeTextBox.getText()));
         
          customTypesListBox.setVisible(true);       
          innerPanel.setVisible(false);   
          optionsTextArea.setEnabled(false);
          newTypeButton.setEnabled(true);
          deleteTypeButton.setEnabled(true);
          editTypeButton.setEnabled(true);
          closeButton.setEnabled(true);
          acceptTypeButton.setEnabled(true);
        }
        else {
          innerErrorMessagepanel.setVisible(true);
        }               
      }
    });
    innerContainerPanel.add(okButton);   
    // cancel button of the hidden inner panel
    Button cancelButton = new Button(GuiFactory.strings.cancel());   
    cancelButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {  
        optionsTextArea.setText("");
        typeTextBox.setText("");
        customTypesListBox.setVisible(true);
        innerPanel.setVisible(false)
        optionsTextArea.setEnabled(false);
        newTypeButton.setEnabled(true);
        deleteTypeButton.setEnabled(true);
        editTypeButton.setEnabled(true);
        closeButton.setEnabled(true);
        acceptTypeButton.setEnabled(true);
      }
    });
    innerContainerPanel.add(cancelButton);
   
    HorizontalPanel newTypePanel = new HorizontalPanel();
    newTypePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    containerPanel.add(newTypePanel);
    VerticalPanel typesPanel = new VerticalPanel();
    typesPanel.add(new HTML("<br />" + GuiFactory.strings.allowedOptions()));   
    optionsTextArea.setWidth("15em");
    optionsTextArea.setHeight("10em");   
    typesPanel.add(optionsTextArea);
    newTypePanel.add(typesPanel);
   
    VerticalPanel buttonPanel = new VerticalPanel();
   
    // new type button
    String buttonWidth = "10em";
    newTypeButton.setWidth(buttonWidth);
    newTypeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {            
        customTypesListBox.setVisible(false);       
        innerPanel.setVisible(true);
        typeTextBox.setText("");
        typeTextBox.setFocus(true);
        optionsTextArea.setText("");
        optionsTextArea.setEnabled(true);
        newTypeButton.setEnabled(false);
        editTypeButton.setEnabled(false);
        deleteTypeButton.setEnabled(false);
        closeButton.setEnabled(false);
        acceptTypeButton.setEnabled(false);
      }
    });
    buttonPanel.add(newTypeButton);  
   
    // edit type button
    editTypeButton.setWidth(buttonWidth);
    buttonPanel.add(editTypeButton);       
    editTypeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        if (customTypesListBox.getItemCount() > 0) {
          customTypesListBox.setVisible(false);   
          newTypeButton.setEnabled(false);
          editTypeButton.setEnabled(false);
          deleteTypeButton.setEnabled(false);
          closeButton.setEnabled(false);
          acceptTypeButton.setEnabled(false);
          String oldName = customTypesListBox.getItemText(customTypesListBox.getSelectedIndex());
          typeTextBox.setText(oldName);        
          optionsTextArea.setEnabled(true);
          innerPanel.setVisible(true);         
        }
      }
    });
   
    // delete type button
    deleteTypeButton.setWidth(buttonWidth);
    buttonPanel.add(deleteTypeButton);       
    newTypePanel.add(buttonPanel);
    deleteTypeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        if (customTypesListBox.getItemCount() > 0) {            
          String selectedCustomType = customTypesListBox.getItemText(customTypesListBox.getSelectedIndex());
          ParamItem.customTypes.remove(selectedCustomType);
          ParamItem.customTypeOptions.remove(selectedCustomType);         
          customTypesListBox.removeItem(customTypesListBox.getSelectedIndex());
          optionsTextArea.setText("");
          if (param.getType().equals(selectedCustomType)) {
            param.setOptions(new Vector());           
          }
          if (customTypesListBox.getItemCount() > 0) {
            loadOptions(customTypesListBox.getItemText(customTypesListBox.getSelectedIndex()));
          }
        }
      }
    });
  
    // accept type button
    acceptTypeButton.addClickListener(new ClickListener() {   
      public void onClick(Widget sender) {
        GuiFactory.blockScreen(false);
        if (customTypesListBox.getItemCount() > 0) {
          ParamItem.addTypes(parameterType);       
          String selectedCustomType = customTypesListBox.getItemText(customTypesListBox.getSelectedIndex());
          parameterType.setSelectedIndex(ParamItem.indexOfValue(selectedCustomType));         
       
          param.updateType(param.getType(), selectedCustomType);
          param.setEstimateQuality(TypeEstimator.manual);
          param.setOptions((Vector) ParamItem.customTypeOptions.get(selectedCustomType));                   
        }
        ParamItem.listParams(
            parentNode,
            parentTreeItem,
            parentNode.getApplication().getAnalyzer().getRequestString());      
        parentTreeItem.getChild(paramCounter).setSelected(true);
        parentTreeItem.getTree().ensureSelectedItemVisible();

        dialog.hide();       
      }
    });
    acceptTypeButton.setWidth(buttonWidth);
   
    // close button
    closeButton.setWidth(buttonWidth);
    closeButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        ParamItem.listParams(
            parentNode,
            parentTreeItem,
            parentNode.getApplication().getAnalyzer().getRequestString());      
        parentTreeItem.getChild(paramCounter).setSelected(true);
        parentTreeItem.getTree().ensureSelectedItemVisible();
        GuiFactory.blockScreen(false);
        dialog.hide();
      }
    });
   
    containerPanel.add(new HTML("<br />&nbsp;"));
    HorizontalPanel okClosePanel = new HorizontalPanel();
    okClosePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    okClosePanel.setWidth("100%");   
    okClosePanel.add(acceptTypeButton);
    okClosePanel.add(closeButton);
    containerPanel.add(okClosePanel);
 
    if (ParamItem.customTypes.size() > 0) {
      loadOptions(customTypesListBox.getItemText(customTypesListBox.getSelectedIndex()));
    }
   
    dialog.setWidget(containerPanel);
    dialog.setPopupPosition((int) Math.floor(Window.getClientWidth() * 0.4), (int) Math.floor(Window.getClientHeight() * 0.2));
    GuiFactory.blockScreen(true);
    dialog.show();   
  }
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

      }
    }
 
  private static DialogBox createAlertBox(final String content)
  {
        final DialogBox box = new DialogBox();
        contentLabel = new Label(content);
        box.add(contentLabel);
        box.center();
        return box;
    }
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

  private Label label;
 
  @Override
  public void onModuleLoad()
  {
    dialogBox = new DialogBox();
    label = new Label();
    dialogBox.add(label);
    //TODO take the URL from user, as a parameter... if not provided, use the expression below as default
    final String url = "ws://" + Window.Location.getHostName() + ":" + DEFAULT_COMPILER_NOTIFIER_PORT;
    final WebSocket socket = WebSocket.createIfSupported(url);
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

  int statusCode = 0;
  DialogBox timeoutDB;
  Label timeoutMessage;

  private void createConnectAttemptGUI() {
    timeoutDB = new DialogBox();
    timeoutMessage = new Label();
    timeoutDB.add(timeoutMessage);
    RootPanel.get().add(timeoutDB);
    timeoutDB.show();
    timeoutDB.center();
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

  int statusCode = 0;
  DialogBox timeoutDB;
  Label timeoutMessage;

  private void createConnectAttemptGUI() {
    timeoutDB = new DialogBox();
    timeoutMessage = new Label();
    timeoutDB.add(timeoutMessage);
    RootPanel.get().add(timeoutDB);
    timeoutDB.show();
    timeoutDB.center();
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

    });
  }

  private void addCacheEntiry() {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Add Cache Entity to " + nameField.getText());
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("OK");
    closeButton.getElement().setId("closeButton");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Enter key:</b>"));
    final TextBox key = new TextBox();
    key.setText("key");
    key.setFocus(true);
    key.selectAll();
    dialogVPanel.add(key);
    dialogVPanel.add(new HTML("<b>Enter Value:</b>"));
    final TextBox value = new TextBox();
    value.setText("value");
    value.setFocus(true);
    value.selectAll();
    dialogVPanel.add(value);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);
    dialogBox.center();
   
    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        jbossCacheService.addCacheContent(nameField.getText(), key.getText(), value.getText(), new AsyncCallback<Integer>(){

          public void onFailure(Throwable t) {
            throw new JBossCacheGUIException("add entity to " + nameField.getText() + " error", t);
          }

              public void onSuccess(Integer result) {
                if(result != 1) {
                  throw new JBossCacheGUIException("add entity to " + nameField.getText() + " error");
                }
              }
            });
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
        initTreeItem()
      }
    });
View Full Code Here

Examples of com.google.gwt.user.client.ui.DialogBox

    grid.setVisible(true);
  }
 
  @UiHandler("productsAddBtn")
  void onClick(ClickEvent e) {
    final DialogBox dialog = new DialogBox(true);
    dialog.setText(constants.proposalsPleaseSelectProducts());
    dialog.addAttachHandler(new AttachEvent.Handler() {
      @Override
      public void onAttachOrDetach(AttachEvent event) {
        dialog.center();
      }
    });
    dialog.add(new AddProductView());
    dialog.show();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.