Example #1
0
  public LibraryData(HorizontalPanel lp, DrakeGeneticsServiceAsync drakeGeneticsService) {
    this.libraryPanel = lp;

    final DrakeGeneticsServiceAsync dgs = drakeGeneticsService;
    drakeGeneticsService.getLibrary(
        new AsyncCallback<LibraryNode>() {
          public void onSuccess(LibraryNode results) {
            getTreeModelSucceeded(results, dgs);
          }

          public void onFailure(Throwable caught) {
            getTreeModelFailed(caught);
          }
        });

    treePanel.setHeaderVisible(true);
    treePanel.setLayout(new FitLayout());
    treePanel.setHeading("Publications");

    tree.setDisplayProperty("name");
    tree.setWidth(200);
    // tree.setHeight(450);
    tree.setHeight(670);
    tree.addListener(
        Events.OnClick,
        new Listener<TreePanelEvent<ModelData>>() {

          public void handleEvent(TreePanelEvent<ModelData> be) {
            ModelData item = be.getItem();
            String url = (String) item.get("url");
            if (url != null && !url.equals("")) {
              if (url.startsWith("/")) {
                url = url.substring(1);
              }
              libraryDocumentPanel.setUrl(GWT.getHostPageBaseURL() + url);
            }
          }
        });

    treePanel.add(tree);

    libraryPanel.add(treePanel);

    libraryDocumentPanel.setHeaderVisible(false);
    libraryDocumentPanel.setWidth(494);
    // libraryDocumentPanel.setHeight(451);
    libraryDocumentPanel.setHeight(671);
    libraryDocumentPanel.setUrl(GWT.getHostPageBaseURL() + "Library/index.html");
    libraryPanel.add(libraryDocumentPanel);
  }
Example #2
0
  private void onInit() {
    viewportPanel.setHeaderVisible(false);
    viewportPanel.setLayout(new BorderLayout());

    viewport.setLayout(new FitLayout());
    viewport.add(viewportPanel);
  }
Example #3
0
  @Override
  public void initialize() {

    mainPanel = Panels.content("");
    mainPanel.setHeaderVisible(false);

    Label label = new Label(I18N.CONSTANTS.projectCoreSelectVersion());

    mainPanel.add(label);

    amendmentsComboBox1 = new ComboBox<AmendmentDTO>();
    amendmentsComboBox1.setStore(new ListStore<AmendmentDTO>());
    amendmentsComboBox1.setDisplayField("name");
    amendmentsComboBox1.setTriggerAction(ComboBox.TriggerAction.ALL);

    amendmentsComboBox2 = new ComboBox<AmendmentDTO>();
    amendmentsComboBox2.setStore(new ListStore<AmendmentDTO>());
    amendmentsComboBox2.setDisplayField("name");
    amendmentsComboBox2.setTriggerAction(ComboBox.TriggerAction.ALL);

    final LayoutContainer container = Layouts.hBox(HBoxLayoutAlign.TOP);

    container.add(amendmentsComboBox1, Layouts.hBoxData(Margin.LEFT));
    container.add(amendmentsComboBox2, Layouts.hBoxData(Margin.LEFT));

    projectFields = buildGrid();

    mainPanel.setScrollMode(Scroll.AUTO);
    mainPanel.add(container);
    mainPanel.add(projectFields);

    initPopup(mainPanel);
  }
  public TeachersUI() {
    setScrollMode(Scroll.AUTO);
    setId("centerPanelBackground");
    addStyleName("uiContainer");
    setHeaderVisible(false);

    image = Resources.ICONS.image();
    add(image.createImage());

    String text = "<br><center><font color='orange' size='5px'>Teachers</font></center>";
    text += "<h2>Teachers directions here </h2> ";
    label = new Label();
    label.setText(text);
    add(label);

    videoPanel = new ContentPanel();
    videoPanel.setId("jwplayer");
    videoPanel.setHeaderVisible(false);
    videoPanel.setBodyBorder(false);
    add(videoPanel);

    Timer timer =
        new Timer() {

          @Override
          public void run() {
            loadVideoPlayer();
          }
        };

    timer.schedule(50);
  }
Example #5
0
  public ServerEditor() {
    // create content:
    content = new ContentPanel();
    content.setBodyBorder(false);
    content.setHeaderVisible(false);
    content.setScrollMode(Scroll.AUTO);
    //		content.setHeading("Properties");
    content.setButtonAlign(HorizontalAlignment.RIGHT);

    // da toolbar
    ToolBar toolbar = new ToolBar();
    TextToolItem save = new TextToolItem("Save", "icon-save");
    toolbar.add(save);
    toolbar.add(new SeparatorToolItem());
    content.setTopComponent(toolbar);

    tabFolder = new TabPanel();
    tabFolder.setTabScroll(true);

    addTabs(tabFolder);

    RowLayout layout = new RowLayout(Orientation.VERTICAL);
    content.setLayout(layout);
    content.add(tabFolder, new RowData(1, 1));
  }
Example #6
0
  public SearchFormPanel() {

    ListStore<BeanModel> comboStore = new ListStore<BeanModel>();
    combo = new ComboBox<BeanModel>();
    combo.setStore(comboStore);
    combo.setFieldLabel("Asset type");
    combo.setDisplayField("name");
    combo.setTypeAhead(true);
    combo.setForceSelection(true);
    combo.setTriggerAction(ComboBox.TriggerAction.ALL);
    // combo.setWidth(150);
    combo.addSelectionChangedListener(
        new SelectionChangedListener<BeanModel>() {
          public void selectionChanged(SelectionChangedEvent<BeanModel> se) {
            prepareForm((MetaAsset) combo.getValue().getBean());
          }
        });

    Button btnSearch = new Button("Search");
    btnSearch.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent be) {
            submitSearch();
          }
        });

    form = new FormPanel();
    form.setHeaderVisible(false);
    form.setBodyBorder(false);
    form.setScrollMode(Style.Scroll.AUTOY);
    // form.setWidth(300);

    HBoxLayout layout = new HBoxLayout();
    layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
    ContentPanel topPanel = new ContentPanel(layout);
    topPanel.setHeaderVisible(false);
    topPanel.setFrame(true);
    topPanel.setHeight(40);
    topPanel.add(new Text("Asset type: "));
    HBoxLayoutData layoutData = new HBoxLayoutData(0, 2, 0, 2);
    topPanel.add(combo, layoutData);
    topPanel.add(btnSearch);

    setHeading("Advanced search");
    setLayout(new FitLayout());
    setFrame(true);
    setTopComponent(topPanel);
    add(form);

    /*
    addListener(Events.Expand, new Listener<BaseEvent>() {
    	public void handleEvent(BaseEvent be) {
    		initComponents(false);
    	}
    });*/
    initComponents(false);
  }
Example #7
0
  /** Creates the south. */
  private void createSouth() {
    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.SOUTH, Constants.SOUTH_PANEL_DIMENSION + 25);
    // data.setMargins(new Margins(5, 5, 5, 5));
    // data.setHideCollapseTool(false);
    data.setMargins(new Margins(5, 0, 0, 0));
    data.setCollapsible(true);
    data.setSplit(false);

    /*
     * south = new ContentPanel(); south.setBodyBorder(false); south.setAnimCollapse(true);
     * south.setCollapsible(true); south.setLayout(new FitLayout());
     * south.setLayoutOnChange(true); south.setScrollMode(Scroll.AUTOY);
     * south.setHeaderVisible(true);
     * south.setHeading(I18nProvider.getMessages().accordionLabel());
     * south.setMonitorWindowResize(true); south.setLayoutOnChange(true); south.layout();
     */
    south = new ContentPanel();
    south.setBodyBorder(false);
    south.setLayout(new FitLayout());
    south.setScrollMode(Scroll.AUTOY);
    south.setHeaderVisible(true);
    // south.setHeading(I18nProvider.getMessages().accordionLabel());
    south.setMonitorWindowResize(true);
    south.setLayoutOnChange(true);
    south.layout();

    south.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    south.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    this.tabWidget = new TabWidget();

    south.add(this.tabWidget);

    Dispatcher.forwardEvent(GeofenceEvents.ATTACH_BOTTOM_TAB_WIDGETS, this.tabWidget);

    center.add(south, data);
  }
  private SageAlertViewport() {

    westPanel = new ContentPanel();
    westPanel.setScrollMode(Scroll.AUTOY);
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 280);
    westPanel.add(new MenuTreePanel(new MenuDataStore()));
    westPanel.setHeaderVisible(false);
    westPanel.setBottomComponent(new SageAlertToolBar());

    centerPanel = new ContentPanel();
    centerPanel.setLayout(new FitLayout());
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerPanel.setHeaderVisible(false);

    mainWindow = new Window();
    mainWindow.setDraggable(false);
    mainWindow.setHeading("SageAlert v" + Version.getFullVersion());
    mainWindow.setClosable(false);
    mainWindow.setResizable(false);
    mainWindow.setSize(600, 450);
    mainWindow.setLayout(new BorderLayout());
    mainWindow.add(westPanel, westData);
    mainWindow.add(centerPanel, centerData);
    add(mainWindow);
    SettingsServiceAsync rpc = GWT.create(SettingsService.class);
    rpc.isLicensed(
        new AsyncCallback<Boolean>() {

          public void onFailure(Throwable caught) {
            GWT.log("ERROR", caught);
          }

          public void onSuccess(Boolean result) {
            String newHeading = mainWindow.getHeading();
            if (!result) newHeading = newHeading.concat(" (Unlicensed)");
            else newHeading = newHeading.concat(" (Licensed)");
            mainWindow.setHeading(newHeading);
          }
        });
  }
  private void createGestureTypeList() {
    ContentPanel gestureTypesContainer = new ContentPanel();
    gestureTypesContainer.setHeaderVisible(false);
    gestureTypesContainer.setLayout(new FitLayout());
    // overflow-auto style is for IE hack.
    gestureTypesContainer.addStyleName("overflow-auto");
    gestureTypesContainer.setBorders(false);
    gestureTypesContainer.setBodyBorder(false);

    ListStore<BeanModel> gestureStore = new ListStore<BeanModel>();
    GestureType[] gestureTypes = GestureType.values();
    existsGestureTypeModels = new ArrayList<BeanModel>();

    for (int i = 0; i < gestureTypes.length; i++) {
      Gesture gesture = new Gesture(gestureTypes[i]);
      gesture.setOid(IDUtil.nextID());
      gestureMaps.put(gestureTypes[i].toString(), gesture);
      BeanModel gestureBeanModel = gesture.getBeanModel();
      gestureStore.add(gestureBeanModel);
      for (Gesture existGesture : gestures) {
        if (gestureTypes[i].equals(existGesture.getType())) {
          gestureMaps.put(existGesture.getType().toString(), existGesture);
          existsGestureTypeModels.add(gestureBeanModel);
        }
      }
    }

    gestureTypeListView =
        new CheckBoxListViewExt<BeanModel>() {
          @Override
          protected void afterRender() {
            super.afterRender();
            for (BeanModel checkedModel : existsGestureTypeModels) {
              this.setChecked(checkedModel, true);
            }
          }
        };
    gestureTypeListView.setStore(gestureStore);
    gestureTypeListView.setDisplayProperty("type");
    gestureTypeListView.setStyleAttribute("overflow", "auto");
    gestureTypesContainer.add(gestureTypeListView);

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setMargins(new Margins(0, 5, 0, 0));
    add(gestureTypesContainer, westData);
  }
