Package com.google.gwt.user.client.ui

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


    disableTextSelection(true);

    header = new Header();
    header.render(getElement());

    days = new Grid(1, 7);
    days.setStyleName("x-date-days");
    days.setCellPadding(0);
    days.setCellSpacing(0);
    days.setBorderWidth(0);

    String[] dn = constants.narrowWeekdays();
    String[] longdn = constants.weekdays();
   
    firstDOW = startDay != Integer.MIN_VALUE ? startDay : Integer.parseInt(constants.firstDayOfTheWeek()) - 1;

    days.setHTML(0, 0, "<span>" + dn[(0 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 1, "<span>" + dn[(1 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 2, "<span>" + dn[(2 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 3, "<span>" + dn[(3 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 4, "<span>" + dn[(4 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 5, "<span>" + dn[(5 + firstDOW) % 7] + "</span>");
    days.setHTML(0, 6, "<span>" + dn[(6 + firstDOW) % 7] + "</span>");

    days.getRowFormatter().getElement(0).setAttribute("role", "row");

    for (int i = 0; i < 7; i++) {
      days.getCellFormatter().getElement(0, i).setAttribute("role", "columnheader");
      days.getCellFormatter().getElement(0, i).setAttribute("aria-label", longdn[i]);
    }

    grid = new Grid(6, 7);
    grid.setStyleName("x-date-inner");
    grid.setCellSpacing(0);
    grid.setCellPadding(0);
    grid.addClickHandler(new ClickHandler() {
View Full Code Here


   */
  public SimpleColorPicker(ComplexColorPicker colopicker) {
    super(colopicker);
    style.ensureInjected();

    final Grid grid = new Grid(ROWS, COLS);
    grid.setCellSpacing(0);
    grid.getRowFormatter().getElement(0).addClassName(style.firstRow());
    grid.getRowFormatter().getElement(1).addClassName(style.firstRow());
    int row;
    int col;
    int num = 0;
    for (final String c : COLORS) {
      row = num / COLS;
      col = num % COLS;
      grid.setWidget(row, col, createCell(c));
      num++;
    }
    grid.addClickHandler(new ClickHandler() {
      public void onClick(final ClickEvent event) {
        Cell cell = grid.getCellForEvent(event);
        if (cell != null) {
          String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()];
          onColorChoose(color);
        }
      }
    });
    grid.addStyleName(style.grid());
    initWidget(grid);
  }
View Full Code Here

                vp.add( h );
            } else {
                final String permType = perm.getKey();
                final List<String> permList = perm.getValue();

                Grid g = new Grid( permList.size() + 1,
                                   3 );
                g.setWidget( 0,
                             0,
                             new HTML( "<b>["
                                       + permType
                                       + "] for:</b>" ) ); // NON-NLS

                for ( int i = 0; i < permList.size(); i++ ) {
                    final String p = permList.get( i );
                    ImageButton del = new ImageButton( images.deleteItemSmall(),
                                                       constants.RemovePermission(),
                                                       new ClickHandler() {
                                                           public void onClick(ClickEvent w) {
                                                               if ( Window.confirm( constants.AreYouSureYouWantToRemovePermission0( p ) ) ) {
                                                                   permList.remove( p );
                                                                   if ( permList.size() == 0 ) {
                                                                       perms.remove( permType );
                                                                   }
                                                                   doPermsPanel( perms,
                                                                                 vp );
                                                               }
                                                           }
                                                       } );

                    g.setWidget( i + 1,
                                 1,
                                 new SmallLabel( p ) );
                    g.setWidget( i + 1,
                                 2,
                                 del );
                }

                vp.add( g );
View Full Code Here

        final FormStylePopup pop = new FormStylePopup();

        VerticalPanel vp = new VerticalPanel();

        Grid g = new Grid( 2,
                           3 );

        txtName.addKeyPressHandler( new NoSpaceKeyPressHandler() );
        txtKey.addKeyPressHandler( new NoSpaceKeyPressHandler() );
        g.setWidget( 0,
                     0,
                     new HTML( "<b>Name</b>" ) );
        g.setWidget( 1,
                     0,
                     txtName );

        g.setWidget( 0,
                     1,
                     new HTML( "<b>Key</b>" ) );
        g.setWidget( 1,
                     1,
                     txtKey );

        g.setWidget( 0,
                     2,
                     new HTML( "<b>Value</b>" ) );
        g.setWidget( 1,
                     2,
                     txtValue );

        setControlValues( annotation );
View Full Code Here

            public void selected(String text) {
                ed.insertText( text );
            }
        };

        Grid layout = new Grid( 1,
                                2 );

        FactTypeBrowser browser = new FactTypeBrowser( SuggestionCompletionCache.getInstance().getEngineFromCache( a.getMetaData().getPackageName() ),
                                                       ce );
        layout.setWidget( 0,
                          0,
                          browser );
        layout.setWidget( 0,
                          1,
                          ed );

        layout.getColumnFormatter().setWidth( 0,
                                              "10%" );
        layout.getColumnFormatter().setWidth( 1,
                                              "90%" );
        layout.getCellFormatter().setAlignment( 0,
                                                0,
                                                HasHorizontalAlignment.ALIGN_LEFT,
                                                HasVerticalAlignment.ALIGN_TOP );
        layout.getCellFormatter().setAlignment( 0,
                                                1,
                                                HasHorizontalAlignment.ALIGN_LEFT,
                                                HasVerticalAlignment.ALIGN_TOP );
        layout.setWidth( "95%" );

        initWidget( layout );

    }
View Full Code Here

    public VerifyFactWidget(final VerifyFact vf,
                            final Scenario sc,
                            final SuggestionCompletionEngine sce,
                            ExecutionTrace executionTrace,
                            boolean showResults) {
        outer = new Grid( 2,
                          1 );
        outer.getCellFormatter().setStyleName( 0,
                                               0,
                                               "modeller-fact-TypeHeader" ); //NON-NLS
        outer.getCellFormatter().setAlignment( 0,
View Full Code Here

       
        if ( data.content == null ) {
            data.content = "Empty!";
        }
        Grid layout = new Grid( 1,
                                2 );
       
       
        SpringContextElementsBrowser browser = new SpringContextElementsBrowser(new SpringContextElementSelectedListener() {

            public void onElementSelected(String elementName, String pasteValue) {
                insertText(pasteValue,true);
            }
        });
       
        layout.setWidget( 0,
                          0,
                          browser );
        text = new TextArea();
        text.setWidth( "100%" );
        text.setVisibleLines( (visibleLines == -1) ? 25 : visibleLines );
        text.setText( data.content );
        text.getElement().setAttribute( "spellcheck",
                                        "false" ); //NON-NLS

        text.setStyleName( "default-text-Area" ); //NON-NLS

        text.addChangeHandler( new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                data.content = text.getText();
                makeDirty();
            }
        } );

        text.addKeyDownHandler( new KeyDownHandler() {

            public void onKeyDown(KeyDownEvent event) {
                if ( event.getNativeKeyCode() == KeyCodes.KEY_TAB ) {
                    event.preventDefault();
                    event.stopPropagation();
                    int pos = text.getCursorPos();
                    insertText( "\t", false );
                    text.setCursorPos( pos + 1 );
                    text.cancelKey();
                    text.setFocus( true );
                }
            }
        } );

        layout.setWidget( 0,
                          1,
                          text );
       
       
        layout.getColumnFormatter().setWidth( 0,
                                              "10%" );
        layout.getColumnFormatter().setWidth( 1,
                                              "90%" );
        layout.getCellFormatter().setAlignment( 0,
                                                0,
                                                HasHorizontalAlignment.ALIGN_LEFT,
                                                HasVerticalAlignment.ALIGN_TOP );
        layout.getCellFormatter().setAlignment( 0,
                                                1,
                                                HasHorizontalAlignment.ALIGN_LEFT,
                                                HasVerticalAlignment.ALIGN_TOP );
        layout.setWidth( "95%" );
       
        initWidget( layout );

    }
View Full Code Here

        data = (RuleContentText) asset.getContent();
        if (data.content == null) {
            data.content = "Empty!";
        }

        Grid layout = new Grid(1, 2);

        WorkitemDefinitionElementsBrowser browser = new WorkitemDefinitionElementsBrowser(
                new WorkitemDefinitionElementSelectedListener() {

                    public void onElementSelected(String elementName,
                            String pasteValue) {
                        insertText(pasteValue, true);
                    }
                });

        layout.setWidget(0, 0, browser);
        text = new TextArea();
        text.setWidth("100%");
        text.setVisibleLines((visibleLines == -1) ? 25 : visibleLines);
        text.setText(data.content);
        text.getElement().setAttribute("spellcheck", "false"); // NON-NLS

        text.setStyleName("default-text-Area"); // NON-NLS

        text.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                data.content = text.getText();
                makeDirty();
            }
        });

        text.addKeyDownHandler(new KeyDownHandler() {

            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
                    event.preventDefault();
                    event.stopPropagation();
                    int pos = text.getCursorPos();
                    insertText("\t", false);
                    text.setCursorPos(pos + 1);
                    text.cancelKey();
                    text.setFocus(true);
                }
            }
        });

        layout.setWidget(0, 1, text);

        layout.getColumnFormatter().setWidth(0, "10%");
        layout.getColumnFormatter().setWidth(1, "90%");
        layout.getCellFormatter().setAlignment(0, 0,
                HasHorizontalAlignment.ALIGN_LEFT,
                HasVerticalAlignment.ALIGN_TOP);
        layout.getCellFormatter().setAlignment(0, 1,
                HasHorizontalAlignment.ALIGN_LEFT,
                HasVerticalAlignment.ALIGN_TOP);
        layout.setWidth("95%");

        initWidget(layout);
    }
View Full Code Here

     
      Iterator errorIterator = errorStatuses.iterator();
      int i = 0;
      HorizontalPanel horizontalErrorPanel = new HorizontalPanel();     
      errorPanel.add(horizontalErrorPanel);
      Grid grid = new Grid(errorStatuses.size(), 2);     
      horizontalErrorPanel.add(grid);
      while (errorIterator.hasNext()) {       
        final String error = (String) errorIterator.next();
        reallyAddFaults.add(error);
        final CheckBox checkBox = new CheckBox();
        checkBox.setChecked(true);
        checkBox.addClickListener(new ClickListener() {
          public void onClick(Widget sender) {
            if (checkBox.isChecked() &&
                !reallyAddFaults.contains(error)) {             
              reallyAddFaults.add(error);
            }          
            else {
              if (reallyAddFaults.contains(error)) {
                reallyAddFaults.remove(error);
              }
            }
          }         
        });
       
        grid.setWidget(i, 0, checkBox);       
        grid.setText(i, 1, error);      
        i++;
      }     
      addErrorsButton.setEnabled(false);
      addErrorsButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
          // TODO         
        }
       
      });
      containerPanel.add(addErrorsButton);
    }
   
    // schema locations
    final Button addSchemaButton = new Button(GuiFactory.strings.addSchema());
    if (!schemaLocations.isEmpty()) {
      final Vector reallyAddSchemaLocations = new Vector();
      containerPanel.add(new HTML("<br />" + GuiFactory.strings.schemaLocations()));
      ScrollPanel schemaLocationContainerPanel = new ScrollPanel();
      schemaLocationContainerPanel.setStyleName("restDescribe-wadlArea");
      schemaLocationContainerPanel.setHeight(panelHeight);
      VerticalPanel schemaLocationPanel = new VerticalPanel();
      schemaLocationContainerPanel.add(schemaLocationPanel);
      containerPanel.add(schemaLocationContainerPanel);
     
      Iterator schemaLocationIterator = schemaLocations.iterator();
      int i = 0;
      HorizontalPanel horizontalSchemaPanel = new HorizontalPanel();
      schemaLocationPanel.add(horizontalSchemaPanel);
      Grid grid = new Grid(schemaLocations.size(), 2);
      horizontalSchemaPanel.add(grid);
      while (schemaLocationIterator.hasNext()) {       
        final String schemaLocation = (String) schemaLocationIterator.next();
        reallyAddSchemaLocations.add(schemaLocation);
        final CheckBox checkBox = new CheckBox();
        checkBox.setChecked(true);
        checkBox.addClickListener(new ClickListener() {
          public void onClick(Widget sender) {
            if (checkBox.isChecked() &&
                !reallyAddSchemaLocations.contains(schemaLocation)) {             
              reallyAddSchemaLocations.add(schemaLocation);
            }          
            else {
              if (reallyAddSchemaLocations.contains(schemaLocation)) {
                reallyAddSchemaLocations.remove(schemaLocation);
              }
            }
          }         
        });
       
        grid.setWidget(i, 0, checkBox);       
        grid.setText(i, 1, schemaLocation);
        i++;
      }           
      addSchemaButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {                   
          Iterator addSchemaIterator = reallyAddSchemaLocations.iterator();
          while (addSchemaIterator.hasNext()) {
            String include = (String) addSchemaIterator.next();
            if (Analyzer.application.getGrammars() == null) {
              Analyzer.application.addGrammars(new GrammarsNode(Analyzer.application));
            }
            Analyzer.application.grammars.addInclude(include);
          }
          WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
          Tree wadlTree = wadlTreeRoot.buildTree(Analyzer.application);
          WadlPanel.wadlArea.clear();
          WadlPanel.wadlArea.setWidget(wadlTree);
        }         
      });
      containerPanel.add(addSchemaButton);
    }

    // default namespace
    final Button addNamespaceButton = new Button(GuiFactory.strings.addNamespace());
    if (!defaultNamespace.isEmpty()) {
      final Vector reallyAddDefaultNamespace = new Vector();
      containerPanel.add(new HTML("<br />" + GuiFactory.strings.defaultNamespaces()));
      ScrollPanel defaultNamespaceContainerPanel = new ScrollPanel();
      defaultNamespaceContainerPanel.setStyleName("restDescribe-wadlArea");
      defaultNamespaceContainerPanel.setHeight(panelHeight);
      VerticalPanel defaultNamespacePanel = new VerticalPanel();
      defaultNamespaceContainerPanel.add(defaultNamespacePanel);
      containerPanel.add(defaultNamespaceContainerPanel);
     
      Iterator defaultNamespaceIterator = defaultNamespace.iterator();
      int i = 0;
      HorizontalPanel horizontalNamespacePanel = new HorizontalPanel();
      defaultNamespacePanel.add(horizontalNamespacePanel);
      Grid grid = new Grid(defaultNamespace.size(), 2);
      horizontalNamespacePanel.add(grid);
      while (defaultNamespaceIterator.hasNext()) {       
        final String defaultNamespace = (String) defaultNamespaceIterator.next();
        reallyAddDefaultNamespace.add(defaultNamespace);
        final CheckBox checkBox = new CheckBox();
        checkBox.setChecked(true);
        checkBox.addClickListener(new ClickListener() {
          public void onClick(Widget sender) {
            if (checkBox.isChecked() &&
                !reallyAddDefaultNamespace.contains(defaultNamespace)) {             
              reallyAddDefaultNamespace.add(defaultNamespace);
            }          
            else {
              if (reallyAddDefaultNamespace.contains(defaultNamespace)) {
                reallyAddDefaultNamespace.remove(defaultNamespace);
              }
            }
          }         
        });
       
        grid.setWidget(i, 0, checkBox);       
        grid.setText(i, 1, defaultNamespace);
        i++;
      }           
      addNamespaceButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
          Iterator addNamespaceIterator = reallyAddDefaultNamespace.iterator();
          while (addNamespaceIterator.hasNext()) {
            String namespace = (String) addNamespaceIterator.next();           
            Analyzer.application.addNamespace(
                new NamespaceAttribute(null, namespace));
          }
          WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
          Tree wadlTree = wadlTreeRoot.buildTree(Analyzer.application);
          WadlPanel.wadlArea.clear();
          WadlPanel.wadlArea.setWidget(wadlTree);
        }         
      });
      containerPanel.add(addNamespaceButton);
    }
    final Button addOtherNamespacesButton = new Button(GuiFactory.strings.addOtherNamespace());
    // other namespaces
    if (!otherNamespaces.isEmpty()) {
      final Vector reallyAddOtherNamespaces = new Vector();
      containerPanel.add(new HTML("<br />" + GuiFactory.strings.otherNamespaces()));
      ScrollPanel otherNamespacesContainerPanel = new ScrollPanel();
      otherNamespacesContainerPanel.setStyleName("restDescribe-wadlArea");     
      otherNamespacesContainerPanel.setHeight(panelHeight);
      VerticalPanel otherNamespacesPanel = new VerticalPanel();
      otherNamespacesContainerPanel.add(otherNamespacesPanel);
      containerPanel.add(otherNamespacesContainerPanel);
     
      Iterator otherNamespacesIterator = otherNamespaces.iterator();
      int i = 0;
      HorizontalPanel horizontalNamespacePanel = new HorizontalPanel();
      otherNamespacesPanel.add(horizontalNamespacePanel);
      Grid grid = new Grid(otherNamespaces.size(), 2);
      horizontalNamespacePanel.add(grid);
      while (otherNamespacesIterator.hasNext()) {       
        final String otherNamespace = (String) otherNamespacesIterator.next();
        reallyAddOtherNamespaces.add(otherNamespace);
        final CheckBox checkBox = new CheckBox();
        checkBox.setChecked(true);
        checkBox.addClickListener(new ClickListener() {
          public void onClick(Widget sender) {
            if (checkBox.isChecked() &&
                !reallyAddOtherNamespaces.contains(otherNamespace)) {             
              reallyAddOtherNamespaces.add(otherNamespace);
            }          
            else {
              if (reallyAddOtherNamespaces.contains(otherNamespace)) {
                reallyAddOtherNamespaces.remove(otherNamespace);
              }
            }
          }         
        });
       
        grid.setWidget(i, 0, checkBox);       
        grid.setText(i, 1, otherNamespace);
        i++;
      }           
      addOtherNamespacesButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
          Iterator addNamespaceIterator = reallyAddOtherNamespaces.iterator();
View Full Code Here

                vp.add( h );
            } else {
                final String permType = perm.getKey();
                final List<String> permList = perm.getValue();

                Grid g = new Grid( permList.size() + 1,
                                   3 );
                g.setWidget( 0,
                             0,
                             new HTML( "<b>["
                                       + permType
                                       + "] for:</b>" ) ); // NON-NLS

                for ( int i = 0; i < permList.size(); i++ ) {
                    final String p = permList.get( i );
                    ImageButton del = new ImageButton( images.deleteItemSmall(),
                                                       constants.RemovePermission(),
                                                       new ClickHandler() {
                                                           public void onClick(ClickEvent w) {
                                                               if ( Window.confirm( constants.AreYouSureYouWantToRemovePermission0( p ) ) ) {
                                                                   permList.remove( p );
                                                                   if ( permList.size() == 0 ) {
                                                                       perms.remove( permType );
                                                                   }
                                                                   doPermsPanel( perms,
                                                                                 vp );
                                                               }
                                                           }
                                                       } );

                    g.setWidget( i + 1,
                                 1,
                                 new SmallLabel( p ) );
                    g.setWidget( i + 1,
                                 2,
                                 del );
                }

                vp.add( g );
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Grid

Copyright © 2018 www.massapicom. 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.