protected void SaveChages() {
   Language LanguageActual = ActualState.getActualLanguage();
   String SeleccionCatalogoPopupPanelLanguageConfiguration = toFile();
   LanguageActual.setSeleccionCatalogoPopupPanelLanguageConfiguration(
       SeleccionCatalogoPopupPanelLanguageConfiguration);
   ActualState.saveLanguageActual(LanguageActual);
 }
Ejemplo n.º 2
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.º 3
0
  public FilterBasicPopUp() {
    super(true);
    setAnimationEnabled(true);
    AllBoolean = false;
    filtro = new ArrayList<TypeClient>();
    VerticalPanel verticalPanel = new VerticalPanel();
    setWidget(verticalPanel);
    verticalPanel.setSize("100%", "100%");

    SimplePanel simplePanel = new SimplePanel();
    verticalPanel.add(simplePanel);
    simplePanel.setSize("100%", "100%");

    if (textBox == null) textBox = new TextBox();
    textBox.setVisibleLength(100);
    simplePanel.setWidget(textBox);
    textBox.setSize("98%", "100%");
    Lang = ActualState.getLanguage();

    horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);

    Button btnNewButton = new Button(Lang.getFilterButton());
    horizontalPanel.add(btnNewButton);
    horizontalPanel.setCellHorizontalAlignment(btnNewButton, HasHorizontalAlignment.ALIGN_CENTER);

    All = new Button(Lang.getSelect_All());
    All.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            AllBoolean = !AllBoolean;
            if (AllBoolean) {
              textBox.setEnabled(false);
              textBox.setReadOnly(true);
              textBox.setText(Lang.getAllSelected());

            } else {
              textBox.setEnabled(true);
              textBox.setReadOnly(false);
              textBox.setText("");
            }
          }
        });
    horizontalPanel.add(All);
    All.setSize("100%", "100%");
    All.setStyleName("gwt-ButtonCenter");
    All.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });
    All.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });
    All.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });

    Advance = new Button(Lang.getAdvance());
    Advance.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Controlador.change2FilterAdvance();
          }
        });
    Advance.setSize("100%", "100%");
    Advance.setStyleName("gwt-ButtonCenter");
    Advance.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });
    Advance.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });
    Advance.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });
    horizontalPanel.add(Advance);

    btnNewButton.setSize("100%", "100%");
    btnNewButton.setStyleName("gwt-ButtonCenter");
    btnNewButton.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });
    btnNewButton.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });
    btnNewButton.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });
    btnNewButton.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            filtro = new ArrayList<TypeClient>();
            if (!AllBoolean) {
              String Token = textBox.getText();
              String[] Words = Token.split(",");
              if (Words.length > 0) {
                Types = MakeWords(Words);
                filtro = FindTypes(Types, ActualState.getReadingActivityCloseCatalog());
                ArrayList<UserClient> Usuarios =
                    FindUsers(Types, ActualState.getReadingactivity().getGroup());
                MainEntryPoint.setFiltro(filtro, Usuarios, Types, new ArrayList<Long>());
                Me.hide();
              }
            } else {
              MainEntryPoint.CleanFilter();
              Me.hide();
            }
          }

          private ArrayList<UserClient> FindUsers(ArrayList<String> types, GroupClient group) {
            ArrayList<UserClient> salida = new ArrayList<UserClient>();
            for (UserClient studentUnit : group.getParticipatingUsers()) {
              testUserIn(studentUnit, types, salida);
            }
            testUserIn(group.getProfessor(), types, salida);
            return salida;
          }

          private void testUserIn(
              UserClient studentUnit, ArrayList<String> types, ArrayList<UserClient> salida) {
            for (String typocandidato : types) {
              if (studentUnit.getFirstName().toUpperCase().contains(typocandidato.toUpperCase()))
                AddSalida(studentUnit, salida);
              if (studentUnit.getLastName().toUpperCase().contains(typocandidato.toUpperCase()))
                AddSalida(studentUnit, salida);
              if (studentUnit
                  .getId()
                  .toString()
                  .toUpperCase()
                  .contains(typocandidato.toUpperCase())) AddSalida(studentUnit, salida);
              if (studentUnit.getEmail().toUpperCase().contains(typocandidato.toUpperCase()))
                AddSalida(studentUnit, salida);
            }
          }

          private void AddSalida(UserClient studentUnit, ArrayList<UserClient> salida) {
            if (!salida.contains(studentUnit)) salida.add(studentUnit);
          }

          private ArrayList<TypeClient> FindTypes(
              ArrayList<String> types, CatalogoClient catalogo) {
            ArrayList<TypeClient> Salida = new ArrayList<TypeClient>();
            for (EntryClient entryUni : catalogo.getEntries()) {
              EvaluaEntry(entryUni, types, Salida);
            }
            return Salida;
          }

          private void EvaluaEntry(
              EntryClient entryUni, ArrayList<String> types, ArrayList<TypeClient> salida) {
            if (entryUni instanceof TypeClient) EvaluaType((TypeClient) entryUni, types, salida);
            else if (entryUni instanceof TypeCategoryClient)
              EvaluaTypeCategory((TypeCategoryClient) entryUni, types, salida);
          }

          private void EvaluaTypeCategory(
              TypeCategoryClient entryUni, ArrayList<String> types, ArrayList<TypeClient> salida) {
            if (existeEn(entryUni, types)) AddHijos(entryUni, salida);
          }

          private void AddHijos(TypeCategoryClient entryUni, ArrayList<TypeClient> salida) {
            for (EntryClient candidato : entryUni.getChildren()) {
              if (candidato instanceof TypeClient) AddASalida((TypeClient) candidato, salida);
              else if (candidato instanceof TypeCategoryClient)
                AddHijos((TypeCategoryClient) candidato, salida);
            }
          }

          private void EvaluaType(
              TypeClient entryUni, ArrayList<String> types, ArrayList<TypeClient> salida) {
            if (existeEn(entryUni, types)) AddASalida(entryUni, salida);
          }

          private void AddASalida(TypeClient entryUni, ArrayList<TypeClient> salida) {
            if (!salida.contains(entryUni)) salida.add(entryUni);
          }

          private boolean existeEn(EntryClient entryUni, ArrayList<String> types) {
            for (String candidato : types) {
              if (candidato.toUpperCase().contains(entryUni.getName().toUpperCase())) return true;
            }
            return false;
          }

          private ArrayList<String> MakeWords(String[] words) {
            ArrayList<String> Salida = new ArrayList<String>();
            for (String SS : words) {
              if (!SS.isEmpty()) Salida.add(SS);
            }
            return Salida;
          }
        });
  }