Example #10
0
  private ContentPanel createScreenPairList(GroupRef groupRef) {
    TouchPanelDefinition touchPanel = groupRef.getPanel().getTouchPanelDefinition();

    ContentPanel screenContainer = new ContentPanel();
    screenContainer.setHeaderVisible(false);
    screenContainer.setWidth(260);
    screenContainer.setHeight(150);
    screenContainer.setLayout(new FitLayout());
    // overflow-auto style is for IE hack.
    screenContainer.addStyleName("overflow-auto");

    screenPairListView = new CheckBoxListView<BeanModel>();
    ListStore<BeanModel> store = new ListStore<BeanModel>();

    List<BeanModel> otherModels = new ArrayList<BeanModel>();
    List<BeanModel> screenPairModels = BeanModelDataBase.screenTable.loadAll();
    List<BeanModel> selectedModels = new ArrayList<BeanModel>();
    for (ScreenPairRef screenRef : groupRef.getGroup().getScreenRefs()) {
      selectedModels.add(screenRef.getScreen().getBeanModel());
    }
    for (BeanModel screenPairModel : screenPairModels) {
      if (((ScreenPair) screenPairModel.getBean()).getTouchPanelDefinition().equals(touchPanel)) {
        store.add(screenPairModel);
        screenPairListView.getSelectionModel().select(screenPairModel, true);
      } else if (((ScreenPair) screenPairModel.getBean())
          .getTouchPanelDefinition()
          .getCanvas()
          .equals(touchPanel.getCanvas())) {
        otherModels.add(screenPairModel);
      }
    }

    store.add(otherModels);
    for (BeanModel selectedModel : selectedModels) {
      screenPairListView.setChecked(selectedModel, true);
    }
    screenPairListView.setStore(store);
    screenPairListView.setDisplayProperty("panelName");
    screenPairListView.setStyleAttribute("overflow", "auto");
    screenPairListView.setSelectStyle("screen-view-item-sel");
    screenContainer.add(screenPairListView);
    return screenContainer;
  }
Example #11
0
  private FieldSet setupIdentifierfieldSet(int widthPanel, int tabIndex) {
    FieldSet identifierfieldSet = new FieldSet();
    identifierfieldSet.setHeading("Identifiers");
    identifierfieldSet.setCollapsible(true);
    identifierfieldSet.setBorders(false);
    FormLayout identifierlayout = new FormLayout();
    identifierlayout.setLabelWidth(150);
    identifierlayout.setDefaultWidth(390); // It is the real function to set the textField width
    identifierfieldSet.setLayout(identifierlayout);

    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.setWidth(widthPanel);
    cp.add(setupIdentifierGrid(identifierStore, widthPanel - 33, tabIndex));

    identifierfieldSet.add(cp);

    return identifierfieldSet;
  }
Example #12
0
  private void createMainPanel() {
    mainGridPanel =
        new ContentPanel() {
          @Override
          protected void onResize(int width, int height) {
            super.onResize(width, height);
            mainGridPanel.layout(true);
            mainDataGrid.repaint();
            mainDataGrid.getView().refresh(false);
          }
        };

    mainBorderLayout = new BorderLayout();
    mainGridPanel.setLayout(mainBorderLayout);
    mainGridPanel.setHeaderVisible(false);

    browseFilterPanel = (BrowseFilterPanel) Registry.get("browseFilterPanel");

    createViewDSInfoPanel();
  }
Example #13
0
  /** Creates the north. */
  private void createNorth() {
    north = new ContentPanel();
    north.setHeaderVisible(false);
    north.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });

    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.NORTH, Constants.NORTH_PANEL_DIMENSION);
    data.setMargins(new Margins(0, 5, 0, 5));
    data.setSplit(true);

    viewport.add(north, data);
  }
Example #14
0
  private ContentPanel getLateLoanReportSection() {
    if (lateLoanReportSectionPanel == null) {
      lateLoanReportSectionPanel = new ContentPanel();
      lateLoanReportSectionPanel.setHeaderVisible(false);
      lateLoanReportSectionPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      lateLoanReportSectionPanel.setBorders(false);
      Html reportTitle = new Html(messages.lateLoans());
      reportTitle.addStyleName("pige-management-section-title");
      lateLoanReportSectionPanel.add(reportTitle, new RowData(1, 25, new Margins(3)));
      Html text = new Html(messages.lateLoansReportDescription());
      lateLoanReportSectionPanel.add(text, new RowData(1, -1, new Margins(5)));

      Set<ReportFormats> formats = new HashSet();
      formats.add(ReportFormats.PDF);
      formats.add(ReportFormats.HTML);
      ReportDownloadPanel rdp =
          new ReportDownloadPanel(PIGE.REPORT_SERVICE, ReportId.LateLoans, formats);
      lateLoanReportSectionPanel.add(rdp);
    }
    return lateLoanReportSectionPanel;
  }
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());

    ContentPanel content = new ContentPanel();
    content.setHeaderVisible(false);
    content.setBodyBorder(false);
    content.setLayout(new FitLayout());

    grid = createGrid();
    content.add(grid);

    // 添加工具栏
    ToolBar toolBar = new ToolBar();
    Button printButton = new Button("打印", Resources.ICONS.printer());
    toolBar.add(printButton);

    content.setTopComponent(toolBar);
    add(content);
  }
Example #16
0
  public void onModuleLoad() {
    instance = this;
    GWT.setUncaughtExceptionHandler(
        new GWT.UncaughtExceptionHandler() {
          public void onUncaughtException(Throwable throwable) {
            GWT.log("Uncaught exception", throwable);
            if (!GWT.isScript()) {
              String text = "Uncaught exception: ";
              while (throwable != null) {
                StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                text += throwable.toString() + "\n";
                for (int i = 0; i < stackTraceElements.length; i++) {
                  text += "    at " + stackTraceElements[i] + "\n";
                }
                throwable = throwable.getCause();
                if (throwable != null) {
                  text += "Caused by: ";
                }
              }
              DialogBox dialogBox = new DialogBox(true);
              DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF");
              System.err.print(text);
              text = text.replaceAll(" ", "&nbsp;");
              dialogBox.setHTML("<pre>" + text + "</pre>");
              dialogBox.center();
            }
          }
        });
    AppBundle.INSTANCE.css().ensureInjected();

    // Create graphical context
    OMSVGDocument doc = OMSVGParser.currentDocument();
    SVGElement element = doc.createSVGPathElement().getElement().cast();
    element
        .getStyle()
        .setProperty(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_LIGHTBLUE_VALUE);
    element.getStyle().setProperty(SVGConstants.CSS_STROKE_PROPERTY, SVGConstants.CSS_BLACK_VALUE);
    SVGNamedElementModel.createTitleDesc(element, AppConstants.INSTANCE.graphicalContext());
    cssContext = new CssContextModel(element);

    svgWindows = new ArrayList<SVGWindow>();
    viewport = new ViewportExt();

    viewport.setLayout(new BorderLayout());
    viewport.add(createMenuBar(), new BorderLayoutData(LayoutRegion.NORTH, getWindowBarHeight()));
    viewport.setStyleAttribute("background-color", SVGConstants.CSS_BEIGE_VALUE);

    commandToolBar =
        new CommandFactoryToolBar(
            CommandFactories.getAllFactoriesStore(), getCommandFactorySelector());
    ContentPanel commandPanel = new ContentPanel();
    commandPanel.setHeaderVisible(false);
    commandPanel.setBottomComponent(commandToolBar);
    viewport.add(commandPanel, new BorderLayoutData(LayoutRegion.SOUTH, getWindowBarHeight()));

    new InternalLoadRequest(AppBundle.INSTANCE.fish(), "fish.svg").load();
    new InternalLoadRequest(AppBundle.INSTANCE.fries(), "fries.svg").load();
    new InternalLoadRequest(AppBundle.INSTANCE.sample(), "sample.svg").load();

    update();

    fileUpload = new FileUploadExt();
    Style style = fileUpload.getElement().getStyle();
    style.setVisibility(Visibility.HIDDEN);
    style.setWidth(0, Unit.PX);
    style.setHeight(0, Unit.PX);
    fileUpload.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            processFiles(fileUpload.getFiles());
          }
        });

    RootPanel.get().add(viewport);
    RootPanel.get().add(fileUpload);
  }
