/**
   * Create a Dynamic tree. The code comes from the GWT show case :
   * http://gwt.google.com/samples/Showcase/Showcase.html#!CwTabPanel
   */
  @SuppressWarnings("deprecation")
  private DecoratedTabPanel createTabPanel() {
    // Create a tab panel
    DecoratedTabPanel tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("400px");
    tabPanel.setAnimationEnabled(true);

    // Add a home tab
    String[] tabTitles = {"Home", "GWT Logo", "More info"};
    HTML homeText =
        new HTML("Click one of the tabs to see more content. <br/> You can drag me now !");
    tabPanel.add(homeText, tabTitles[0]);

    // Add a tab with an image
    /*
     * VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new
     * Image(Showcase.images.gwtLogo()));
     */
    // TODO add gwt logo
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(new com.google.gwt.user.client.ui.Image(Image.INSTANCE.gwtLogo()));
    tabPanel.add(new com.google.gwt.user.client.ui.Image(Image.INSTANCE.gwtLogo()), tabTitles[1]);

    // Add a tab
    HTML moreInfo = new HTML("Tabs are highly customizable using CSS.");
    tabPanel.add(moreInfo, tabTitles[2]);

    // Return the content
    tabPanel.selectTab(0);
    tabPanel.ensureDebugId("cwTabPanel");
    return tabPanel;
  }
Ejemplo n.º 2
0
 private void addTabPanel() {
   DecoratedTabPanel tPanel = new DecoratedTabPanel();
   tPanel.setWidth("450px");
   for (int i = 1; i <= 5; i++) {
     Widget tabContent = new TabPanelSampleContent(i);
     String tabLabel = "Panel " + i;
     tPanel.add(tabContent, tabLabel);
   }
   tPanel.selectTab(0);
   tPanel.setAnimationEnabled(true);
   RootPanel.get("tab-panel").add(tPanel);
 }
Ejemplo n.º 3
0
  private void initTabs() {

    // Create a tab panel
    final DecoratedTabPanel tabPanel = new DecoratedTabPanel();
    tabPanel.setAnimationEnabled(true);

    for (final ContactModel contactModel : contactList) {

      final FlexTable o_layout = new FlexTable();
      o_layout.setCellSpacing(6);
      FlexCellFormatter o_cellFormatter = o_layout.getFlexCellFormatter();
      o_cellFormatter.setColSpan(0, 0, 2);

      tabPanel.add(o_layout, contactModel.getNikeName());

      final ListBox dropBox = new ListBox(false);

      for (AlbumModel album : contactModel.getAlbumList()) {
        dropBox.addItem(album.getName());
      }

      o_layout.setWidget(0, 0, dropBox);

      dropBox.addChangeHandler(
          new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
              initPhotoLayout(contactModel, dropBox.getSelectedIndex(), o_layout);
            }
          });

      tabPanel.addSelectionHandler(
          new SelectionHandler<Integer>() {
            @Override
            public void onSelection(SelectionEvent<Integer> event) {
              FlexTable currentPhotoTable = (FlexTable) tabPanel.getWidget(event.getSelectedItem());
              ListBox currentDropBox = (ListBox) currentPhotoTable.getWidget(0, 0);
              currentDropBox.setSelectedIndex(0);
            }
          });
      initPhotoLayout(contactModel, 0, o_layout);
    }

    tabPanel.selectTab(0);

    RootPanel.get("kirin_tabs").add(tabPanel);
  }
