@UiHandler({"editBtn"}) public void editBtnCmd(ClickEvent ev) { final PopupPanel p = new PopupPanel(); // p.setTitle("Добавление экземпляра сущности..."); // p.setModal(false); p.setAutoHideEnabled(true); Widget source = (Widget) ev.getSource(); int left = source.getAbsoluteLeft(); int top = source.getAbsoluteTop(); p.setPopupPosition(left, top); // p.setPopupPosition(200, 200); // p.setSize("190px", "100px"); p.setSize("100%", "100%"); Anchor editSel = new Anchor("Изменить выбор"); Anchor editField = new Anchor("Изменить структуру"); Anchor editItems = new Anchor("К элементам"); editSel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editSelectionCmd(ev); p.hide(); } }); editField.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editFieldCmd(ev); p.hide(); } }); editItems.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editItemsCmd(ev); p.hide(); } }); VerticalPanel pnl = new VerticalPanel(); pnl.add(editSel); pnl.add(editField); pnl.add(editItems); p.add(pnl); p.show(); }
public SliderScrollPanel(EditorPanel ed) { this.editor = ed; sinkEvents(Event.ONCONTEXTMENU | Event.ONCLICK); contextMenu = ContextMenu.getInstance(); menu = new VerticalPanel(); Anchor editLabel = new Anchor("Edit"); editLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (clickedElement != null) { ContextMenu.hide(); MapView mapView = MapView.getInstance(); // mapView.saveMap(); Jq.hide(mapView.getElement().getId(), "slow"); AddMapObjectView view = AddMapObjectView.getInstance(); if (!view.isAttached()) { view.setVisible(false); BattleMap.add(view); } Jq.show(view.getElement().getId(), "slow"); MapObject mo = editor.getMapObjectById(clickedElement.getId()); EditorPanel.setSelected(clickedElement, mo, editor.getDimensions()); view.setSelectedObject(mo); } } }); menu.add(editLabel); }
public AppointmentFormPage() { popupPanel = new PopupPanel(true); popupPanel.add(uiBinder.createAndBindUi(this)); close.addClickHandler(closeHandler()); cancel.addClickHandler(closeHandler()); submit.addClickHandler(createSaveHandler()); }
@Override public void showSearchResult(SearchResult result) { if (table == null) { table = new DeviceSearchResultTable(result.getDescs(), selection); table.setRangeChangeHandler(presenter); table.setClickHandler(presenter); table.load(); resultPanel.add(table); final DeviceColumnPopupPanel panel = new DeviceColumnPopupPanel( new DeviceColumnPopupPanel.Presenter() { @Override public void onValueChange(int column, boolean value) { if (table != null) { table.setVisible(column, value); } } }); columnButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { panel.popup(columnButton); } }); initColumnPanel(result.getDescs(), panel); } table.setData(result); if (table.getPageSize() != DevicePageSize.getPageSize()) { table.setPageSize(DevicePageSize.getPageSize()); pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex()); } }
protected Widget createCurrentSelectionWidget() { if (!displayerSettings.isFilterEnabled()) return null; Set<String> columnFilters = filterColumns(); if (columnFilters.isEmpty()) return null; HorizontalPanel panel = new HorizontalPanel(); panel.getElement().setAttribute("cellpadding", "2"); for (String columnId : columnFilters) { List<Interval> selectedValues = filterIntervals(columnId); DataColumn column = dataSet.getColumnById(columnId); for (Interval interval : selectedValues) { String formattedValue = formatInterval(interval, column); panel.add(new Label(formattedValue)); } } Anchor anchor = new Anchor(GoogleDisplayerConstants.INSTANCE.googleDisplayer_resetAnchor()); panel.add(anchor); anchor.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { filterReset(); // Update the chart view in order to reflect the current selection // (only if not has already been redrawn in the previous filterUpdate() call) if (!displayerSettings.isFilterSelfApplyEnabled()) { updateVisualization(); } } }); return panel; }
public ToggleLink(String activateText, String deactivateText) { this.activateText = activateText; this.deactivateText = deactivateText; link = new Anchor(activateText); link.addClickHandler(this); initWidget(link); }
protected Anchor createTriggerAnchor(String jobName) { Anchor anchor = new Anchor("Run this job now"); anchor.addStyleName("TriggerJob"); ClickHandler clickHandler = new TriggerJobClickHandler(schedulingService, getTenant(), _scheduleDefinitionForJob); clickHandler = new RemoveWizardClickHandler(clickHandler, JobWizardController.this, jobName); anchor.addClickHandler(clickHandler); return anchor; }
protected Anchor createSchedulingAnchor(String jobName) { final Anchor anchor = new Anchor("Set up a job schedule"); anchor.addStyleName("ScheduleJob"); ClickHandler clickHandler = new CustomizeScheduleClickHandler( null, schedulingService, getTenant(), _scheduleDefinitionForJob); clickHandler = new RemoveWizardClickHandler(clickHandler, JobWizardController.this, jobName); anchor.addClickHandler(clickHandler); return anchor; }
@Override public void setModel(final Store model) { link.setText(model.getName()); link.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { groceryListWidget.filterOn(model); } }); }
@Override public void addFilterReset() { Anchor anchor = new Anchor(ChartJsDisplayerConstants.INSTANCE.chartjsDisplayer_resetAnchor()); filterPanel.add(anchor); anchor.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { getPresenter().onFilterResetClicked(); } }); }
private void addEliminarHander() { eliminarNotaInterinstitucional.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { adjuntos[0] = null; uploadTable.getWidget(0, 2).removeFromParent(); uploadTable.setText(0, 1, ""); uploadTable.setWidget(0, 2, notaInterinstitucional); } }); }
@Override protected List<Anchor> getLinks() { Anchor loginLink = new Anchor(LOC.login()); loginLink.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { GTShell.Instance.setContent(LoginWidget.Instance()); } }); List<Anchor> links = super.getLinks(); links.add(loginLink); return links; }
private void setupWidgets() { fieldHyperlink = new Anchor("", "#"); // Field 1 horizontalPanel = new HorizontalPanel(); horizontalPanel.add(fieldHyperlink); fieldHyperlink.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (enabled) { itemSelectionListener.onStartItemSelection(this); horizontalPanel.remove(fieldHyperlink); horizontalPanel.add(sgstField); sgstField.setText(fieldHyperlink.getText()); sgstField.setFocus(true); txtField.selectAll(); } } }); /*txtField.addFocusListener(new FocusListenerAdapter(){ public void onLostFocus(Widget sender){ stopSelection(); } }); /*sgstField.addFocusListener(new FocusListenerAdapter(){ public void onLostFocus(Widget sender){ stopSelection(); } });*/ sgstField.addSelectionHandler( new SelectionHandler<SuggestOracle.Suggestion>() { public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) { stopSelection(); } }); initWidget(horizontalPanel); }
private void setupWidgets() { horizontalPanel.setSpacing(HORIZONTAL_SPACING); columnPanel.setSpacing(VERTICAL_SPACING); sortPanel.setSpacing(VERTICAL_SPACING); horizontalPanel.add(columnPanel); horizontalPanel.add(sortPanel); columnPanel.add(new Label("Query Columns")); // LocaleText.get("????") columnPanel.add(addColumnLink); sortPanel.add(new Label("Column Sorting Order")); // LocaleText.get("????") initWidget(horizontalPanel); addColumnLink.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { addColumn((Widget) event.getSource()); } }); }
private void insertRankTableRow(int row, final AccountInfo info) { NumberFormat fmt = NumberFormat.getFormat("#,##0.00"); rankGrid.setWidget(row, 0, new Label(String.valueOf(row))); rankGrid.getCellFormatter().addStyleName(row, 0, "textCell"); rankGrid.setWidget(row, 1, new Label(info.getDisplayName())); rankGrid.getCellFormatter().addStyleName(row, 1, "textCell"); rankGrid.setWidget(row, 2, new Label(fmt.format(info.getIntialPrincipal()))); rankGrid.getCellFormatter().addStyleName(row, 2, "numericCell"); rankGrid.setWidget(row, 3, new Label(fmt.format(info.getLeftCapitical()))); rankGrid.getCellFormatter().addStyleName(row, 3, "numericCell"); rankGrid.setWidget(row, 4, new Label(fmt.format(info.getStockValue()))); rankGrid.getCellFormatter().addStyleName(row, 4, "numericCell"); rankGrid.setWidget(row, 5, new Label(fmt.format(info.getTotalValue()))); rankGrid.getCellFormatter().addStyleName(row, 5, "numericCell"); rankGrid.setWidget(row, 6, new Label(fmt.format(info.getProfit()))); rankGrid.getCellFormatter().addStyleName(row, 6, "numericCell"); rankGrid.setWidget(row, 7, new Label(fmt.format(info.getProfitPct()) + "%")); rankGrid.getCellFormatter().addStyleName(row, 7, "numericCell"); if (info.getProfit() > 0) { rankGrid.getCellFormatter().removeStyleName(row, 7, "negativeChange"); rankGrid.getCellFormatter().addStyleName(row, 7, "positiveChange"); rankGrid.getCellFormatter().removeStyleName(row, 6, "negativeChange"); rankGrid.getCellFormatter().addStyleName(row, 6, "positiveChange"); } else if (info.getProfit() < 0) { rankGrid.getCellFormatter().removeStyleName(row, 7, "positiveChange"); rankGrid.getCellFormatter().addStyleName(row, 7, "negativeChange"); rankGrid.getCellFormatter().removeStyleName(row, 6, "positiveChange"); rankGrid.getCellFormatter().addStyleName(row, 6, "negativeChange"); } else { rankGrid.getCellFormatter().removeStyleName(row, 7, "positiveChange"); rankGrid.getCellFormatter().removeStyleName(row, 7, "negativeChange"); rankGrid.getCellFormatter().removeStyleName(row, 6, "positiveChange"); rankGrid.getCellFormatter().removeStyleName(row, 6, "negativeChange"); } if (info.getTotalValue() != 0) { rankGrid.setWidget( row, 8, new Label(fmt.format(100.0 * info.getStockValue() / info.getTotalValue()) + "%")); } else { rankGrid.setWidget(row, 8, new Label("--")); } rankGrid.getCellFormatter().addStyleName(row, 8, "numericCell"); Anchor link = new Anchor("交易记录"); rankGrid.setWidget(row, 9, link); link.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { showTransHistory(info.getUsername(), info.getDisplayName()); } }); rankGrid.getCellFormatter().addStyleName(row, 9, "textCell"); Anchor positionBtn = new Anchor("当前持仓"); rankGrid.setWidget(row, 10, positionBtn); positionBtn.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { showPosition(info.getUsername(), info.getDisplayName()); } }); rankGrid.getCellFormatter().addStyleName(row, 10, "textCell"); }
public com.google.gwt.user.client.ui.Widget createAndBindUi( final org.restlet.example.book.restlet.ch09.client.TopPanel owner) { org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay = (org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle) GWT.create( org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle .class); com.google.gwt.resources.client.ImageResource logo = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logo(); com.google.gwt.resources.client.DataResource logoIe6Data = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logoIe6Data(); org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenCss_style style = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style(); java.lang.String domId0 = com.google.gwt.dom.client.Document.get().createUniqueId(); com.google.gwt.user.client.ui.Anchor signOutLink = (com.google.gwt.user.client.ui.Anchor) GWT.create(com.google.gwt.user.client.ui.Anchor.class); java.lang.String domId1 = com.google.gwt.dom.client.Document.get().createUniqueId(); com.google.gwt.user.client.ui.Anchor aboutLink = (com.google.gwt.user.client.ui.Anchor) GWT.create(com.google.gwt.user.client.ui.Anchor.class); com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel1 = new com.google.gwt.user.client.ui.HTMLPanel( template .html3( "" + style.logo() + "", "" + style.statusDiv() + "", "" + style.linksDiv() + "", domId0, domId1) .asString()); signOutLink.setHTML(template.html1().asString()); signOutLink.setHref("javascript:;"); aboutLink.setHTML(template.html2().asString()); aboutLink.setHref("javascript:;"); UiBinderUtil.TempAttachment attachRecord0 = UiBinderUtil.attachToDom(f_HTMLPanel1.getElement()); com.google.gwt.user.client.Element domId0Element = com.google.gwt.dom.client.Document.get().getElementById(domId0).cast(); com.google.gwt.user.client.Element domId1Element = com.google.gwt.dom.client.Document.get().getElementById(domId1).cast(); attachRecord0.detach(); f_HTMLPanel1.addAndReplaceElement(signOutLink, domId0Element); f_HTMLPanel1.addAndReplaceElement(aboutLink, domId1Element); final com.google.gwt.event.dom.client.ClickHandler handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1 = new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { owner.onAboutClicked(event); } }; aboutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1); final com.google.gwt.event.dom.client.ClickHandler handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2 = new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { owner.onSignOutClicked(event); } }; signOutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2); owner.aboutLink = aboutLink; owner.signOutLink = signOutLink; clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected(); return f_HTMLPanel1; }
public static FormPanel getLoginPanel() { // Create a FormPanel and point it at a service. final FormPanel form = new FormPanel(); form.setAction("/loginFormHandler"); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); form.setWidget(panel); panel.setSpacing(20); final Label emailLabel = new Label("UnityID:"); final TextBox emailBox = new TextBox(); final Label passwordLabel = new Label("Password:"******"Log in", new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); panel.add(loginButton); Anchor signUpLabel = new Anchor("-- New User: Sign up --"); signUpLabel.addStyleName("gwt-RegisterAnchor"); panel.addStyleName("gwt-LoginPanel"); loginButton.addStyleName("gwt-LoginButton"); signUpLabel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { RootPanel.get("leftnav").clear(); RootPanel.get("header").clear(); RootPanel.get("content").clear(); RootPanel.get("content").add(CustomWidgets.getRegisterForm()); final Label titleLabel = new Label("Register"); titleLabel.addStyleName("gwt-Heading"); RootPanel.get("header").add(titleLabel); } }); panel.add(signUpLabel); // Add an event handler to the form. form.addSubmitHandler( new FormPanel.SubmitHandler() { public void onSubmit(FormPanel.SubmitEvent event) { if (emailBox.getText().length() == 0 || passwordBox.getText().length() == 0) { Window.alert("Username and Password must not be empty"); rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); event.cancel(); } } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { final String userid = emailBox.getText(); String password = passwordBox.getText(); loginService.login( userid, password, new AsyncCallback<String>() { public void onFailure(Throwable caught) { rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); } public void onSuccess(String result) { if (result.equals("success")) { RootPanel.get("leftnav").clear(); RootPanel.get("header").clear(); RootPanel.get("content").clear(); dbService.readUserData( "ssharm20", new AsyncCallback<HashMap<String, String>>() { public void onFailure(Throwable caught) { rootLogger.log(Level.SEVERE, "Failed reading data from server"); } public void onSuccess(HashMap<String, String> result) { RootPanel.get("content").add(CustomWidgets.getHomeDataForm(userid)); } }); RootPanel.get("leftnav").add(CustomWidgets.getNavBar(userid)); final Label titleLabel = new Label("Home"); titleLabel.addStyleName("gwt-Heading"); RootPanel.get("header").add(titleLabel); } else { Window.alert(result); rootLogger.log(Level.SEVERE, "LOGIN ATTEMPT FAIL"); } } }); } }); return form; }
/** * Display the events for the cell located at <code>column</code>, <code>row</code> * * @param row * @param column * @param date * @param currentMonth */ private void drawEvents(int row, int column, final Date date) { final FlexTable grid = (FlexTable) getWidget(); // final VerticalPanel cell = (VerticalPanel) grid.getWidget(row, // column); final FlowPanel cell = (FlowPanel) grid.getWidget(row, column); if (cell == null) throw new NullPointerException( "The specified cell (" + row + ',' + column + ") doesn't exist."); // Displaying events final TreeSet<Event> sortedEvents = new TreeSet<Event>( new Comparator<Event>() { @Override public int compare(Event o1, Event o2) { int compare = 0; if (o1 == null && o2 == null) return 0; else if (o2 == null) return 1; else if (o1 == null) return -1; if (compare == 0 && o1.getDtstart() != null && o2.getDtstart() != null) { long o1Start = o1.getDtstart().getTime(); long o2Start = o2.getDtstart().getTime(); if (o1Start < o2Start) compare = -1; else if (o1Start > o2Start) compare = 1; } if (compare == 0 && o1.getSummary() != null && o2.getSummary() != null) compare = o1.getSummary().compareTo(o2.getSummary()); return compare; } }); for (final Calendar calendar : calendars) { final Map<Date, List<Event>> eventMap = normalize(calendar); final List<Event> events = eventMap.get(date); if (events != null) { sortedEvents.addAll(events); } } final Iterator<Event> iterator = sortedEvents.iterator(); for (int i = 0; iterator.hasNext() && i < eventLimit; i++) { final Event event = iterator.next(); final ClickableFlowPanel flowPanel = new ClickableFlowPanel(); flowPanel.addStyleName("calendar-event"); boolean fullDayEvent = false; final StringBuilder eventDate = new StringBuilder(); eventDate.append(hourFormatter.format(event.getDtstart())); if (event.getDtend() != null) { eventDate.append(" "); eventDate.append(hourFormatter.format(event.getDtend())); if (event.getDtstart().getDate() != event.getDtend().getDate() || event.getDtstart().getMonth() != event.getDtend().getMonth() || event.getDtstart().getYear() != event.getDtend().getYear()) { fullDayEvent = true; flowPanel.addStyleName("calendar-fullday-event"); } } final InlineLabel dateLabel = new InlineLabel(eventDate.toString()); dateLabel.addStyleName("calendar-event-date"); final InlineLabel eventLabel = new InlineLabel(event.getSummary()); eventLabel.addStyleName("calendar-event-label"); if (fullDayEvent) flowPanel.addStyleName("calendar-fullday-event-" + event.getParent().getStyle()); else eventLabel.addStyleName("calendar-event-" + event.getParent().getStyle()); if (!fullDayEvent) flowPanel.add(dateLabel); flowPanel.add(eventLabel); final DecoratedPopupPanel detailPopup = new DecoratedPopupPanel(true); final Grid popupContent = new Grid(event.getParent().isEditable() ? 5 : 3, 1); popupContent.setText(0, 0, event.getSummary()); popupContent.getCellFormatter().addStyleName(0, 0, "calendar-popup-header"); if (!fullDayEvent) { popupContent.getCellFormatter().addStyleName(1, 0, "calendar-popup-date"); popupContent .getCellFormatter() .addStyleName(1, 0, "calendar-event-" + event.getParent().getStyle()); popupContent.setText(1, 0, eventDate.toString()); } else popupContent.setText(1, 0, ""); if (event.getDescription() != null && !"".equals(event.getDescription())) { popupContent.getCellFormatter().addStyleName(2, 0, "calendar-popup-description"); popupContent.setText(2, 0, event.getDescription()); } else popupContent.setText(2, 0, ""); if (event.getParent().isEditable() && ProfileUtils.isGranted(authentication, GlobalPermissionEnum.EDIT_PROJECT_AGENDA)) { final Anchor editAnchor = new Anchor(I18N.CONSTANTS.calendarEditEvent()); editAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { delegate.edit(event, CalendarWidget.this); } }); final Anchor deleteAnchor = new Anchor(I18N.CONSTANTS.calendarDeleteEvent()); deleteAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { delegate.delete(event, CalendarWidget.this); detailPopup.hide(); } }); popupContent.setWidget(3, 0, editAnchor); popupContent.setWidget(4, 0, deleteAnchor); } detailPopup.setWidget(popupContent); flowPanel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final int left = flowPanel.getAbsoluteLeft() - 10; final int bottom = Window.getClientHeight() - flowPanel.getAbsoluteTop(); detailPopup.setWidth((getCellWidth(CELL_DEFAULT_WIDTH) + 20) + "px"); // Show the popup detailPopup.setPopupPositionAndShow( new PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { detailPopup.getElement().getStyle().setPropertyPx("left", left); detailPopup.getElement().getStyle().setProperty("top", ""); detailPopup.getElement().getStyle().setPropertyPx("bottom", bottom); } }); } }); cell.add(flowPanel); } if (eventLimit != UNDEFINED && sortedEvents.size() > eventLimit) { final Anchor eventLabel = new Anchor("\u25BC"); final Date thisDate = new Date(date.getTime()); eventLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { startDate = thisDate; setDisplayMode(DisplayMode.WEEK); } }); eventLabel.addStyleName("calendar-event-limit"); cell.add(eventLabel); } }
@Override public void onModuleLoad() { /** * Seuls les profils Super Adminisatreur et CA peuvent se connecter à cette page * */ if (Cookies.getCookie("profil") == null) { Window.Location.replace(GWT.getHostPageBaseURL() + "Connexion.html" + Constantes.SUFFIXE_URL); } else if (Cookies.getCookie("client") == null) Window.Location.replace( GWT.getHostPageBaseURL() + "Accueil_superadmin.html" + Constantes.SUFFIXE_URL); else if (Cookies.getCookie("profil").equals("CU")) { Window.Location.replace( GWT.getHostPageBaseURL() + "Accueil_applifit.html" + Constantes.SUFFIXE_URL); } else { // Ajouter le menu à la page MenuForm menu = new MenuForm(Constantes.USER); Document.get().getBody().appendChild(menu.getElement()); /** * action de deconnexion ** */ Anchor deconnexionWrapper = Anchor.wrap(menu.getDeconnexion()); deconnexionWrapper.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Utils.deconnexion(); } }); /** * action Rubrique accueil ** */ Anchor accueilWrapper = Anchor.wrap(menu.getAccueil()); accueilWrapper.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (Cookies.getCookie("profil").equals("SA")) Window.Location.replace( GWT.getHostPageBaseURL() + "Accueil_superadmin.html" + Constantes.SUFFIXE_URL); else Window.Location.replace( GWT.getHostPageBaseURL() + "Accueil_applifit.html" + Constantes.SUFFIXE_URL); } }); /** * action de rubrique formulaire ** */ Anchor formulaireWrapper = Anchor.wrap(menu.getFormulaire()); formulaireWrapper.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (Cookies.getCookie("profil").equals("SA") || Cookies.getCookie("profil").equals("CA")) Window.Location.replace( GWT.getHostPageBaseURL() + "Formulaire_menu_applifit.html" + Constantes.SUFFIXE_URL); else Window.Location.replace( GWT.getHostPageBaseURL() + "Formulaire_consulter_applifit.html" + Constantes.SUFFIXE_URL); } }); // Ajouter la zone de recherche à la page Document.get().getBody().insertAfter(recherche.getElement(), menu.getElement()); nativeMethod("datepicker"); // Remplire la liste des formulaires par les formulaires actifs liés // à la société courante FormulaireController.alimenterListeForm( FORMULAIRE_URL + "listerFormulaire/entreprise/" + Cookies.getCookie("client"), recherche); // Ajouter action por le button de recherche Anchor search = Anchor.wrap(recherche.getSearch_link()); search.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListBox lb = ListBox.wrap(recherche.getFormulaire()); // Vider la liste lb.clear(); lb.addItem("Choisir un formulaire...", ""); // Lancer la recherche du formulaire selon le nom et la date // de création FormulaireController.rechercheForm(recherche); // Ajouter action on change de la liste des formulaires , // affichant le formulaire selectionné final ListBox lb2 = ListBox.wrap(recherche.getFormulaire()); lb2.addChangeHandler( new ChangeHandler() { @SuppressWarnings("rawtypes") @Override public void onChange(ChangeEvent event) { elements = new ArrayList(); parametres = new ArrayList(); choices = new ArrayList(); options = new ArrayList(); // Si la ligne selectionnée n'est pas le prompt de // la liste if (lb.getSelectedIndex() != 0) { // Récuperer la valeur selectionnée formulaire_id = Long.parseLong(lb.getValue(lb.getSelectedIndex())); // Récuperer les elements et parametres du // formulaire et les afficher dans la zone de // modification chargerFormulaire(); } } }); } }); // Ajouter action on change de la liste des formulaires , affichant // le formulaire selectionné final ListBox lb = ListBox.wrap(recherche.getFormulaire()); lb.addChangeHandler( new ChangeHandler() { @SuppressWarnings("rawtypes") @Override public void onChange(ChangeEvent event) { elements = new ArrayList(); parametres = new ArrayList(); choices = new ArrayList(); options = new ArrayList(); // Si la ligne selectionnée n'est pas le prompt de la liste if (lb.getSelectedIndex() != 0) { // Récuperer la valeur selectionnée formulaire_id = Long.parseLong(lb.getValue(lb.getSelectedIndex())); // Récuperer les elements et parametres du formulaire et // les afficher dans la zone de modification chargerFormulaire(); } } }); } }
@Override public HandlerRegistration addNextVariableNameClickHandler(ClickHandler handler) { return next.addClickHandler(handler); }
@Override public HandlerRegistration addPreviousVariableNameClickHandler(ClickHandler handler) { return previous.addClickHandler(handler); }
/** * Create a widget containing text and a link that triggers the execution of a command. * * @param view the view where the alert should be added * @param text the text content of the alert * @param commands the command that should be executed when the link is clicked */ private void addTextAndLinkAlert( final ViewDef view, final String text, final UICommand... commands) { // Create a flow panel containing the text and the link: final FlowPanel alertPanel = new FlowPanel(); int start = 0; for (final UICommand command : commands) { // Find the open and close positions of the link within the message: final int openIndex = text.indexOf("<a>", start); // $NON-NLS-1$ final int closeIndex = text.indexOf("</a>", start); // $NON-NLS-1$ if (openIndex == -1 || closeIndex == -1 || closeIndex < openIndex) { break; } // Extract the text before, inside and after the tags: final String beforeText = text.substring(start, openIndex); final String betweenText = text.substring(openIndex + 3, closeIndex); start = closeIndex + 4; // Create the label for the text before the tag: final Label beforeLabel = new Label(beforeText); beforeLabel .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(beforeLabel); // Create the anchor: final Anchor betweenAnchor = new Anchor(betweenText); betweenAnchor .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(betweenAnchor); // Add a listener to the anchor so that the command is executed when // it is clicked: betweenAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { command.execute(); } }); } if (start < text.length()) { final String afterText = text.substring(start); // Create the label for the text after the tag: final Label afterLabel = new Label(afterText); afterLabel .getElement() .getStyle() .setProperty("display", "inline"); // $NON-NLS-1$ //$NON-NLS-2$ alertPanel.add(afterLabel); } if (start > 0) { // Add the alert to the view: view.addAlert(alertPanel); } }
@Override public HandlerRegistration addClickHandler(ClickHandler handler) { return userAnchor.addClickHandler(handler); }
/** * Create an avatar upload form element. * * @param label the label of the element. * @param desc the description. * @param servletPath the path to hit to upload the image * @param inProcessor the processor. * @param inStrategy the strategy. */ public AvatarUploadFormElement( final String label, final String desc, final String servletPath, final ActionProcessor inProcessor, final ImageUploadStrategy inStrategy) { description = desc; strategy = inStrategy; Boolean resizeable = strategy.isResizable(); errorBox = new FlowPanel(); errorBox.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox()); errorBox.add( new Label( "There was an error uploading your image. Please be sure " + "that your photo is under 4MB and is a PNG, JPG, or GIF.")); errorBox.setVisible(false); this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formAvatarUpload()); this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement()); processor = inProcessor; // AvatarEntity Entity = inEntity; uploadForm.setAction(servletPath); uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); Label photoLabel = new Label(label); photoLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel()); panel.add(photoLabel); FlowPanel avatarModificationPanel = new FlowPanel(); avatarModificationPanel.addStyleName( StaticResourceBundle.INSTANCE.coreCss().avatarModificationPanel()); avatarContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatarContainer()); avatarModificationPanel.add(avatarContainer); FlowPanel photoButtonPanel = new FlowPanel(); photoButtonPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formPhotoButtonPanel()); if (resizeable) { editButton = new Anchor("Resize"); editButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formResizeButton()); editButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); photoButtonPanel.add(editButton); } deleteButton = new Anchor("Delete"); deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formDeleteButton()); deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); photoButtonPanel.add(deleteButton); avatarModificationPanel.add(photoButtonPanel); panel.add(avatarModificationPanel); FlowPanel uploadPanel = new FlowPanel(); uploadPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formUploadPanel()); uploadPanel.add(errorBox); // Wrapping the FileUpload because otherwise IE7 shifts it way // to the right. I couldn't figure out why, // but for whatever reason, this works. FlowPanel fileUploadWrapper = new FlowPanel(); FileUpload upload = new FileUpload(); upload.setName("imageUploadFormElement"); upload.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formAvatarUpload()); fileUploadWrapper.add(upload); uploadPanel.add(fileUploadWrapper); uploadPanel.add(new Label(description)); Anchor submitButton = new Anchor(""); submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formUploadButton()); submitButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton()); uploadPanel.add(submitButton); hiddenImage = new Image(); hiddenImage.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatarHiddenOriginal()); uploadPanel.add(hiddenImage); panel.add(uploadPanel); submitButton.addClickHandler( new ClickHandler() { public void onClick(final ClickEvent event) { uploadForm.submit(); } }); uploadForm.setWidget(panel); this.add(uploadForm); uploadForm.addSubmitCompleteHandler( new SubmitCompleteHandler() { public void onSubmitComplete(final SubmitCompleteEvent ev) { String result = ev.getResults().replaceAll("\\<.*?\\>", ""); final boolean fail = "fail".equals(result); errorBox.setVisible(fail); if (!fail) { String[] results = result.split(","); if (results.length >= 4) { strategy.setX(Integer.parseInt(results[1])); strategy.setY(Integer.parseInt(results[2])); strategy.setCropSize(Integer.parseInt(results[3])); } onAvatarIdChanged(results[0], strategy.getEntityType() == EntityType.PERSON); } } }); if (editButton != null) { editButton.addClickHandler( new ClickHandler() { public void onClick(final ClickEvent inArg0) { // Since the size of the image is required before we can correctly show the // resize dialog, this method determines the avatar url and sets image url. // The load event of that image being loaded will kick off the resize modal. AvatarUrlGenerator urlGenerator = new AvatarUrlGenerator(EntityType.PERSON); hiddenImage.setUrl(urlGenerator.getOriginalAvatarUrl(avatarId)); } }); hiddenImage.addLoadHandler( new LoadHandler() { public void onLoad(final LoadEvent inEvent) { imageCropDialog = new ImageCropContent( strategy, processor, avatarId, new Command() { public void execute() { onAvatarIdChanged( strategy.getImageId(), strategy.getEntityType() == EntityType.PERSON); } }, hiddenImage.getWidth() + "px", hiddenImage.getHeight() + "px"); Dialog dialog = new Dialog(imageCropDialog); dialog.showCentered(); } }); } if (strategy.getImageType().equals(ImageType.BANNER)) { onAvatarIdChanged( strategy.getImageId(), strategy.getId().equals(strategy.getImageEntityId()), true, strategy.getEntityType() == EntityType.PERSON); } else { onAvatarIdChanged(strategy.getImageId(), strategy.getEntityType() == EntityType.PERSON); } deleteButton.addClickHandler( new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(final ClickEvent event) { if (new WidgetJSNIFacadeImpl() .confirm("Are you sure you want to delete your current photo?")) { strategy.getDeleteAction().delete(strategy.getDeleteParam()); } } }); Session.getInstance() .getEventBus() .addObserver( ClearUploadedImageEvent.class, new Observer<ClearUploadedImageEvent>() { public void update(final ClearUploadedImageEvent event) { if (event.getImageType().equals(strategy.getImageType()) && event.getEntityType().equals(strategy.getEntityType())) { if (event.getImageType().equals(ImageType.BANNER)) { onAvatarIdChanged( event.getEntity().getBannerId(), strategy.getId().equals(event.getEntity().getBannerEntityId()), true, strategy.getEntityType() == EntityType.PERSON); } else { onAvatarIdChanged(null, strategy.getEntityType() == EntityType.PERSON); } } } }); }
// Charger la zone de modification par les differents elements du formulaire public void chargerFormulaire() { // Vider la zone de modification dans le cas où elle est occupée par un // autre formulaire if (bodyExist) { RootPanel.get("container_principal").clear(); Document.get().getBody().removeChild(bodyForm.getElement()); dualListBox.clear(); enregistrer = new Anchor(); } // Construire la zone de modification bodyForm = new BodyFormulaire(); Document.get().getBody().appendChild(bodyForm.getElement()); // Alimenter la liste des comptes CU et CA alimenterList(); // Ajouter Action au lien "Allocation du formulaire" Anchor link_allocation = Anchor.wrap(bodyForm.getLink_allocation()); link_allocation.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // Afficher le popup contenant la dual liste qui contient la // liste des comptes CA et CU FormulaireController.CreateDialogBoxAllocation(dualListBox, false, null).show(); } }); // Ajouter le button supprimer Formulaire supprimer.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:13%; cursor:pointer'>Supprimer</a>"); RootPanel.get("button_Enregistrer").add(supprimer); // RootPanel.get("form_formulaire_allocation").getElement().appendChild(dualListBox.getElement()); RootPanel.get("form_formulaire_creation").getElement().appendChild(form.getElement()); enregistrer.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:15px; cursor:pointer'>Enregistrer</a>"); RootPanel.get("button_Enregistrer").add(enregistrer); RootPanel.get("contenu_principal_formulaire").add(new FormulaireBoard()); RootPanel.get("container_principal").insert(FormulaireController.createImageGrid(), 0); bodyExist = true; // Remplir le formulaire nom et commentaire RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, FORMULAIRE_URL + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} @SuppressWarnings("deprecation") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { JSONValue formAsJSONValue = JSONParser.parse(response.getText()); formAsJSONObject = formAsJSONValue.isObject(); ((InputElement) form.getForm_nom()) .setValue(formAsJSONObject.get("nom").isString().stringValue()); ((InputElement) form.getForm_comment()) .setValue(formAsJSONObject.get("commentaire").isString().stringValue()); ancienNom = form.getForm_nom().getValue(); // ((InputElement)form.getForm_nom()).setDisabled(true); } } }); } catch (RequestException e) { System.out.println("RequestException"); } // Remplir la zone de création par les elements et les parametres builder = new RequestBuilder( RequestBuilder.GET, ELEMENT_URL + "listerElement/formulaire/" + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} @SuppressWarnings("deprecation") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { String elementsAsJSONString = response.getText(); JSONValue elementsAsJSONValue = JSONParser.parse(elementsAsJSONString); JSONArray elementsAsJSONArray = elementsAsJSONValue.isArray(); for (int i = 0; i < elementsAsJSONArray.size(); i++) { JSONValue elementAsJSONValue = elementsAsJSONArray.get(i); JSONObject elementAsJSONObject = elementAsJSONValue.isObject(); elementsAsString += elementAsJSONObject.get("id").isNumber().toString() + "-"; getParamsByElement( Long.parseLong(elementAsJSONObject.get("id").isNumber().toString()), Integer.parseInt(elementAsJSONObject.get("position_y").isNumber().toString()), Integer.parseInt(elementAsJSONObject.get("position_x").isNumber().toString()), elementAsJSONObject.get("type").isString().stringValue()); } } } }); } catch (RequestException e) { System.out.println("RequestException"); } // Action de suppression d'un formulaire supprimer.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // Supprimer le formulaire RequestBuilder builder = new RequestBuilder( RequestBuilder.PUT, FORMULAIRE_URL + "supprimer/" + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} public void onResponseReceived(Request request, Response response) { Window.Location.reload(); } }); } catch (RequestException e) { System.out.println("RequestException"); } } }); // Action de l'enregistrement du formulaire dans la base de données enregistrer.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { FormulaireController.recupererElements(choices, options, elements, parametres); // Ajouter les elements regroupés dans la base de données ajouterFormulaire(elements); } }); final Anchor apercu = new Anchor(); // Création du lien de l'aperçu apercu.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:15px; cursor:pointer'>Aperçu</a>"); RootPanel.get("button_Enregistrer").add(apercu); apercu.addClickHandler( new ClickHandler() { @SuppressWarnings("rawtypes") public void onClick(ClickEvent event) { choices = new ArrayList(); options = new ArrayList(); elements = new ArrayList(); parametres = new ArrayList(); FormulaireController.recupererElements(choices, options, elements, parametres); bodyapercu = new BodyApercu(); // Passer à l'interface de l'aperçu Document.get().getBody().removeChild(bodyForm.getElement()); Document.get().getBody().appendChild(bodyapercu.getElement()); // Création de la page de l'aperçu FormulaireController.pageApercu( bodyapercu, form.getForm_nom().getValue(), form.getForm_comment().getValue(), elements, parametres, choices, options); Anchor retourAnchor = Anchor.wrap(bodyapercu.getRetour()); retourAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { choices = new ArrayList(); options = new ArrayList(); elements = new ArrayList(); parametres = new ArrayList(); Document.get().getBody().removeChild(bodyapercu.getElement()); Document.get().getBody().appendChild(bodyForm.getElement()); } }); } }); }
public DeploymentView() { VerticalPanel container = new VerticalPanel(); container.addStyleName("container"); FlexTable table = new FlexTable(); Anchor back = new Anchor("<< Retour"); int rowIndex = 0; // Titre : création/edition viewTitle = new HTML(); table.setWidget(rowIndex, 0, viewTitle); table.getFlexCellFormatter().setColSpan(rowIndex, 0, 2); table .getCellFormatter() .setHorizontalAlignment(rowIndex++, 0, HasHorizontalAlignment.ALIGN_CENTER); // Date de déploiement deploymentDatePicker = new DatePicker(); deploymentDatePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { listener.setDeploymentDate(event.getValue()); } }); table.setWidget(rowIndex, 0, new HTML("Date prévue de déploiement")); table.setWidget(rowIndex++, 1, deploymentDatePicker); // Flag deployée ou pas deployedCheckBox = new CheckBox(); table.setWidget(rowIndex, 0, new HTML("Deployé")); table.setWidget(rowIndex++, 1, deployedCheckBox); // Bouton de validation saveButton = new Button("Enregistrer"); table.setWidget(rowIndex, 0, saveButton); table.getFlexCellFormatter().setColSpan(rowIndex, 0, 2); table .getCellFormatter() .setHorizontalAlignment(rowIndex++, 0, HasHorizontalAlignment.ALIGN_CENTER); // Création des handlers back.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DeploymentView.this.listener.goTo(new MainPlace()); } }); deploymentDatePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { DeploymentView.this.listener.setDeploymentDate(event.getValue()); } }); deployedCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { DeploymentView.this.listener.setDeployed(event.getValue()); } }); saveButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DeploymentView.this.listener.save(); } }); container.add(back); container.add(table); initWidget(container); }
private void createComponent() { hlBack = new Anchor("<<back"); hlBack.addClickHandler(this); vPanel.add(hlBack); ProjectItems projectItems = currentUser.getProjectItems(); if (projectItems.getProjectItemCount() == 0) { vPanel.add(new HTML("You are not subscribed to any projects.")); } else { vPanel.add(form); lbProjects = new ListBox(false); lbProjects.addChangeHandler(this); vPanel.setSize("1000px", "500px"); table.setCellSpacing(5); table.setCellPadding(0); table.setWidth("100%"); tbName.setWidth("300px"); // tbDescription.setWidth("300px"); txtFileNotes.setHeight("75px"); upload.setName("uploadFormElement"); // fileUpload.setName("fileuploadFormElement"); tbName.setName("name"); tbDescription.setName("description"); txtFileNotes.setName("notes"); lbProjects.setName("projectDetails"); btnSubmit.addClickHandler(this); txtWarnings.setStylePrimaryName("warnings"); txtWarningDesc.setStylePrimaryName("warnings"); txtFileNotes.setCharacterWidth(50); tbName.setMaxLength(50); // tbDescription.setMaxLength(255); // tbDescription.setText(""); txtLogin = new TextBox(); txtLogin.setName("user"); txtLogin.setVisible(false); txtProject = new TextBox(); txtProject.setName("projectName"); txtProject.setVisible(false); int projectId = currentUser.getPreferredProjectId(); for (int i = 0; i < projectItems.getProjectItemCount(); i++) { ProjectItem item = projectItems.getProjectItem(i); lbProjects.addItem(item.getProjectName(), String.valueOf(item.getProjectId())); if (projectId > 0) { if (projectId == item.getProjectId()) { lbProjects.setItemSelected(i, true); } } else { lbProjects.setItemSelected(0, true); } } table.setText(0, 0, ""); table.setWidget(0, 1, txtWarnings); table.setText(1, 0, ""); table.setWidget(1, 1, txtWarningDesc); table.setWidget(2, 0, new HTML("<b>Name:</b> ")); table.setWidget(2, 1, tbName); table.setWidget(3, 0, new HTML("<b>File:</b> ")); table.setWidget(3, 1, upload); // table.setWidget(4, 0, new HTML("<b>Description:</b> ")); // table.setWidget(4, 1, fileUpload); table.setWidget(5, 0, new HTML("<b>Project:</b> ")); table.setWidget(5, 1, lbProjects); table.setWidget(6, 0, new HTML("<b>Notes:</b> ")); table.setWidget(6, 1, txtFileNotes); table.setWidget(7, 1, btnSubmit); table.setWidget(7, 2, txtLogin); table.setWidget(7, 3, txtProject); table.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(4, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(6, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(7, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(3, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(4, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(5, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(5, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(6, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(6, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(7, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(7, 1, HasVerticalAlignment.ALIGN_TOP); form.add(table); form.setAction(UPLOAD_ACTION_URL); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.addSubmitHandler( new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can // take this opportunity to perform validation. String fileName1 = upload.getFilename().trim(); // String fileName2 = fileUpload.getFilename().trim(); // System.out.println("File1: " + fileName1); if (fileName1.length() == 0 && tbName.getText().length() == 0) { txtWarnings.setHTML("*Please upload a file."); txtWarningDesc.setHTML("*Please enter the Job name."); event.cancel(); } if ((fileName1.length() == 0) && tbName.getText().length() != 0) { txtWarnings.setText(""); txtWarningDesc.setText(""); txtWarnings.setHTML("*Please upload a file."); event.cancel(); } if ((!(fileName1.length() == 0)) && tbName.getText().length() == 0) { txtWarnings.setText(""); txtWarningDesc.setText(""); txtWarnings.setHTML("*Please enter the Job name."); event.cancel(); } } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { txtFileNotes.setText(""); txtWarningDesc.setText(""); String sessionID = Cookies.getCookie("sid"); if (sessionID != null) { String result = event.getResults(); System.out.println("UploadJob Result: " + result); // Log.info("Result: " + result); String[] results = result.split("~"); /*for(int i = 0; i < results.length; i++) { System.out.println(results[i]); try { jobId = Integer.parseInt(results[0]); } catch(NumberFormatException e) { e.printStackTrace(); } }*/ int jobId = -1; try { jobId = Integer.parseInt(results[0]); } catch (NumberFormatException e) { e.printStackTrace(); } // Code modified if (jobId == 0) { txtWarnings.setHTML(results[1]); } // Code modified // txtWarnings.setHTML(results[1]); else { if (currentUser.getUsertype().equalsIgnoreCase("user")) { History.newItem("userJobList"); } else { if (tab == 0) { History.newItem("adminJobList"); } else { History.newItem("jobList"); } // AdminPage adminPage = new AdminPage(tab); // RootPanel.get("content").add(adminPage); } } } else { Login login = new Login(); login.displayLoginBox(); } } }); } }
@Inject StoriesView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); bindSlot(StoriesPresenter.SLOT_CREATESTORY, panelCreateStory); lstStatus.setNullText("--Status--"); lstBranch.setNullText("--Branch--"); lstCreator.setNullText("--Staff--"); lstStatus.setItems( Arrays.asList( NewsQueueStatus.Draft, NewsQueueStatus.InProgress, NewsQueueStatus.Published, // NewsQueueStatus.Returned, NewsQueueStatus.Spiked)); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); searchCallback.onComplete(null); } }); setMineOnly(true); aDateRange.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { AppManager.showPopUp( "Date Range", dateSelector, new OnOptionSelected() { @Override public void onSelect(String name) { if (name.equals("Clear")) { dateSelector.clearData(); } if (dateSelector.hasValue()) { aDateRange.addStyleName("orange"); alertOnSearchValueChange(true); } else { aDateRange.removeStyleName("orange"); } aDateRange.setTitle("" + dateSelector.getValueAsString()); searchCallback.onComplete(null); } }, "Done", "Clear"); } }); lstStatus.addValueChangeHandler( new ValueChangeHandler<NewsQueueStatus>() { @Override public void onValueChange(ValueChangeEvent<NewsQueueStatus> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstCreator.addValueChangeHandler( new ValueChangeHandler<UserDto>() { @Override public void onValueChange(ValueChangeEvent<UserDto> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstBranch.addValueChangeHandler( new ValueChangeHandler<Org>() { @Override public void onValueChange(ValueChangeEvent<Org> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); } }); }