Example #17
0
  private ContentPanel getGeneralSection() {
    if (generalSectionPanel == null) {

      final ManagementServiceAsync managementService = Registry.get(PIGE.MANAGEMENT_SERVICE);
      generalSectionPanel = new ContentPanel();
      generalSectionPanel.setHeaderVisible(false);
      generalSectionPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      generalSectionPanel.setBorders(false);

      ToolBar buttonBar = new ToolBar();
      generalSectionPanel.setTopComponent(buttonBar);
      Button updateConfigsBtn = new Button(messages.update());
      updateConfigsBtn.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.saveIcon()));
      buttonBar.add(updateConfigsBtn);
      updateConfigsBtn.addSelectionListener(
          new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent event) {
              ServerConfigs sc = new ServerConfigs();
              sc.setValue(
                  ServerConfigs.ATT_MAINTENANCE_MODE_ACTIVATED,
                  maintenanceModeActivated.toString());
              sc.setValue(ServerConfigs.ATT_MAINTENANCE_MODE_INFO, mmInfoArea.getValue());
              sc.setValue(ServerConfigs.ATT_EMAIL_ENABLED, emailServiceEnabled.toString());
              sc.setValue(ServerConfigs.LOAN_TERM_VERIFICATOR_ENABLED, ltvEnabled.toString());
              sc.setValue(ServerConfigs.MAINTENANCE_RECALL_SERVICE_ENABLED, mrsEnabled.toString());
              managementService.setConfigurations(
                  sc,
                  new AsyncCallback() {

                    @Override
                    public void onSuccess(Object o) {
                      PIGE.setServerOperationModeStatus();
                      StatusBar statusBar = Registry.get(AppWidgets.APP_STATUS_BAR);
                      statusBar.setTimedText(messages.updateSuccessful());
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                      PIGE.handleException(caught);
                    }
                  });
            }
          });

      Html generatTitle = new Html(messages.general());
      generatTitle.addStyleName("pige-management-section-title");
      generalSectionPanel.add(generatTitle, new RowData(1, 25, new Margins(3)));
      LayoutContainer maintenancePanel = new LayoutContainer();
      maintenancePanel.setWidth(1);
      maintenancePanel.setBorders(false);
      maintenancePanel.setLayout(new RowLayout(Orientation.VERTICAL));

      // Maintenance mode
      Html maintenanceTitle = new Html(messages.maintenanceMode());
      maintenanceTitle.addStyleName("pige-management-topic-title");
      maintenancePanel.add(maintenanceTitle, new RowData(1, 20));
      Html maintenanceModeText = new Html(messages.maintenanceModeText());
      maintenancePanel.add(maintenanceModeText, new RowData(1, -1));
      LayoutContainer maintenanceConfigPanel = new LayoutContainer();
      maintenanceConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
      maintenancePanel.add(maintenanceConfigPanel, new RowData(1, 75));
      mmInfoArea = new TextArea();
      mmActivatedBtn = new ToggleButton(messages.activated());
      mmActivatedBtn.setSize(75, 22);
      mmActivatedBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      mmActivatedBtn.setToggleGroup("mm-state");
      mmDeactivatedBtn = new ToggleButton(messages.deactivated());
      mmDeactivatedBtn.setSize(75, 22);
      mmDeactivatedBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      mmDeactivatedBtn.setToggleGroup("mm-state");
      Listener mmButtonListener =
          new Listener<ButtonEvent>() {

            @Override
            public void handleEvent(ButtonEvent event) {
              if (mmActivatedBtn.isPressed()) {
                maintenanceModeActivated = Boolean.TRUE;
              } else {
                maintenanceModeActivated = Boolean.FALSE;
              }
            }
          };
      mmActivatedBtn.addListener(Events.Toggle, mmButtonListener);
      mmDeactivatedBtn.addListener(Events.Toggle, mmButtonListener);
      LayoutContainer buttonPanel = new LayoutContainer();
      buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      buttonPanel.add(mmActivatedBtn);
      buttonPanel.add(mmDeactivatedBtn);
      maintenanceConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3)));
      maintenanceConfigPanel.add(mmInfoArea, new RowData(1, 1));
      generalSectionPanel.add(maintenancePanel, new RowData(1, -1, new Margins(5)));

      // Email
      LayoutContainer emailServicePanel = new LayoutContainer();
      emailServicePanel.setWidth(1);
      emailServicePanel.setBorders(false);
      emailServicePanel.setLayout(new RowLayout(Orientation.VERTICAL));
      Html emailServiceTitle = new Html(messages.emailService());
      emailServiceTitle.addStyleName("pige-management-topic-title");
      emailServicePanel.add(emailServiceTitle, new RowData(1, 20));
      Html emailServiceText = new Html(messages.emailServiceText());
      emailServicePanel.add(emailServiceText, new RowData(1, -1));
      LayoutContainer emailServiceConfigPanel = new LayoutContainer();
      emailServiceConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
      emailServicePanel.add(emailServiceConfigPanel, new RowData(1, 75));
      emailEnabledBtn = new ToggleButton(messages.activated());
      emailEnabledBtn.setSize(75, 22);
      emailEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      emailEnabledBtn.setToggleGroup("email-service-state");
      emailDisabledBtn = new ToggleButton(messages.deactivated());
      emailDisabledBtn.setSize(75, 22);
      emailDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      emailDisabledBtn.setToggleGroup("email-service-state");
      Listener emailServiceButtonListener =
          new Listener<ButtonEvent>() {

            @Override
            public void handleEvent(ButtonEvent event) {
              if (emailEnabledBtn.isPressed()) {
                emailServiceEnabled = Boolean.TRUE;
              } else {
                emailServiceEnabled = Boolean.FALSE;
              }
            }
          };
      emailEnabledBtn.addListener(Events.Toggle, emailServiceButtonListener);
      emailDisabledBtn.addListener(Events.Toggle, emailServiceButtonListener);
      buttonPanel = new LayoutContainer();
      buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      buttonPanel.add(emailEnabledBtn);
      buttonPanel.add(emailDisabledBtn);
      emailServiceConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3)));
      generalSectionPanel.add(emailServicePanel, new RowData(1, -1, new Margins(5)));

      // Vérificateur d'échéance des emprunts
      LayoutContainer ltvServicePanel = new LayoutContainer();
      ltvServicePanel.setWidth(1);
      ltvServicePanel.setBorders(false);
      ltvServicePanel.setLayout(new RowLayout(Orientation.VERTICAL));
      Html ltvTitle = new Html(messages.loanTermVerification());
      ltvTitle.addStyleName("pige-management-topic-title");
      ltvServicePanel.add(ltvTitle, new RowData(1, 20));
      Html ltvText = new Html(messages.loanTermVerificationText());
      ltvServicePanel.add(ltvText, new RowData(1, -1));
      LayoutContainer ltvConfigPanel = new LayoutContainer();
      ltvConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
      ltvServicePanel.add(ltvConfigPanel, new RowData(1, 75));
      ltvEnabledBtn = new ToggleButton(messages.activated());
      ltvEnabledBtn.setSize(75, 22);
      ltvEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      ltvEnabledBtn.setToggleGroup("ltv-state");
      ltvDisabledBtn = new ToggleButton(messages.deactivated());
      ltvDisabledBtn.setSize(75, 22);
      ltvDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      ltvDisabledBtn.setToggleGroup("ltv-state");
      Listener ltvButtonListener =
          new Listener<ButtonEvent>() {

            @Override
            public void handleEvent(ButtonEvent event) {
              if (ltvEnabledBtn.isPressed()) {
                ltvEnabled = Boolean.TRUE;
              } else {
                ltvEnabled = Boolean.FALSE;
              }
            }
          };
      ltvEnabledBtn.addListener(Events.Toggle, ltvButtonListener);
      ltvDisabledBtn.addListener(Events.Toggle, ltvButtonListener);
      buttonPanel = new LayoutContainer();
      buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      buttonPanel.add(ltvEnabledBtn);
      buttonPanel.add(ltvDisabledBtn);
      ltvConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3)));
      generalSectionPanel.add(ltvServicePanel, new RowData(1, -1, new Margins(5)));

      // Service de rappel des maintenances.
      LayoutContainer mrsServicePanel = new LayoutContainer();
      mrsServicePanel.setWidth(1);
      mrsServicePanel.setBorders(false);
      mrsServicePanel.setLayout(new RowLayout(Orientation.VERTICAL));
      Html mrsTitle = new Html(messages.maintenanceRecalLService());
      mrsTitle.addStyleName("pige-management-topic-title");
      mrsServicePanel.add(mrsTitle, new RowData(1, 20));
      Html mrsText = new Html(messages.maintenanceRecalLServiceTxt());
      mrsServicePanel.add(mrsText, new RowData(1, -1));
      LayoutContainer mrsConfigPanel = new LayoutContainer();
      mrsConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
      mrsServicePanel.add(mrsConfigPanel, new RowData(1, 75));
      mrsEnabledBtn = new ToggleButton(messages.activated());
      mrsEnabledBtn.setSize(75, 22);
      mrsEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      mrsEnabledBtn.setToggleGroup("mrs-state");
      mrsDisabledBtn = new ToggleButton(messages.deactivated());
      mrsDisabledBtn.setSize(75, 22);
      mrsDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px");
      mrsDisabledBtn.setToggleGroup("mrs-state");
      Listener mrsButtonListener =
          new Listener<ButtonEvent>() {

            @Override
            public void handleEvent(ButtonEvent event) {
              if (mrsEnabledBtn.isPressed()) {
                mrsEnabled = Boolean.TRUE;
              } else {
                mrsEnabled = Boolean.FALSE;
              }
            }
          };
      mrsEnabledBtn.addListener(Events.Toggle, mrsButtonListener);
      mrsDisabledBtn.addListener(Events.Toggle, mrsButtonListener);
      buttonPanel = new LayoutContainer();
      buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL));
      buttonPanel.add(mrsEnabledBtn);
      buttonPanel.add(mrsDisabledBtn);
      mrsConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3)));
      generalSectionPanel.add(mrsServicePanel, new RowData(1, -1, new Margins(5)));
    }
    return generalSectionPanel;
  }