Ejemplo n.º 4
0
  public void onModuleLoad() {
    RootPanel RootTXOriginal = RootPanel.get("Original");
    RootPanel RootMenu = RootPanel.get("Menu");
    RootTXOriginal.setSize("100%", "100%");
    RootMenu.setStyleName("Root");
    RootTXOriginal.setStyleName("Root");

    MenuBar menuBar = new MenuBar(false);
    RootMenu.add(menuBar);
    menuBar.setWidth("100%");

    mntmNewItem = new MenuItem("New item", false, (Command) null);
    mntmNewItem.setEnabled(false);
    mntmNewItem.setHTML("Language Editor : " + LenguajeActual.getName());
    menuBar.addItem(mntmNewItem);

    MenuItemSeparator separator = new MenuItemSeparator();
    menuBar.addSeparator(separator);

    MenuItem mntmNewItem_2 =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
                Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
                {
                  ((PanelDecorador) WidgetActual).saveAll();
                }
              }
            });
    mntmNewItem_2.setHTML("Save");
    menuBar.addItem(mntmNewItem_2);

    MenuItemSeparator separator_1 = new MenuItemSeparator();
    menuBar.addSeparator(separator_1);

    MenuItem mntmNewItem_1 =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
                //	Window.alert(Integer.toString(actual_widget2));
                //	int actual_widget=event.getItem();
                // Window.alert(Integer.toString(actual_widget));
                Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
                if (!((PanelDecorador) WidgetActual).isSaved())
                  if (Window.confirm(
                      "The tab is modificated and not saved, Do you want to save the modification")) {
                    ((PanelDecorador) WidgetActual).saveAll();
                  }
                Controlador.change2AdminLenguaje();
              }
            });
    mntmNewItem_1.setHTML("Back");
    menuBar.addItem(mntmNewItem_1);

    decoratedTabPanel = new DecoratedTabPanel();

    RootTXOriginal.add(decoratedTabPanel);
    decoratedTabPanel.setSize("100%", "100%");

    String tamano = "875px";

    // Esta encima porque sino salta error al setear la tab del decorador.
    MainWindowEditor MWE = new MainWindowEditor(LenguajeActual);
    decoratedTabPanel.add(MWE, "Main Window", true);
    MWE.setWidth(tamano);

    // Debajo de la declaracion sino da IndexOutOfBounds
    decoratedTabPanel.selectTab(0);

    // Ollente para pasar de pestaña
    decoratedTabPanel.addBeforeSelectionHandler(
        new BeforeSelectionHandler<Integer>() {
          public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
            //	Window.alert(Integer.toString(actual_widget2));
            //	int actual_widget=event.getItem();
            //	Window.alert(Integer.toString(actual_widget));
            Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
            if (!((PanelDecorador) WidgetActual).isSaved())
              if (Window.confirm(
                  "The tab is modificated and not saved, Do you want to save the modification"))
                ((PanelDecorador) WidgetActual).saveAll();
          }
        });

    SpecificationsEditor Specifications = new SpecificationsEditor(LenguajeActual);
    decoratedTabPanel.add(Specifications, "Specifications", true);
    Specifications.setWidth(tamano);

    FilterEditor Filter = new FilterEditor(LenguajeActual);
    decoratedTabPanel.add(Filter, "Filter", true);
    Filter.setWidth(tamano);

    AnnotationEditor Anotation = new AnnotationEditor(LenguajeActual);
    decoratedTabPanel.add(Anotation, "Annotation", true);
    Anotation.setWidth(tamano);

    BrowserEditor Browser = new BrowserEditor(LenguajeActual);
    decoratedTabPanel.add(Browser, "Browser", true);
    Browser.setWidth(tamano);

    VariosEditor varios = new VariosEditor(LenguajeActual);
    decoratedTabPanel.add(varios, "Others", true);
    varios.setWidth(tamano);
  }