Example #18
0
  private void initUI() {
    long time = new java.util.Date().getTime();
    GWT.log("Initializing the UI ", null);

    container = new LayoutContainer();
    container.setLayout(new CenterLayout());

    // Rpc Proxy setup
    pagingToolBar = setupRpcProxy();

    // Audit event grid setup
    grid = setupGrid();

    // Panel
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Entity Event Viewer");
    cp.setFrame(true);
    cp.setIcon(IconHelper.create("images/search_icon_16x16.png"));
    cp.setLayout(new FormLayout());
    cp.setSize(1100, 630);

    // Search Container
    ContentPanel searchContainer = new ContentPanel();
    searchContainer.setHeaderVisible(false);
    FormLayout searchFormLayout = new FormLayout();
    searchFormLayout.setLabelWidth(130);
    searchFormLayout.setDefaultWidth(770);

    searchContainer.setLayout(searchFormLayout);

    selectedEvenyTypes = new TextField<String>();
    selectedEvenyTypes.setFieldLabel("Selected Event Types");
    selectedEvenyTypes.setReadOnly(true);

    evenyTypes = new ListView<AuditEventTypeWeb>();
    evenyTypes.setDisplayProperty("auditEventTypeName");
    evenyTypes.setWidth(220);
    evenyTypes.setHeight(110);
    evenyTypes.setStore(eventTypesStore);
    evenyTypes
        .getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<AuditEventTypeWeb>>() {

              public void handleEvent(SelectionChangedEvent<AuditEventTypeWeb> be) {
                List<AuditEventTypeWeb> selections = be.getSelection();
                String selectedTypes = "";
                for (AuditEventTypeWeb type : selections) {
                  if (selectedTypes.isEmpty()) {
                    selectedTypes = type.getAuditEventTypeName();
                  } else {
                    selectedTypes = selectedTypes + ", " + type.getAuditEventTypeName();
                  }
                }
                selectedEvenyTypes.setValue(selectedTypes);

                if (selectedTypes.isEmpty()) {
                  searchButton.disable();
                } else {
                  searchButton.enable();
                }
              }
            });

    DateTimePropertyEditor dateFormat = new DateTimePropertyEditor("yyyy-MM-dd HH:mm");
    startDate = new DateField();
    startDate.setFieldLabel("Start Date Time");
    startDate.setToolTip("yyyy-MM-dd HH:mm");
    startDate.setPropertyEditor(dateFormat);

    endDate = new DateField();
    endDate.setFieldLabel("End Date Time");
    endDate.setToolTip("yyyy-MM-dd HH:mm");
    endDate.setPropertyEditor(dateFormat);

    LayoutContainer main = new LayoutContainer();
    main.setLayout(new ColumnLayout());

    LayoutContainer left = new LayoutContainer();
    left.setStyleAttribute("paddingRight", "10px");
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    // layout.setLabelAlign(LabelAlign.TOP);
    left.setLayout(layout);
    left.add(startDate);

    LayoutContainer right = new LayoutContainer();
    right.setStyleAttribute("paddingLeft", "10px");
    layout = new FormLayout();
    // layout.setLabelAlign(LabelAlign.TOP);
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    right.setLayout(layout);
    right.add(endDate);

    main.add(left, new ColumnData(.5));
    main.add(right, new ColumnData(.5));

    HBoxLayoutData dataSelectedTypes = new HBoxLayoutData(new Margins(5, 0, 0, 0));
    searchContainer.add(selectedEvenyTypes, dataSelectedTypes);
    HBoxLayoutData dataTypes = new HBoxLayoutData(new Margins(5, 0, 5, 135));
    searchContainer.add(evenyTypes, dataTypes);

    searchContainer.add(main);
    HBoxLayoutData dataButtons = new HBoxLayoutData(new Margins(0, 0, 5, 0));
    searchContainer.add(setupButtonPanel(3), dataButtons);

    cp.add(searchContainer);
    cp.add(grid);
    cp.setBottomComponent(pagingToolBar);

    container.add(cp);

    LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL);
    wrapper.removeAll();
    wrapper.add(container);
    wrapper.layout();
    GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null);
  }