Ejemplo n.º 5
0
  public void onModuleLoad() {
    Logger logger = Logger.getLogger("");
    //   logger.log(Level.FINE, "Arrancando aplicación");
    logger.log(Level.INFO, "Arrancando aplicación2");

    // Create app layout

    // Create ClientFactory using deferred binding so we can replace with
    // different
    // impls in gwt.xml
    clientFactory = GWT.create(ClientFactory.class);

    clientFactory.getLogger().log(Level.INFO, "holaaaaa");

    // clientFactory.setMainView(this);

    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();
    clientFactory.getRequestFactory().initialize(eventBus);

    // Initialize RequestFactory
    // clientFactory.initializeRequestFactory();
    System.out.println("contruyendo mappers");
    // Start ActivityManager for each area with its ActivityMapper
    ActivityMapper alumnoMapper = new AlumnoMapper(clientFactory);
    ActivityMapper observacionesAlumnoMapper = new ObservacionesAlumnoMapper(clientFactory);
    ActivityMapper matriculaMapper = new MatriculaMapper(clientFactory);
    ActivityMapper materialMapper = new MaterialMapper(clientFactory);
    /*	ActivityMapper mainPanelActivityMapper = new MainPanelActivityMapper(
    				clientFactory);
    		ActivityMapper formularioAlumnoPanelActivityMapper = new FormularioAlumnoPanelActivityMapper(
    				clientFactory);
    		ActivityMapper alumnoPanelActivityMapper = new AlumnoPanelActivityMapper(
    				clientFactory);
    		ActivityMapper observacionesPanelActivityMapper = new ObservacionesPanelActivityMapper(
    				clientFactory);
    		ActivityMapper matriculaPanelActivityMapper = new MatriculaPanelActivityMapper(
    				clientFactory);

    		ActivityManager mainPanelActivityManager = new ActivityManager(
    				mainPanelActivityMapper, eventBus);

    		mainPanelActivityManager.setDisplay(appWidget);

    		ActivityManager alumnoPanelActivityManager = new ActivityManager(
    				alumnoPanelActivityMapper, eventBus);
    		alumnoPanelActivityManager.setDisplay(alumnoPanel);

    		ActivityManager formularioAlumnoPanelActivityManager = new ActivityManager(
    				formularioAlumnoPanelActivityMapper, eventBus);
    		formularioAlumnoPanelActivityManager.setDisplay(alumnoPanel);

    		ActivityManager panelObservacionesActivityManager = new ActivityManager(
    				observacionesPanelActivityMapper, eventBus);
    		panelObservacionesActivityManager.setDisplay(observacionesalumnoPanel);

    		ActivityManager panelMatriculaActivityManager = new ActivityManager(
    				matriculaPanelActivityMapper, eventBus);
    		panelMatriculaActivityManager.setDisplay(matriculaPanel);
    */
    tabAlumno.selectTab(1);
    ActivityManager alumnoManager = new ActivityManager(alumnoMapper, eventBus);
    alumnoManager.setDisplay(alumnoPanel);

    ActivityManager observacionesAlumnoManager =
        new ActivityManager(observacionesAlumnoMapper, eventBus);
    observacionesAlumnoManager.setDisplay(observacionesalumnoPanel);

    ActivityManager matriculaManager = new ActivityManager(matriculaMapper, eventBus);
    matriculaManager.setDisplay(matriculaPanel);

    ActivityManager materialManager = new ActivityManager(materialMapper, eventBus);
    materialManager.setDisplay(materialPanel);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    // Add app layout to root layout
    RootLayoutPanel.get().add(outer);

    //	historyHandler.handleCurrentHistory();
    /*eventBus.addHandler(SeleccionAlumnoEvent.TYPE,
    new SeleccionAlumnoEventHandler() {
    	@Override
    	public void onSelecc(
    			SeleccionAlumnoEvent authenticationEvent) {
    		// authentication changed - do something
    		System.out.println("tocado"
    				+ clientFactory.getSelectedAlumnoNif());
    		if (clientFactory.getSelectedAlumnoNif() == null)
    			tabDatosAlumno.setVisible(false);
    		else
    			tabDatosAlumno.setVisible(true);
    	}
    });*/

    PopupPanel loggingPopup = new PopupPanel(false);
    loggingPopup.setPopupPosition(10, 240);
    loggingPopup.setWidth("500px");
    clientFactory.getLogger().addHandler(new HasWidgetsLogHandler(loggingPopup));
  }
 @Override
 public void setSelection(int tabIndex) {
   itemDetailTabPanel.selectTab(tabIndex);
 }