Example #19
0
  /** Creates the center. */
  private void createCenter() {
    center = new ContentPanel();
    center.setLayout(new BorderLayout());
    center.setHeaderVisible(false);

    ContentPanel map = new ContentPanel();
    map.setLayout(new FitLayout());
    map.setHeaderVisible(false);

    // we dont need this since we have listener on south panel as well

    map.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(AcoDBEvents.UPDATE_SOUTH_SIZE);
          }
        });
    map.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(AcoDBEvents.UPDATE_SOUTH_SIZE);
          }
        });

    map.setMonitorWindowResize(true);
    map.setLayoutOnChange(true);

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(0));

    // add map to center region of center panel
    center.add(map, data);

    data = new BorderLayoutData(LayoutRegion.CENTER);
    // data.setCollapsible(true);
    // data.setFloatable(true);
    // data.setSplit(true);
    data.setMargins(new Margins(5, 5, 5, 5));

    viewport.add(center, data);

    /* map options */
    MapOptions mapOptions = new MapOptions();
    mapOptions.setUnits(MapUnits.DEGREES);
    mapOptions.setProjection("EPSG:4326");

    MousePositionOutput mpOut =
        new MousePositionOutput() {

          public String format(LonLat lonLat, Map map) {
            String out = "";
            out += "<font size='2' color='black' style='font-weight:900'>";
            out += (float) lonLat.lon();
            out += " ";
            out += (float) lonLat.lat();
            out += "</font>";

            return out;
          }
        };

    MousePositionOptions mpOptions = new MousePositionOptions();
    mpOptions.setFormatOutput(mpOut);

    JSObject[] controls =
        new JSObject[] {
          new Navigation().getJSObject(),
          new PanZoom().getJSObject(),
          new LayerSwitcher().getJSObject(),
          new ScaleLine().getJSObject(),
          new MousePosition(mpOptions).getJSObject()
        };
    JObjectArray mapControls = new JObjectArray(controls);
    mapOptions.setControls(mapControls);

    Dispatcher.forwardEvent(GeoGWTEvents.INIT_MAPS_UI_MODULE, mapOptions);

    addBaseLayer();

    Dispatcher.forwardEvent(GeoGWTEvents.ATTACH_MAP_WIDGET, map);

    GeofenceGlobalConfiguration geoFenceConfiguration =
        (GeofenceGlobalConfiguration) GeofenceUtils.getInstance().getGlobalConfiguration();

    // Adjusting the Zoom level
    // Dispatcher.forwardEvent(GeoGWTEvents.ZOOM_TO_MAX_EXTENT);
    Dispatcher.forwardEvent(
        GeoGWTEvents.SET_MAP_CENTER,
        new Double[] {
          Double.valueOf(geoFenceConfiguration.getMapCenterLon()),
          Double.valueOf(geoFenceConfiguration.getMapCenterLat())
        });
    Dispatcher.forwardEvent(
        GeoGWTEvents.ZOOM, Integer.parseInt(geoFenceConfiguration.getMapZoom()));

    ToolbarItemManager toolbarItemManager = new ToolbarItemManager();

    // defining toolbar tools
    GenericClientTool poweredBy = new GenericClientTool();
    poweredBy.setId(ButtonBar.POWERED_BY);
    poweredBy.setOrder(-400);

    GenericClientTool toolbarSeparator1 = new GenericClientTool();
    toolbarSeparator1.setId(ButtonBar.TOOLBAR_SEPARATOR);
    toolbarSeparator1.setOrder(-300);

    ActionClientTool pan = new ActionClientTool();
    pan.setId("pan");
    pan.setEnabled(true);
    pan.setType("toggle");
    pan.setOrder(0);

    ActionClientTool zoomAll = new ActionClientTool();
    zoomAll.setId("zoomAll");
    zoomAll.setEnabled(true);
    zoomAll.setType("button");
    zoomAll.setOrder(10);

    ActionClientTool zoomBox = new ActionClientTool();
    zoomBox.setId("zoomBox");
    zoomBox.setEnabled(true);
    zoomBox.setType("toggle");
    zoomBox.setOrder(20);

    ActionClientTool zoomIn = new ActionClientTool();
    zoomIn.setId("zoomIn");
    zoomIn.setEnabled(true);
    zoomIn.setType("button");
    zoomIn.setOrder(30);

    ActionClientTool zoomOut = new ActionClientTool();
    zoomOut.setId("zoomOut");
    zoomOut.setEnabled(true);
    zoomOut.setType("button");
    zoomOut.setOrder(40);

    ActionClientTool drawFeature = new ActionClientTool();
    drawFeature.setId("drawFeature");
    drawFeature.setEnabled(true);
    drawFeature.setType("toggle");
    drawFeature.setOrder(50);

    GenericClientTool toolbarSeparator2 = new GenericClientTool();
    toolbarSeparator2.setId(ButtonBar.TOOLBAR_SEPARATOR);
    toolbarSeparator2.setOrder(300);

    //        ToolbarActionRegistry.getRegistry().put("synchUsers", new ToolActionCreator()
    //            {
    //
    //                public ToolbarAction createActionTool()
    //                {
    //                    UpdateUsersAction action = new UpdateUsersAction();
    //                    action.initialize();
    //
    //                    return action;
    //                }
    //            });
    //
    //        ActionClientTool synchUsers = new ActionClientTool();
    //        synchUsers.setId("synchUsers");
    //        synchUsers.setEnabled(true);
    //        synchUsers.setType("button");
    //        synchUsers.setOrder(310);

    GenericClientTool fillItem = new GenericClientTool();
    fillItem.setId(ButtonBar.FILL_ITEM);
    fillItem.setOrder(320);

    ToolbarActionRegistry.getRegistry()
        .put(
            "logout",
            new ToolActionCreator() {

              public ToolbarAction createActionTool() {
                LogoutAction action = new LogoutAction();
                action.initialize();

                return action;
              }
            });

    ActionClientTool logout = new ActionClientTool();
    logout.setId("logout");
    logout.setEnabled(true);
    logout.setType("button");
    logout.setOrder(500);

    List<GenericClientTool> clientTools = new ArrayList<GenericClientTool>();
    // clientTools.add(poweredBy);
    // clientTools.add(toolbarSeparator1);
    clientTools.add(pan);
    clientTools.add(zoomAll);
    clientTools.add(zoomBox);
    clientTools.add(zoomIn);
    clientTools.add(zoomOut);
    clientTools.add(drawFeature);
    clientTools.add(toolbarSeparator2);
    //        clientTools.add(synchUsers);
    clientTools.add(fillItem);
    clientTools.add(logout);

    toolbarItemManager.setClientTools(clientTools);

    if (GeoGWTUtils.getInstance().getGlobalConfiguration() == null) {
      GeoGWTUtils.getInstance().setGlobalConfiguration(new GeoGWTConfiguration());
    }

    GeoGWTUtils.getInstance().getGlobalConfiguration().setToolbarItemManager(toolbarItemManager);

    Dispatcher.forwardEvent(GeoGWTEvents.ATTACH_TOOLBAR, this.north);
    // Dispatcher.forwardEvent(GeofenceEvents.ATTACH_MAP_WIDGET, this.center);
  }
  public PanelGridContrato() {

    setCollapsible(true);
    setResizable(false);
    setMinimizable(true);
    setHeadingHtml("Contratos");
    setSize(700, 459);
    setLayout(new FitLayout());

    mainPanel = new ContentPanel();
    mainPanel.setFrame(true);
    mainPanel.setHeaderVisible(false);
    mainPanel.setLayout(new RowLayout(Orientation.VERTICAL));

    panelTool = new ContentPanel();
    panelTool.setHeaderVisible(false);
    panelTool.setFrame(true);
    panelTool.setCollapsible(true);
    panelTool.setLayout(new AbsoluteLayout());

    btnRelatrio = new Button("Relatório");
    btnRelatrio.setSize("44px", "44px");
    btnRelatrio.setIconAlign(IconAlign.TOP);
    btnRelatrio.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.report24()));
    //		btnRelatrio.setEnabled(false);
    btnRelatrio.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ParametrosReport parametros = new ParametrosReport();
            parametros.setNomeRelatorio(JasperName.CONTRATO);
            parametros.setContratoId(getSelecaoGrid().getId());

            InstanceService.RELATORIO_SERVICE.relatorio(parametros, new RelatorioCallback());
          }
        });

    panelTool.add(btnRelatrio, new AbsoluteData(606, 6));

    btnEditar = new Button("Editar");
    btnEditar.setSize("44px", "44px");
    btnEditar.setIconAlign(IconAlign.TOP);
    btnEditar.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconEditar24()));
    btnEditar.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            DTOContrato contrato = getSelecaoGrid();

            if (contrato != null) {
              FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
              formContrato.setModal(true);
              formContrato.loadDTOContrato(contrato);
              formContrato.show();
            } else {
              WebMessageBox.alert("Selecione o contrato para editar!");
            }
          }
        });
    panelTool.add(btnEditar, new AbsoluteData(556, 6));

    btnNovo = new Button("Novo");
    btnNovo.setSize("44px", "44px");
    btnNovo.setIconAlign(IconAlign.TOP);
    btnNovo.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconAdicionar24()));
    btnNovo.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
            formContrato.setModal(true);
            formContrato.show();
          }
        });
    panelTool.add(btnNovo, new AbsoluteData(506, 6));

    panelTool.add(new LabelField("Cliente:"), new AbsoluteData(6, 6));

    RpcProxy<PagingLoadResult<DTOCliente>> proxyCliente =
        new RpcProxy<PagingLoadResult<DTOCliente>>() {
          @Override
          public void load(
              Object loadConfig, AsyncCallback<PagingLoadResult<DTOCliente>> callback) {
            InstanceService.CLIENTE_SERVICE.loadPagingList((PagingLoadConfig) loadConfig, callback);
          }
        };

    PagingLoader<PagingLoadResult<ModelData>> loaderCliente =
        new BasePagingLoader<PagingLoadResult<ModelData>>(proxyCliente);

    storeCliente = new ListStore<DTOCliente>(loaderCliente);

    comboCliente = new ComboBox<DTOCliente>();
    comboCliente.setStore(storeCliente);
    comboCliente.setSize("286px", "22px");
    comboCliente.setTemplate(getTemplateNome());
    comboCliente.setValueField("id");
    comboCliente.setDisplayField("nome");
    comboCliente.setItemSelector("div.search-item");
    comboCliente.setHideTrigger(true);
    comboCliente.setLoadingText("Carregando...");
    comboCliente.setPageSize(10);
    comboCliente.addListener(
        Events.OnBlur,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent evt) {
            if (comboCliente.getValue() == null) {
              comboCliente.clear();
            }
          };
        });

    panelTool.add(comboCliente, new AbsoluteData(6, 28));

    tfData = new DateField();
    tfData.setSize("119px", "22px");
    tfData.setEditable(false);
    tfData.setValue(new Date());
    tfData
        .getDatePicker()
        .addListener(
            Events.Select,
            new Listener<DatePickerEvent>() {
              @Override
              public void handleEvent(DatePickerEvent be) {
                loadContratos();
              }
            });
    tfData.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
    panelTool.add(tfData, new AbsoluteData(298, 28));

    btnPesquisa = new Button();
    btnPesquisa.setSize("44px", "44px");
    btnPesquisa.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconPesquisa24()));
    btnPesquisa.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            pesquisa();
          }
        });
    panelTool.add(btnPesquisa, new AbsoluteData(423, 6));

    panelTool.add(new LabelField("Data:"), new AbsoluteData(300, 6));
    mainPanel.add(panelTool, new RowData(Style.DEFAULT, 75.0, new Margins(3)));

    storeContratos = new ListStore<DTOContrato>();

    gridContratos = new Grid<DTOContrato>(storeContratos, getColumnModel());
    gridContratos.setBorders(true);
    gridContratos.setAutoExpandColumn("nomeCliente");

    mainPanel.add(gridContratos, new RowData(Style.DEFAULT, 340.0, new Margins(3)));

    add(mainPanel);

    loadContratos();
  }
  private void createGesturePropertyForm() {
    FormPanel gesturePropertyForm = new FormPanel();
    gesturePropertyForm.setLabelAlign(LabelAlign.TOP);
    gesturePropertyForm.setHeaderVisible(false);

    final Text selectedCommand = new Text(SELECTED_COMMAND);

    ContentPanel commandTreeContainer = new ContentPanel();
    commandTreeContainer.setHeaderVisible(false);
    commandTreeContainer.setBorders(false);
    commandTreeContainer.setBodyBorder(false);
    commandTreeContainer.setSize(240, 150);
    commandTreeContainer.setLayout(new FitLayout());
    commandTreeContainer.setScrollMode(Scroll.AUTO);
    if (devicesAndMacrosTree == null) {
      devicesAndMacrosTree = TreePanelBuilder.buildCommandAndMacroTree();
      commandTreeContainer.add(devicesAndMacrosTree);
    }
    devicesAndMacrosTree.collapseAll();
    final AdapterField commandField = new AdapterField(commandTreeContainer);
    commandField.setFieldLabel("Select a command");
    commandField.setBorders(true);
    devicesAndMacrosTree
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener<BeanModel>() {
              public void selectionChanged(SelectionChangedEvent<BeanModel> se) {
                BeanModel commandModel = se.getSelectedItem();
                if (commandModel.getBean() != null) {
                  UICommandDTO uiCommand = commandModel.getBean();
                  selectedCommand.setText(SELECTED_COMMAND + uiCommand.getDisplayName());
                  selectedGesture.setUiCommandDTO(uiCommand);
                }
              }
            });

    final NavigateFieldSet navigateSet =
        new NavigateFieldSet(selectedGesture.getNavigate(), groups);
    navigateSet.setStyleAttribute("marginTop", "10px");
    navigateSet.setCheckboxToggle(true);
    navigateSet.addListener(
        Events.BeforeExpand,
        new Listener<FieldSetEvent>() {
          @Override
          public void handleEvent(FieldSetEvent be) {
            if (!selectedGesture.getNavigate().isSet()) {
              selectedGesture.getNavigate().setToLogical(ToLogicalType.setting);
            }
            navigateSet.update(selectedGesture.getNavigate());
          }
        });
    navigateSet.addListener(
        Events.BeforeCollapse,
        new Listener<FieldSetEvent>() {
          @Override
          public void handleEvent(FieldSetEvent be) {
            selectedGesture.getNavigate().clear();
          }
        });
    navigateSet.collapse();

    gesturePropertyForm.add(commandField);
    gesturePropertyForm.add(selectedCommand);
    gesturePropertyForm.add(navigateSet);
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    add(gesturePropertyForm, centerData);

    gestureTypeListView.addListener(
        Events.Select,
        new Listener<ListViewEvent<BeanModel>>() {
          public void handleEvent(ListViewEvent<BeanModel> be) {
            Gesture gesture =
                gestureMaps.get(((Gesture) be.getModel().getBean()).getType().toString());
            if (!gesture.equals(selectedGesture)) {
              selectedGesture = gesture;
              devicesAndMacrosTree.collapseAll();
              if (selectedGesture.getUiCommandDTO() != null) {
                selectedCommand.setText(
                    SELECTED_COMMAND + selectedGesture.getUiCommandDTO().getDisplayName());
              } else {
                selectedCommand.setText(SELECTED_COMMAND);
              }
              if (selectedGesture.getNavigate().isSet()) {
                navigateSet.expand();
                navigateSet.fireEvent(Events.BeforeExpand);
              } else {
                navigateSet.collapse();
              }
            }
          }
        });
  }
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());

    containerSizeStore = getContainerSizeStore();
    ironChestStore = getIronChestStore();
    bracketStore = getBracketStore();

    ContentPanel content = new ContentPanel();
    content.setHeaderVisible(false);
    content.setBodyBorder(false);
    content.setLayout(new RowLayout(Orientation.VERTICAL));

    LayoutContainer frame1 = new LayoutContainer();
    frame1.setStyleAttribute("padding", "10px");
    frame1.setStyleAttribute("backgroundColor", "#dfe8f6");
    frame1.setLayout(new BorderLayout());

    grid = createGrid();
    grid.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<BeanModel>>() {
              public void handleEvent(SelectionChangedEvent<BeanModel> be) {
                store.rejectChanges();
                resetState();
              }
            });

    formPanel = createForm();

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 305);
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);

    frame1.add(grid, westData);
    frame1.add(formPanel, centerData);

    content.add(frame1);

    LayoutContainer frame2 = new LayoutContainer();
    frame2.setStyleAttribute("backgroundColor", "#dfe8f6");
    frame2.setLayout(new RowLayout(Orientation.HORIZONTAL));

    RowData data1 = new RowData(.45, 1);
    data1.setMargins(new Margins(10));
    RowData data2 = new RowData(.55, 1);
    data2.setMargins(new Margins(10));
    frame2.add(createTypeGrid(), data1);
    frame2.add(createBracketGrid(), data2);

    RowData data = new RowData(1, 0.5);
    content.add(frame1, data);
    content.add(frame2, data);

    // 添加工具栏
    ToolBar toolBar = new ToolBar();

    addButton = new Button("添加", Resources.ICONS.add());
    addButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            beanModel = beanModelFactory.createModel(new Container());
            formPanel.reset();
            formBindings.bind(beanModel);
            formBindings.addListener(
                Events.Bind,
                new Listener<BindingEvent>() {
                  @Override
                  public void handleEvent(BindingEvent be) {
                    formBindings
                        .getModel()
                        .set("customsDeclarationHeadId", selectedCustomsDeclarationHead.getId());
                    for (Field<?> field : formPanel.getFields()) {
                      field.clearInvalid();
                    }
                    formBindings.removeAllListeners();
                  }
                });
            formPanel.setReadOnly(false);
            formPanel.getFields().get(0).focus();
            saveButton.setVisible(true);
            cancelButton.setVisible(true);
            updateButton.setVisible(false);
            resetButton.setVisible(false);
            addButton.disable();
          }
        });
    toolBar.add(addButton);

    toolBar.add(new SeparatorToolItem());

    editButton = new Button("修改", Resources.ICONS.edit());
    editButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (grid.getSelectionModel().getSelection().size() > 0) {
              formBindings.bind((BeanModel) grid.getSelectionModel().getSelection().get(0));
              formPanel.setReadOnly(false);
              updateButton.enable();
              resetButton.enable();
              editButton.disable();
            } else {
              formBindings.unbind();
            }
          }
        });
    toolBar.add(editButton);

    toolBar.add(new SeparatorToolItem());

    deleteButton = new Button("删除", Resources.ICONS.delete());
    toolBar.add(deleteButton);
    deleteButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            MessageBox.confirm(
                "确认",
                "确定要删除选中的条目吗?",
                new Listener<MessageBoxEvent>() {
                  @Override
                  public void handleEvent(MessageBoxEvent be) {
                    if (be.getButtonClicked().getText() == GXT.MESSAGES.messageBox_yes()) {
                      delete();
                    }
                  }
                });
          }
        });

    if (permitedEnterprise != null) {
      if (permitedEnterprise.getCanAdd()) {
        addButton.enable();
      } else {
        addButton.disable();
      }
      if (permitedEnterprise.getCanUpdate()) {
        editButton.enable();
      } else {
        editButton.disable();
      }
      if (permitedEnterprise.getCanDelete()) {
        deleteButton.enable();
      } else {
        deleteButton.disable();
      }
    }

    content.setTopComponent(toolBar);
    add(content);
  }
Example #23
0
  public ContentPanel initWeiget() {
    // ----

    // ----
    ContentPanel panel = new ContentPanel();
    panel.setLayout(new BorderLayout());
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setSplit(true);
    westData.setCollapsible(true);
    westData.setMargins(new Margins(0));
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5, 0, 5, 0));

    panel.add(CreateCcodeLeftPanel(), westData);

    TabPanel tabpanel = new TabPanel();

    tabpanel.setWidth(450);
    tabpanel.setHeight(450);
    tabpanel.setAutoHeight(true);
    TabItem normal = new TabItem("基本信息");
    normal.add(CreateCCodeDetailPanel());

    ContentPanel branchorg = new ContentPanel(); // createCcodebranchorgaddPanel
    TabItem bangogndizhi = new TabItem("办公地点和分支机构");

    branchorg.setHeight(400);
    branchorg.setHeaderVisible(false);
    branchorg.setLayout(new RowLayout(Orientation.VERTICAL));
    branchorg.add(createOfficePanel(), new RowData(1, 0.5));
    branchorg.add(createCcodebranchorgaddPanel(), new RowData(1, 0.5));
    bangogndizhi.add(branchorg);

    TabItem lianxiren = new TabItem("联系人信息");
    lianxiren.add(createLinkManPanel());

    final TabItem searchframe = new TabItem("查询相关信息");
    searchframe.setAutoHeight(true);
    final BaseSerchHtml bsh = new BaseSerchHtml();
    searchframe.add(bsh.getSearchFrame());
    searchframe.addListener(
        Events.Select,
        new Listener() {

          @Override
          public void handleEvent(BaseEvent be) {
            bsh.SearchHtml(
                store.getValue("cname") == null ? "" : store.getValue("cname").toString());
          }
        });
    /** store 换行的时候进行关键字的搜索 */
    store.addBaseStoreListener(
        BaseStoreEvent.EventType.ROW_CHANGED,
        new BaseStoreListener() {

          @Override
          public void BaseStoreEventHandle(BaseStoreEvent evt) {
            if (evt.getEventType() == BaseStoreEvent.EventType.ROW_CHANGED) {

              if (searchframe.isVisible()) {
                bsh.SearchHtml(
                    store.getValue("cname") == null ? "" : store.getValue("cname").toString());
              }
            }
          }

          @Override
          public void onBrowserEvent(Event event) {
            // TODO Auto-generated method stub

          }
        });
    tabpanel.add(normal);
    tabpanel.add(bangogndizhi);
    tabpanel.add(lianxiren);
    tabpanel.add(searchframe);

    panel.add(tabpanel, centerData);

    registerMainStore(store);
    registerStore(store);
    return panel;
  }
Example #24
0
  /**
   * 联系人
   *
   * @return
   */
  public ContentPanel createLinkManPanel() {

    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());

    ColumnConfig lname = new ColumnConfig("lname", "姓名", 80);
    TextField<String> text = new TextField<String>();
    lname.setEditor(new CellEditor(text));
    columns.add(lname);

    ColumnConfig dept = new ColumnConfig("dept", "部门", 80);
    TextField<String> depttext = new TextField<String>();
    dept.setEditor(new CellEditor(depttext));
    columns.add(dept);

    ColumnConfig headship = new ColumnConfig("headship", "职务", 80);
    TextField<String> headshiptext = new TextField<String>();
    headship.setEditor(new CellEditor(headshiptext));
    columns.add(headship);

    ColumnConfig passportcode = new ColumnConfig("passportcode", "护照号", 80);
    TextField<String> passportcodetext = new TextField<String>();
    passportcode.setEditor(new CellEditor(passportcodetext));
    columns.add(passportcode);

    ColumnConfig postcode1 = new ColumnConfig("postcode", "邮编", 80);
    TextField<String> postcodetext = new TextField<String>();
    postcode1.setEditor(new CellEditor(postcodetext));
    columns.add(postcode1);
    ColumnModel cm = new ColumnModel(columns);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");
    type.setTotalName("totle");
    type.addField("ccode", "ccode");

    type.addField("lname");
    type.addField("headship");
    type.addField("dept");
    type.addField("idx");
    type.addField("addr");
    type.addField("headship");
    type.addField("passportcode");

    type.addField("postcode");
    type.addField("telephone");
    type.addField("mobil");
    type.addField("privatemobil");
    type.addField("fax");
    type.addField("addrtype");

    StoreInfo info = new StoreInfo();

    info.setTablename("ccodelinkman_info");
    info.setSql("select * from ccodelinkman_info");
    info.setParent(store);
    info.setAutoinccolumn("idx");
    info.setLinkparentcolumns(new String[] {"ccode"});
    info.setKeyname(new String[] {"ccode", "idx"});

    BaseStore<JDBCModelData> branchorgadd = new BaseStore<JDBCModelData>(type, info);
    branchorgadd.setName("ccodelinkman_info");
    BaseGrid branchorgaddgrid = new BaseGrid(branchorgadd, cm);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    branchorgaddgrid.setSelectionModel(cbs);
    //   officegrid.setAutoExpandColumn("ccode");
    //  panel.setLayout(new BorderLayout());

    // ----------------------------
    final BaseFormPanel formpanel = new BaseFormPanel(branchorgadd);

    TextField<String> branchtelephone = new TextField<String>();
    branchtelephone.setName("telephone");
    branchtelephone.setFieldLabel("办公电话");

    formpanel.add(branchtelephone);
    final TextField<String> mobil = new TextField<String>();
    mobil.setName("mobil");
    mobil.setFieldLabel("移动电话");

    formpanel.add(mobil);

    final TextField<String> privatemobil = new TextField<String>();
    privatemobil.setName("privatemobil");
    privatemobil.setFieldLabel("私人电话");
    formpanel.add(privatemobil);

    privatemobil.addKeyListener(
        new KeyListener() {
          public void componentKeyUp(ComponentEvent event) {
            mobil.setValue(privatemobil.getValue());
          }
        });

    TextField<String> fax = new TextField<String>();
    fax.setName("fax");
    fax.setFieldLabel("传真");

    formpanel.add(fax);

    TextField<String> addrtype = new TextField<String>();
    addrtype.setName("addrtype");
    addrtype.setFieldLabel("地址类型");

    formpanel.add(addrtype);

    final TextField<String> postcode = new TextField<String>();
    postcode.setName("postcode");
    postcode.setFieldLabel("邮编");

    formpanel.add(postcode);

    TextField<String> addr = new TextField<String>();
    addr.setName("addr");
    addr.setFieldLabel("通讯地址");

    formpanel.add(addr);

    formpanel.setScrollMode(Scroll.AUTO);
    formpanel.inited();

    // 设置联系人界面上半部分的布局
    LayoutContainer top = new LayoutContainer();
    TableLayout tl = new TableLayout(2);
    top.setLayout(tl);
    TableData td = new TableData();
    td.setColspan(1);

    td.setRowspan(1);
    td.setVerticalAlign(VerticalAlignment.TOP);
    //			TableData td2 = new TableData();
    //			td2.setColspan(1);
    //			td2.setRowspan(1);

    //		    branchorgaddgrid.setSize(300, 200);
    //   branchorgaddgrid.setAutoWidth(true);
    branchorgaddgrid.setWidth(420);
    branchorgaddgrid.setAutoHeight(true);
    // formpanel.setSize(300, 380);
    formpanel.setHeaderVisible(false);

    top.add(branchorgaddgrid, td);
    top.add(formpanel, td);

    // ----------------家庭成员ccodecustomersolicitude

    List<ColumnConfig> customercolumns = new ArrayList<ColumnConfig>();

    CheckBoxSelectionModel cbs2 = new CheckBoxSelectionModel();

    customercolumns.add(cbs2.getColumn());
    ColumnConfig leaguertype = new ColumnConfig("leaguertype", "家庭成员", 80);
    TextField<String> leaguertext = new TextField<String>();
    leaguertype.setEditor(new CellEditor(leaguertext));
    customercolumns.add(leaguertype);
    ColumnConfig leaguername = new ColumnConfig("leaguername", "姓名", 80);
    TextField<String> leaguernametext = new TextField<String>();
    leaguername.setEditor(new CellEditor(leaguernametext));
    customercolumns.add(leaguername);

    ColumnModel customercm = new ColumnModel(customercolumns);

    ModelType customertype = new ModelType();
    customertype.setRoot("records");
    customertype.setRecordName("record");

    customertype.addField("ccode", "ccode");
    customertype.addField("leaguertype");
    customertype.addField("leaguername");
    customertype.addField("idx");
    customertype.addField("birthday");
    customertype.addField("commemorateday");
    customertype.addField("religion");
    customertype.addField("bekeenon");
    customertype.addField("tourexperience");
    customertype.addField("workexperience");
    customertype.addField("occupation");
    customertype.addField("workheadship");
    customertype.addField("remark");

    StoreInfo customerinfo = new StoreInfo();

    customerinfo.setTablename("ccodecustomersolicitude");
    customerinfo.setSql("select * from ccodecustomersolicitude");
    customerinfo.setParent(store);
    customerinfo.setAutoinccolumn("idx");
    customerinfo.setLinkparentcolumns(new String[] {"ccode"});
    customerinfo.setKeyname(new String[] {"ccode", "idx"});

    BaseStore<JDBCModelData> customertypestore =
        new BaseStore<JDBCModelData>(customertype, customerinfo);
    customertypestore.setName("ccodecustomersolicitude");
    BaseGrid customertypegrid = new BaseGrid(customertypestore, customercm);

    cbs2.setSelectionMode(SelectionMode.SINGLE);
    customertypegrid.setSelectionModel(cbs2);
    // ---------------------
    // --
    BaseFormPanel formcustomerpanel = new BaseFormPanel(customertypestore);
    formcustomerpanel.setHeaderVisible(false);

    TextField<String> birthdayc = new TextField<String>();
    birthdayc.setName("birthday");
    birthdayc.setFieldLabel("生日");

    formcustomerpanel.add(birthdayc);

    TextField<String> commemorateday = new TextField<String>();
    commemorateday.setName("commemorateday");
    commemorateday.setFieldLabel("纪念日");

    formcustomerpanel.add(commemorateday);

    TextField religion = new TextField();
    religion.setName("religion");
    religion.setFieldLabel("信仰");
    formcustomerpanel.add(religion);

    TextField bekeenon = new TextField();
    bekeenon.setName("bekeenon");
    bekeenon.setFieldLabel("主要爱好");

    formcustomerpanel.add(bekeenon);

    TextField tourexperience = new TextField();
    tourexperience.setName("tourexperience");
    tourexperience.setFieldLabel("旅游经历");

    formcustomerpanel.add(tourexperience);

    TextField workexperience = new TextField();
    workexperience.setName("workexperience");
    workexperience.setFieldLabel("工作经历");

    formcustomerpanel.add(workexperience);

    TextField occupation = new TextField();
    occupation.setName("occupation");
    occupation.setFieldLabel("职业");

    formcustomerpanel.add(occupation);

    TextField workheadship = new TextField();
    workheadship.setName("workheadship");
    workheadship.setFieldLabel("工作职位");

    formcustomerpanel.add(workheadship);

    TextField remark = new TextField();
    remark.setName("remark");
    remark.setFieldLabel("备注");

    formcustomerpanel.add(remark);
    formcustomerpanel.setScrollMode(Scroll.AUTO);
    formcustomerpanel.inited();
    //			    FormBinding formcustomerBindings = new FormBinding(formcustomerpanel, true);
    //			    formcustomerBindings.setStore(customertypestore);

    // --end

    ContentPanel panel = new ContentPanel();

    panel.setLayout(new TableLayout(2));
    panel.setHeaderVisible(false);

    TableData td1 = new TableData();
    td1.setColspan(2);

    //   panel.add(formpanel,td2);
    customertypegrid.setAutoHeight(true);
    //		    customertypegrid.setAutoWidth(true);
    customertypegrid.setWidth(420);
    //  formcustomerpanel.setSize(300, 300);

    TableData td2 = new TableData();
    td2.setColspan(1);
    td2.setRowspan(1);

    LayoutContainer bottom = new LayoutContainer();

    TableLayout bottomtl = new TableLayout(2);
    bottom.setLayout(bottomtl);
    TableData bottomtd = new TableData();
    bottomtd.setVerticalAlign(VerticalAlignment.TOP);
    bottomtd.setColspan(1);
    bottomtd.setRowspan(1);

    bottom.add(customertypegrid, bottomtd);
    bottom.add(formcustomerpanel, bottomtd);
    FieldSet fieldset = new FieldSet();
    fieldset.setHeading("联系人");
    FieldSet fieldset2 = new FieldSet();
    fieldset2.setHeading("联系人家庭成员信息");
    fieldset.add(top);
    fieldset2.add(bottom);

    panel.add(fieldset, td1);
    panel.add(fieldset2, td1);
    panel.setScrollMode(Scroll.AUTO);
    panel.setAutoHeight(true);
    panel.setAutoWidth(true);
    return panel;
  }
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    LayoutContainer layoutContainer = new LayoutContainer();
    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(3);

    ContentPanel cpGrid = new ContentPanel();
    cpGrid.setHeaderVisible(true);
    cpGrid.setHeading("Lista Dipendenti.");
    cpGrid.setBorders(false);
    cpGrid.setFrame(true);
    cpGrid.setHeight((h - 65));
    cpGrid.setWidth(w - 250);
    cpGrid.setScrollMode(Scroll.AUTO);
    cpGrid.setLayout(new FitLayout());
    cpGrid.setButtonAlign(HorizontalAlignment.CENTER);
    Resizable r = new Resizable(cpGrid);

    btnPrint = new Button();
    btnPrint.setEnabled(true);
    btnPrint.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.print24()));
    btnPrint.setIconAlign(IconAlign.TOP);
    btnPrint.setToolTip("Stampa");
    btnPrint.setSize(26, 26);
    btnPrint.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            SessionManagementService.Util.getInstance()
                .setDatiReportCostiDip(
                    "RIEP.COSTI",
                    store.getModels(),
                    new AsyncCallback<Boolean>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Error on setNomeReport()");
                      }

                      @Override
                      public void onSuccess(Boolean result) {
                        if (result) fp.submit();
                        else
                          Window.alert(
                              "Problemi durante il settaggio dei parametri in Sessione (http)");
                      }
                    });
          }
        });

    btnAdd = new Button();
    btnAdd.setStyleAttribute("padding-left", "2px");
    btnAdd.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.add()));
    btnAdd.setIconAlign(IconAlign.TOP);
    btnAdd.setSize(26, 26);
    btnAdd.setToolTip("Nuova Offerta");
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            RiepilogoCostiDipendentiModel am =
                new RiepilogoCostiDipendentiModel(
                    0, 0, "", "0.00", "", "0", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "",
                    "", "");

            gridRiepilogo.stopEditing();
            store.insert(am, 0);
            gridRiepilogo.startEditing(store.indexOf(am), 0);
          }
        });

    btnConfirm = new Button();
    btnConfirm.setEnabled(true);
    btnConfirm.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.confirm()));
    btnConfirm.setIconAlign(IconAlign.TOP);
    btnConfirm.setToolTip("Conferma modifiche");
    btnConfirm.setSize(26, 26);
    btnConfirm.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            RiepilogoCostiDipendentiModel c = new RiepilogoCostiDipendentiModel();

            for (Record record : store.getModifiedRecords()) {

              c = (RiepilogoCostiDipendentiModel) record.getModel();

              AdministrationService.Util.getInstance()
                  .editDatiCostiAzienda(
                      c,
                      new AsyncCallback<Boolean>() {

                        @Override
                        public void onFailure(Throwable caught) {
                          Window.alert("Errore di connessione on insertNewOffertaWithRda();");
                        }

                        @Override
                        public void onSuccess(Boolean result) {
                          if (result) {
                            caricaTabellaDati();
                          } else {
                            Window.alert(
                                "error: Impossibile effettuare l'inserimento/modifica dei dati!");
                          }
                        }
                      });
            }
          }
        });

    if ((ruolo.compareTo("PM") == 0)) {
      btnConfirm.disable();
      btnAdd.disable();
    }

    smplcmbxSede = new SimpleComboBox<String>();
    smplcmbxSede.setFieldLabel("Sede");
    smplcmbxSede.setWidth(65);
    smplcmbxSede.setEmptyText("Sede..");
    smplcmbxSede.setAllowBlank(false);
    smplcmbxSede.add("T");
    smplcmbxSede.add("B");
    smplcmbxSede.setStyleAttribute("padding-left", "2px");
    smplcmbxSede.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            caricaTabellaDati();
          }
        });

    // caricaTabellaDati();

    cm = new ColumnModel(createColumns());
    gridRiepilogo = new EditorGrid<RiepilogoCostiDipendentiModel>(store, cm);
    gridRiepilogo.setBorders(false);
    gridRiepilogo.setColumnLines(true);
    gridRiepilogo.setStripeRows(true);
    gridRiepilogo.setItemId("grid");
    gridRiepilogo.setSelectionModel(csm);

    fp.setMethod(FormPanel.METHOD_POST);
    fp.setAction(url);
    fp.addSubmitCompleteHandler(new FormSubmitCompleteHandler());
    fp.add(btnPrint);
    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.add(fp);

    ToolBar tlBar = new ToolBar();
    tlBar.add(smplcmbxSede);
    tlBar.add(btnAdd);
    tlBar.add(btnConfirm);
    tlBar.add(new SeparatorToolItem());
    tlBar.add(cp);

    cpGrid.setTopComponent(tlBar);
    cpGrid.add(gridRiepilogo);

    layoutContainer.add(cpGrid, new FitData(3, 3, 3, 3));

    add(layoutContainer);
  }
Example #26
0
  @Override
  protected void initialize() {
    super.initialize();

    final CardLayout layout = new CardLayout();
    final ContentPanel sectionPanel = new ContentPanel();
    sectionPanel.setHeaderVisible(Boolean.FALSE);
    sectionPanel.setLayout(layout);
    sectionPanel.setBodyBorder(Boolean.FALSE);
    sectionPanel.setBorders(Boolean.FALSE);
    sectionPanel.setBodyStyle("border: 0px solid black;");

    TreeStore<TreeModel> treeStore = new TreeStore<TreeModel>();
    TreePanel<TreeModel> treePanel = new TreePanel<TreeModel>(treeStore);
    treePanel.setWidth(150);
    treePanel.setDisplayProperty("id");
    treePanel.addStyleName("pige-help-topic-list-panel");
    TreePanelSelectionModel treeSelectionModel = new TreePanelSelectionModel();
    treeSelectionModel.setSelectionMode(SelectionMode.SINGLE);
    treeSelectionModel.bindTree(treePanel);
    treeSelectionModel.addSelectionChangedListener(
        new SelectionChangedListener<SectionNode>() {

          @Override
          public void selectionChanged(SelectionChangedEvent<SectionNode> se) {
            SectionNode node = se.getSelectedItem();
            ContentPanel c = node.getContent();
            if (c != null) {
              layout.setActiveItem(c);
              sectionPanel.layout();
            }
          }
        });

    Role role = Registry.get(PIGE.ROLE_OBJECT);
    if (role.getAppManagement()) {
      sectionPanel.add(getGeneralSection());
      SectionNode generalSectionNode = new SectionNode(messages.general(), getGeneralSection());
      treeStore.add(generalSectionNode, true);
    }
    if (role.getManageLoan()) {
      sectionPanel.add(getLateLoanReportSection());
      SectionNode reportSectionNode = new SectionNode(messages.reports());
      SectionNode lateLoanReportSectionNode =
          new SectionNode(messages.lateLoans(), getLateLoanReportSection());
      reportSectionNode.add(lateLoanReportSectionNode);
      treeStore.add(reportSectionNode, true);
    }

    BorderLayoutData westLD = new BorderLayoutData(LayoutRegion.WEST, 175);
    westLD.setMargins(new Margins(0, 0, 0, 0));
    westLD.setSplit(Boolean.TRUE);
    BorderLayoutData centerLD = new BorderLayoutData(LayoutRegion.CENTER);

    contentPanel.setBodyStyle("background-color: white;");
    contentPanel.add(treePanel, westLD);
    contentPanel.add(sectionPanel, centerLD);

    contentPanel.layout();

    ContentPanel panel = Registry.get(AppWidgets.APP_CONTENT_PANEL);
    panel.add(contentPanel);
    panel.layout();
  }