public VerticalPanel buildUsersListPanel() { DockPanel headerDockPanel = new DockPanel(); headerDockPanel.add(deleteUserBtn, DockPanel.EAST); VerticalPanel spacer = new VerticalPanel(); spacer.setWidth("2"); // $NON-NLS-1$ headerDockPanel.add(spacer, DockPanel.EAST); headerDockPanel.add(addUserBtn, DockPanel.EAST); Label label = new Label("Users"); // $NON-NLS-1$ headerDockPanel.add(label, DockPanel.WEST); headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$ VerticalPanel userListPanel = new VerticalPanel(); userListPanel.add(headerDockPanel); userListPanel.add(usersList); userListPanel.add(new Label(Messages.getString("filter"))); // $NON-NLS-1$ userListPanel.add(filterTextBox); userListPanel.setCellHeight(usersList, "100%"); // $NON-NLS-1$ userListPanel.setCellWidth(usersList, "100%"); // $NON-NLS-1$ userListPanel.setHeight("100%"); // $NON-NLS-1$ userListPanel.setWidth("100%"); // $NON-NLS-1$ usersList.setHeight("100%"); // $NON-NLS-1$ usersList.setWidth("100%"); // $NON-NLS-1$ filterTextBox.setWidth("100%"); // $NON-NLS-1$ deleteUserBtn.setEnabled(false); filterTextBox.addKeyboardListener(this); usersList.addChangeListener(this); addUserBtn.addClickListener(this); deleteUserBtn.addClickListener(this); return userListPanel; }
/** * Creates an empty dialog box specifying its "auto-hide" property. It should not be shown until * its child widget has been added using {@link #add(Widget)}. * * @param autoHide <code>true</code> if the dialog should be automatically hidden when the user * clicks outside of it * @param modal <code>true</code> if keyboard and mouse events for widgets not contained by the * dialog should be ignored */ public MyDialogBox(boolean autoHide, boolean modal) { super(autoHide, modal); dock = new HorizontalPanel(); dock.add(caption); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(0); dock.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); listener = new DialogListener(this); minimiseBtn.addClickListener(listener); maximiseBtn.addClickListener(listener); closeBtn.addClickListener(listener); hp.add(minimiseBtn); hp.add(maximiseBtn); hp.add(closeBtn); dock.add(hp); panel.add(dock); panel.setHeight("100%"); panel.setSpacing(0); sp = new ScrollPanel(); panel.add(sp); super.setWidget(panel); setStyleName("gwt-DialogBox"); dock.setStyleName("Caption"); caption.addMouseListener(this); }
public ResourceSidePanel(IDomeo domeo, SidePanelsFacade facade, ASideTab tab) { super(domeo, facade, tab); initWidget(binder.createAndBindUi(this)); body.setHeight("100%"); }
public RuleValidatorWrapper(Widget editor, RuleAsset asset) { this.asset = asset; this.editor = editor; layout.add(editor); if (!asset.isreadonly) { validatorActions(); } layout.setWidth("100%"); layout.setHeight("100%"); initWidget(layout); }
public InformationDialog(String html) { // Set the dialog box's caption. setText(LocaleMessages.LANG.information()); // Enable animation. setAnimationEnabled(false); // Enable glass background. setGlassEnabled(true); Label label = new Label(html); Button ok = new Button(LocaleMessages.LANG.accept()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { InformationDialog.this.hide(); } }); VerticalPanel panel = new VerticalPanel(); VerticalPanel panelH = new VerticalPanel(); panel.setHeight("100px"); panel.setWidth("180px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.add(label); panelH.setHeight("40px"); panel.add(panelH); panel.add(ok); setWidget(panel); }
@Override public void showEmpty(Displayer displayer) { currentDisplayer = null; VerticalPanel centeredPanel = new VerticalPanel(); centeredPanel.setWidth("100%"); centeredPanel.setHeight("100%"); centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); Label noDataLabel = new Label(DashboardConstants.INSTANCE.noData()); centeredPanel.add(noDataLabel); displayerPanel.clear(); displayerPanel.add(centeredPanel); }
@Override public void showLoading(Displayer displayer) { currentDisplayer = null; VerticalPanel centeredPanel = new VerticalPanel(); centeredPanel.setWidth("100%"); centeredPanel.setHeight("100%"); centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); Image loadingIcon = new Image(DataSetClientResources.INSTANCE.images().loadingIcon().getSafeUri()); loadingIcon.setTitle(DashboardConstants.INSTANCE.loading()); loadingIcon.setAltText(DashboardConstants.INSTANCE.loading()); centeredPanel.add(loadingIcon); displayerPanel.clear(); displayerPanel.add(centeredPanel); }
public DependencyWidget(final PackageConfigData conf, boolean readonly) { this.conf = conf; this.readonly = readonly; layout = new FormStyleLayout(); VerticalPanel header = new VerticalPanel(); Label caption = new Label("Dependencies"); caption.getElement().getStyle().setFontWeight(FontWeight.BOLD); header.add(caption); header.add(dependencyTip()); layout.addAttribute("", header); /* layout.addHeader( images.statusLarge(), header );*/ VerticalPanel vp = new VerticalPanel(); vp.setHeight("100%"); vp.setWidth("100%"); // pf.startSection(); layout.addRow(vp); if (readonly) { table = new DependenciesPagedTableReadOnly(conf.uuid, null); layout.addRow(table); } else { table = new DependenciesPagedTable( conf.uuid, new OpenItemCommand() { public void open(String path) { showEditor(path); } public void open(MultiViewRow[] rows) { // Do nothing, unsupported } }); layout.addRow(table); } initWidget(layout); }
public VerticalPanel buildUserDetailsDockPanel() { VerticalPanel assignedRolesPanel = buildAssignedRolesPanel(); VerticalPanel mainUserDetailsPanel = new VerticalPanel(); VerticalPanel userPanelFieldsetContent = new VerticalPanel(); userPanelFieldsetContent.setSpacing(4); userPanelFieldsetContent.add(userDetailsPanel); userPanelFieldsetContent.add(updateUserBtn); userPanelFieldsetContent.setCellWidth(userDetailsPanel, "100%"); // $NON-NLS-1$ userPanelFieldsetContent.setCellHorizontalAlignment(updateUserBtn, VerticalPanel.ALIGN_RIGHT); VerticalPanel fieldsetPanel = new VerticalPanel(); fieldsetPanel.add(new Label(Messages.getString("userDetails"))); // $NON-NLS-1$ fieldsetPanel.add(userPanelFieldsetContent); userPanelFieldsetContent.setWidth("100%"); // $NON-NLS-1$ fieldsetPanel.setWidth("100%"); // $NON-NLS-1$ mainUserDetailsPanel.add(fieldsetPanel); mainUserDetailsPanel.setCellWidth(fieldsetPanel, "100%"); // $NON-NLS-1$ SimplePanel spacerPanel = new SimplePanel(); spacerPanel.add(new Label(" ")); // $NON-NLS-1$ mainUserDetailsPanel.add(spacerPanel); mainUserDetailsPanel.setCellHeight(spacerPanel, "10px"); // $NON-NLS-1$ mainUserDetailsPanel.add(assignedRolesPanel); mainUserDetailsPanel.setCellHorizontalAlignment( updateUserBtn, HasHorizontalAlignment.ALIGN_RIGHT); mainUserDetailsPanel.setCellHeight(assignedRolesPanel, "100%"); // $NON-NLS-1$ mainUserDetailsPanel.setCellWidth(assignedRolesPanel, "100%"); // $NON-NLS-1$ userDetailsPanel.setWidth("100%"); // $NON-NLS-1$ assignedRolesPanel.setWidth("100%"); // $NON-NLS-1$ assignedRolesPanel.setHeight("100%"); // $NON-NLS-1$ updateUserBtn.addClickListener(this); return mainUserDetailsPanel; }
@SuppressWarnings("unchecked") public UsersPanel() { // User List Panel VerticalPanel userListPanel = buildUsersListPanel(); userListPanel.setStyleName("borderPane"); // $NON-NLS-1$ // CSS this userListPanel.setSpacing(4); // User Details Panel VerticalPanel userDetailsDockPanel = buildUserDetailsDockPanel(); userDetailsDockPanel.setStyleName("borderPane"); // $NON-NLS-1$ // CSS this userDetailsDockPanel.setSpacing(4); add(userListPanel); add(userDetailsDockPanel); setSpacing(10); setCellWidth(userListPanel, "30%"); // $NON-NLS-1$ setCellWidth(userDetailsDockPanel, "70%"); // $NON-NLS-1$ setCellHeight(userListPanel, "100%"); // $NON-NLS-1$ setCellHeight(userDetailsDockPanel, "100%"); // $NON-NLS-1$ userListPanel.setWidth("100%"); // $NON-NLS-1$ userListPanel.setHeight("100%"); // $NON-NLS-1$ userDetailsDockPanel.setWidth("100%"); // $NON-NLS-1$ userDetailsDockPanel.setHeight("100%"); // $NON-NLS-1$ userDetailsPanel.setEnabled(false); updateUserBtn.setEnabled(false); newUserDialogBox.setCallback( new IDialogCallback() { public void cancelPressed() {} public void okPressed() { if (newUserDialogBox.isUserCreated()) { ProxyPentahoUser newUser = newUserDialogBox.getUser(); IListBoxFilter filter = usersList.getFilter(); if ((filter != null) && !filter.accepts(newUser)) { filterTextBox.setText(""); // $NON-NLS-1$ usersList.setFilter(null); } usersList.addObject(newUser); usersList.setSelectedObject(newUser); userSelectionChanged(); // default roles might have been added; update assigned roles list List<ProxyPentahoRole> roleList = Arrays.asList(UserAndRoleMgmtService.instance().getRoles(newUser)); assignedRolesList.setObjects(roleList); assignedRoleSelectionChanged(); } } }); roleAssignmentsDialog.addPopupListener(this); userDetailsPanel.getUserNameTextBox().setEnabled(false); confirmDeleteUsersDialog.setText(Messages.getString("deleteUsers")); // $NON-NLS-1$ confirmDeleteUsersDialog.setMessage( Messages.getString("confirmUserDeletionMsg")); // $NON-NLS-1$ confirmDeleteUsersDialog.setOnOkHandler( new ICallback() { public void onHandle(Object o) { confirmDeleteUsersDialog.hide(); deleteSelectedUsers(); assignedRoleSelectionChanged(); } }); confirmRemoveRoleAssignmentDialog.setText(Messages.getString("unassignRoles")); // $NON-NLS-1$ confirmRemoveRoleAssignmentDialog.setMessage( Messages.getString("confirmUnassignRolesMsg")); // $NON-NLS-1$ confirmRemoveRoleAssignmentDialog.setOnOkHandler( new ICallback() { public void onHandle(Object o) { confirmRemoveRoleAssignmentDialog.hide(); unassignSelectedRoles(); assignedRoleSelectionChanged(); } }); }
public FindFolderSelectPopup() { // Establishes auto-close when click outside super(false, true); status = new Status(); status.setStyleName("okm-StatusPopup"); vPanel = new VerticalPanel(); vPanel.setWidth("700"); vPanel.setHeight("350"); hPanel = new HorizontalPanel(); scrollFolderPanel = new ScrollPanel(); scrollFolderPanel.setStyleName("okm-Popup-text"); cancelButton = new Button( Main.i18n("button.close"), new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); actionButton = new Button( Main.i18n("search.result.menu.go.folder"), new ClickHandler() { @Override public void onClick(ClickEvent event) { CommonUI.openPath(folderTable.getText(selectedRow, 1), ""); hide(); } }); keyword = new TextBox(); keyword.setWidth("692"); keyword.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (keyword.getText().length() >= 3) { GWTQueryParams gwtParams = new GWTQueryParams(); int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex(); switch (actualView) { case UIDesktopConstants.NAVIGATOR_TAXONOMY: gwtParams.setPath(Main.get().taxonomyRootFolder.getPath()); break; case UIDesktopConstants.NAVIGATOR_TEMPLATES: gwtParams.setPath(Main.get().templatesRootFolder.getPath()); break; case UIDesktopConstants.NAVIGATOR_PERSONAL: gwtParams.setPath(Main.get().personalRootFolder.getPath()); break; case UIDesktopConstants.NAVIGATOR_MAIL: gwtParams.setPath(Main.get().mailRootFolder.getPath()); break; case UIDesktopConstants.NAVIGATOR_TRASH: gwtParams.setPath(Main.get().trashRootFolder.getPath()); break; } gwtParams.setMimeType(""); gwtParams.setKeywords(""); gwtParams.setMimeType(""); gwtParams.setName(keyword.getText() + "*"); // add wildcard at ends gwtParams.setAuthor(""); gwtParams.setMailFrom(""); gwtParams.setMailTo(""); gwtParams.setMailSubject(""); gwtParams.setOperator(GWTQueryParams.OPERATOR_AND); gwtParams.setLastModifiedFrom(null); gwtParams.setLastModifiedTo(null); gwtParams.setDomain(GWTQueryParams.FOLDER); gwtParams.setProperties(new HashMap<String, GWTPropertyParams>()); find(gwtParams); } else { removeAllRows(); } } }); folderTable = new FlexTable(); folderTable.setWidth("100%"); folderTable.setCellPadding(2); folderTable.setCellSpacing(0); folderTable.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { markSelectedRow(folderTable.getCellForEvent(event).getRowIndex()); evaluateEnableAction(); } }); folderTable.addDoubleClickHandler( new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent event) { CommonUI.openPath(folderTable.getText(selectedRow, 1), ""); hide(); } }); scrollFolderPanel.add(folderTable); scrollFolderPanel.setPixelSize(690, 300); vPanel.add(keyword); vPanel.add(scrollFolderPanel); vPanel.add(new HTML("<br>")); hPanel.add(cancelButton); HTML space = new HTML(); space.setWidth("50"); hPanel.add(space); hPanel.add(actionButton); vPanel.add(hPanel); vPanel.add(new HTML("<br>")); vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER); vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE); vPanel.setCellHorizontalAlignment(scrollFolderPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHeight(keyword, "25"); vPanel.setCellHeight(scrollFolderPanel, "300"); cancelButton.setStyleName("okm-NoButton"); actionButton.setStyleName("okm-YesButton"); folderTable.setStyleName("okm-NoWrap"); folderTable.addStyleName("okm-Table-Row"); keyword.setStyleName("okm-Input"); super.hide(); setWidget(vPanel); }
@Override public void onModuleLoad() { GwtApplication.agentInfo = computeAgentInfo(); this.listener = createApplicationListener(); this.config = getConfig(); setApplicationLogger(new GwtApplicationLogger(this.config.log)); addEventListeners(); if (config.rootPanel != null) { this.root = config.rootPanel; } else { Element element = Document.get().getElementById("embed-" + GWT.getModuleName()); if (element == null) { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); RootPanel.get().add(panel); RootPanel.get().setWidth("" + config.width + "px"); RootPanel.get().setHeight("" + config.height + "px"); this.root = panel; } else { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); root = panel; } } // initialize SoundManager2 SoundManager.init( GWT.getModuleBaseURL(), 9, config.preferFlash, new SoundManager.SoundManagerCallback() { @Override public void onready() { final PreloaderCallback callback = getPreloaderCallback(); preloader = createPreloader(); preloader.preload( "assets.txt", new PreloaderCallback() { @Override public void error(String file) { callback.error(file); } @Override public void update(PreloaderState state) { callback.update(state); if (state.hasEnded()) { getRootPanel().clear(); if (loadingListener != null) loadingListener.beforeSetup(); setupLoop(); if (loadingListener != null) loadingListener.afterSetup(); } } }); } @Override public void ontimeout(String status, String errorType) { error("SoundManager", status + " " + errorType); } }); }
public EventEditor(final Admin admin, JSEventTemplate et) { this.admin = admin; this.et = et; vpanel.setWidth("100%"); vpanel.setHeight("100%"); final Label errmsg = new Label(); errmsg.addStyleName(errmsg.getStylePrimaryName() + "-error"); errmsg.addStyleName(errmsg.getStylePrimaryName() + "-bottom"); FlexTable grid = new FlexTable(); grid.setWidth("100%"); CellFormatter cf = grid.getCellFormatter(); // right align field labels cf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_RIGHT); grid.setText(0, 0, "Event Name:"); grid.setText(1, 0, "Raid Size:"); grid.setText(2, 0, "Minimum Level:"); grid.setText(3, 0, "Instance:"); grid.setText(4, 0, "Bosses:"); grid.setText(5, 0, "Roles:"); grid.setText(7, 0, "Badges:"); size.setVisibleLength(2); minlevel.setVisibleLength(2); size.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int sizen = Integer.parseInt(size.getText()); if (sizen < 0) { size.setText("0"); } } catch (NumberFormatException e) { size.setText("25"); } updateRoleTotals(); } }); minlevel.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int minleveln = Integer.parseInt(minlevel.getText()); if (minleveln < 0) { size.setText("0"); } } catch (NumberFormatException e) { size.setText(MAX_LEVEL); } } }); instances.setWidth("100%"); instances.setVisibleItemCount(1); roles.setWidth("100%"); roles.setVisibleItemCount(1); badges.setWidth("100%"); badges.setVisibleItemCount(1); grid.setWidget(0, 1, name); grid.setWidget(1, 1, size); grid.setWidget(2, 1, minlevel); grid.setWidget(3, 1, instances); GoteFarm.goteService.getInstances( admin.current_guild.key, new AsyncCallback<List<JSInstance>>() { public void onSuccess(List<JSInstance> results) { int sel = 0; for (JSInstance i : results) { instances.addItem(i.name, i.key); if (EventEditor.this.et != null && i.key.equals(EventEditor.this.et.instance_key)) { sel = instances.getItemCount() - 1; } } instances.setSelectedIndex(sel); updateBosses(); } public void onFailure(Throwable caught) {} }); instances.addChangeHandler(this); roles.addChangeHandler(this); badges.addChangeHandler(this); grid.setWidget(3, 2, newinst); newinst.setText(NEW_INSTANCE); newinst.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String inst = newinst.getText(); boolean found = false; for (int i = 0; i < instances.getItemCount(); ++i) { if (instances.getItemText(i).equals(inst)) { instances.setSelectedIndex(i); focusBoss(); found = true; break; } } if (!found) { GoteFarm.goteService.addInstance( admin.current_guild.key, inst, new AsyncCallback<JSInstance>() { public void onSuccess(JSInstance result) { instances.addItem(result.name, result.key); instances.setSelectedIndex(instances.getItemCount() - 1); bosses.clear(); focusBoss(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); grid.setWidget(4, 1, bosses); grid.setWidget(4, 2, newboss); bosses.setWidth("100%"); bosses.setVisibleItemCount(10); newboss.setText(NEW_BOSS); newboss.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { int selinst = instances.getSelectedIndex(); if (selinst == -1) { errmsg.setText("You need to select and instance to " + "add a boss."); return; } final String boss = newboss.getText(); boolean found = false; for (int i = 0; i < bosses.getItemCount(); ++i) { if (bosses.getItemText(i).equals(boss)) { bosses.setItemSelected(i, true); focusBoss(); found = true; break; } } if (!found) { GoteFarm.goteService.addBoss( instances.getValue(selinst), boss, new AsyncCallback<JSBoss>() { public void onSuccess(JSBoss result) { bosses.addItem(result.name, result.key); bosses.setItemSelected(bosses.getItemCount() - 1, true); focusBoss(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); grid.setWidget(5, 1, roles); roles.addItem(SELECT_A_ROLE); GoteFarm.goteService.getRoles( admin.current_guild.key, new AsyncCallback<List<JSRole>>() { public void onSuccess(List<JSRole> results) { for (JSRole i : results) { roles.addItem(i.name, i.key); } } public void onFailure(Throwable caught) {} }); grid.setWidget(5, 2, newrole); newrole.setText(NEW_ROLE); newrole.addKeyPressHandler( new KeyPressHandler() { private void focusRole() { newrole.setFocus(true); newrole.setText(NEW_ROLE); newrole.setSelectionRange(0, NEW_ROLE.length()); } public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String role = newrole.getText(); boolean found = false; for (int i = 0; i < roles.getItemCount(); ++i) { if (roles.getItemText(i).equals(role)) { roles.setSelectedIndex(i); addRole(role); focusRole(); found = true; break; } } if (!found) { GoteFarm.goteService.addRole( admin.current_guild.key, role, true, new AsyncCallback<JSRole>() { public void onSuccess(JSRole result) { roles.addItem(role, result.key); roles.setSelectedIndex(roles.getItemCount() - 1); addRole(role); focusRole(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); roleft.setWidth("100%"); roleft.setCellSpacing(0); roleft.setCellPadding(5); roleft.setText(0, 0, "Role"); roleft.setText(0, 1, "Min"); roleft.setText(0, 2, "Max"); roleft.setText(1, 0, "Totals"); FlexTable.FlexCellFormatter rcf = roleft.getFlexCellFormatter(); rcf.addStyleName(0, 0, "header"); rcf.addStyleName(0, 1, "header"); rcf.addStyleName(0, 2, "header"); rcf.addStyleName(0, 3, "header"); rcf.addStyleName(1, 0, "footer"); rcf.addStyleName(1, 1, "footer"); rcf.addStyleName(1, 2, "footer"); rcf.addStyleName(1, 3, "footer"); FlexTable.FlexCellFormatter gcf = grid.getFlexCellFormatter(); grid.setWidget(6, 0, roleft); gcf.setColSpan(6, 0, 3); grid.setWidget(7, 1, badges); badges.addItem(SELECT_A_BADGE); GoteFarm.goteService.getBadges( admin.current_guild.key, new AsyncCallback<List<JSBadge>>() { public void onSuccess(List<JSBadge> results) { for (JSBadge badge : results) { badges.addItem(badge.name, badge.key); } } public void onFailure(Throwable caught) {} }); grid.setWidget(7, 2, newbadge); newbadge.setText(NEW_BADGE); newbadge.addKeyPressHandler( new KeyPressHandler() { private void focusBadge() { newbadge.setFocus(true); newbadge.setText(NEW_BADGE); newbadge.setSelectionRange(0, NEW_BADGE.length()); } public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String badge = newbadge.getText(); boolean found = false; for (int i = 0; i < badges.getItemCount(); ++i) { if (badges.getItemText(i).equals(badge)) { addBadge(badge); focusBadge(); found = true; break; } } if (!found) { GoteFarm.goteService.addBadge( admin.current_guild.key, badge, 0, new AsyncCallback<JSBadge>() { public void onSuccess(JSBadge result) { badges.addItem(badge, result.key); badges.setSelectedIndex(badges.getItemCount() - 1); addBadge(badge); focusBadge(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); badgeft.setWidth("100%"); badgeft.setCellSpacing(0); badgeft.setCellPadding(5); badgeft.setText(0, 0, "Badge"); badgeft.setText(0, 1, "Require For Sign Up"); badgeft.setText(0, 2, "Apply To Role"); badgeft.setText(0, 3, "Num Role Slots"); badgeft.setText(0, 4, "Early Signup (Hours)"); FlexTable.FlexCellFormatter bcf = badgeft.getFlexCellFormatter(); bcf.addStyleName(0, 0, "header"); bcf.addStyleName(0, 1, "header"); bcf.addStyleName(0, 2, "header"); bcf.addStyleName(0, 3, "header"); bcf.addStyleName(0, 4, "header"); bcf.addStyleName(0, 5, "header"); grid.setWidget(8, 0, badgeft); gcf.setColSpan(8, 0, 3); vpanel.add(grid); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); final CheckBox modify = new CheckBox("Modify published events (can change signups)"); modify.setValue(true); modify.addStyleName(modify.getStylePrimaryName() + "-bottom"); modify.addStyleName(modify.getStylePrimaryName() + "-left"); Button save = new Button( "Save", new ClickHandler() { public void onClick(ClickEvent event) { // clear error message errmsg.setText(""); final JSEventTemplate t = new JSEventTemplate(); if (EventEditor.this.et != null) { t.key = EventEditor.this.et.key; } else { t.key = null; } t.name = name.getText(); t.size = getRaidSize(); t.minimumLevel = Integer.parseInt(minlevel.getText()); int index = instances.getSelectedIndex(); if (index < 0) { errmsg.setText("Please select an instance for this event."); return; } t.instance_key = instances.getValue(index); t.boss_keys = new ArrayList<String>(); for (int i = 0; i < bosses.getItemCount(); ++i) { if (bosses.isItemSelected(i)) { t.boss_keys.add(bosses.getValue(i)); } } t.roles = new ArrayList<JSEventRole>(); for (int i = 0; i < roleft.getRowCount() - 2; ++i) { JSEventRole er = new JSEventRole(); er.name = roleft.getText(i + 1, 0); er.role_key = getRoleKey(er.name); TextBox minmax; minmax = (TextBox) roleft.getWidget(i + 1, 1); er.min = Integer.parseInt(minmax.getText()); minmax = (TextBox) roleft.getWidget(i + 1, 2); er.max = Integer.parseInt(minmax.getText()); t.roles.add(er); } t.badges = new ArrayList<JSEventBadge>(); for (int i = 0; i < badgeft.getRowCount() - 1; ++i) { JSEventBadge eb = new JSEventBadge(); eb.name = badgeft.getText(i + 1, 0); eb.badge_key = getBadgeKey(eb.name); CheckBox cb = (CheckBox) badgeft.getWidget(i + 1, 1); eb.requireForSignup = cb.getValue(); ListBox lb = (ListBox) badgeft.getWidget(i + 1, 2); String role = lb.getItemText(lb.getSelectedIndex()); if (!role.equals(ALL_ROLES)) { eb.applyToRole = role; } TextBox tb; tb = (TextBox) badgeft.getWidget(i + 1, 3); eb.numSlots = Integer.parseInt(tb.getText()); tb = (TextBox) badgeft.getWidget(i + 1, 4); eb.earlySignup = Integer.parseInt(tb.getText()); t.badges.add(eb); } t.modifyEvents = modify.getValue(); GoteFarm.goteService.saveEventTemplate( admin.current_guild.key, t, new AsyncCallback<JSEventTemplate>() { public void onSuccess(JSEventTemplate result) { EventEditor.this.admin.eventAdded(); EventEditor.this.admin.setCenterWidget(null); if (t.key != null && t.modifyEvents) { admin.fireAdminChange(AdminChange.getEventsChanged()); } } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } }); save.addStyleName(save.getStylePrimaryName() + "-bottom"); save.addStyleName(save.getStylePrimaryName() + "-left"); Button cancel = new Button( "Cancel", new ClickHandler() { public void onClick(ClickEvent event) { EventEditor.this.admin.setCenterWidget(null); } }); cancel.addStyleName(cancel.getStylePrimaryName() + "-bottom"); cancel.addStyleName(cancel.getStylePrimaryName() + "-right"); hpanel.add(save); // Editing an existing event? if (EventEditor.this.et != null) { hpanel.add(modify); } hpanel.add(errmsg); hpanel.add(cancel); vpanel.add(hpanel); if (et != null) { for (JSEventRole ev : et.roles) { addRole(ev.name, ev.min, ev.max); } for (JSEventBadge eb : et.badges) { addBadge(eb.name, eb.requireForSignup, eb.applyToRole, eb.numSlots, eb.earlySignup); } } if (et == null) { name.setText(NEW_EVENT); DeferredCommand.addCommand( new Command() { public void execute() { name.setFocus(true); name.setSelectionRange(0, NEW_EVENT.length()); } }); size.setText("25"); minlevel.setText(MAX_LEVEL); } else { name.setText(et.name); size.setText("" + et.size); minlevel.setText("" + et.minimumLevel); } updateRoleTotals(); initWidget(vpanel); setStyleName("Admin-EventEditor"); }
private ScrollPanel getPanelForXML(String text) { String carriageReturn_LineFeed = "\r\n"; final FlowPanel flowPanel = new FlowPanel(); final ScrollPanel scrollPanel = new ScrollPanel(); String lines[] = text.split("\\r?\\n"); String stringBuilder = new String(); for (int i = 0; i < lines.length; i++) { String line = lines[i]; if (line.trim().startsWith("<criteriaReference")) { TextArea textArea = new TextArea(); textArea.setStyleName("textarea_noborder"); textArea.setText(stringBuilder); flowPanel.add(textArea); textArea.setReadOnly(true); textArea.setWidth("100%"); textArea.setHeight("100%"); textArea.setVisibleLines(getLineCount(stringBuilder) + 1); makeBookMarks(flowPanel, textArea); stringBuilder = new String(); // find more lines until the end tag </criteriaReference> String critRefStringBuilder = new String(); while (!line.trim().startsWith("</criteriaReference>")) { critRefStringBuilder += (carriageReturn_LineFeed + line); i++; line = lines[i]; } if (line.trim().startsWith("</criteriaReference>")) { critRefStringBuilder += (carriageReturn_LineFeed + line); createCritRefTextArea(flowPanel, scrollPanel, critRefStringBuilder); } } else { String cleanLine = line.trim().replaceAll("<!--.*?-->", ""); if (cleanLine.trim().startsWith("<entry")) { if (stringBuilder.length() > 0) { TextArea textArea = new TextArea(); textArea.setStyleName("textarea_noborder"); textArea.setEnabled(false); textArea.setWidth("100%"); textArea.setHeight("100%"); textArea.setText(stringBuilder); flowPanel.add(textArea); textArea.setVisibleLines(getLineCount(stringBuilder) + 1); makeBookMarks(flowPanel, textArea); } stringBuilder = new String(); // find more lines until the end tag </criteriaReference> String entryStringBuilder = new String(); while (!line.trim().startsWith("</entry>")) { entryStringBuilder += (carriageReturn_LineFeed + line); i++; line = lines[i]; } if (line.trim().startsWith("</entry>")) { entryStringBuilder += (carriageReturn_LineFeed + line); createEntryTextArea(flowPanel, entryStringBuilder, scrollPanel); } } else { stringBuilder += (carriageReturn_LineFeed + line); } } } if (stringBuilder.trim().length() > 0) { TextArea textArea = new TextArea(); textArea.setStyleName("textarea_noborder"); textArea.setText(stringBuilder); flowPanel.add(textArea); textArea.setReadOnly(true); textArea.setWidth("100%"); textArea.setHeight("100%"); textArea.setVisibleLines(getLineCount(stringBuilder) + 1); makeBookMarks(flowPanel, textArea); } VerticalPanel vPanel = new VerticalPanel(); vPanel.setWidth("100%"); vPanel.setHeight("100%"); vPanel.add(flowPanel); scrollPanel.add(vPanel); return scrollPanel; }
public LAgentDatabasePanel(IDomeo domeo) { _domeo = domeo; initWidget(binder.createAndBindUi(this)); body.setHeight("100%"); }
@Override public void onModuleLoad() { this.agentInfo = computeAgentInfo(); this.listener = getApplicationListener(); this.config = getConfig(); if (config.rootPanel != null) { this.root = config.rootPanel; } else { Element element = Document.get().getElementById("embed-" + GWT.getModuleName()); if (element == null) { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); RootPanel.get().add(panel); RootPanel.get().setWidth("" + config.width + "px"); RootPanel.get().setHeight("" + config.height + "px"); this.root = panel; } else { VerticalPanel panel = new VerticalPanel(); panel.setWidth("" + config.width + "px"); panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); root = panel; } } // initialize SoundManager2 SoundManager.init(GWT.getModuleBaseURL(), 9); // wait for soundmanager to load, this is fugly, but for // some reason the ontimeout and onerror callbacks are never // called (function instanceof Function fails, wtf JS?). new Timer() { @Override public void run() { if (SoundManager.swfLoaded()) { final PreloaderCallback callback = getPreloaderCallback(); preloader = new Preloader(); preloader.preload( "assets.txt", new PreloaderCallback() { @Override public void loaded(String file, int loaded, int total) { callback.loaded(file, loaded, total); } @Override public void error(String file) { callback.error(file); } @Override public void done() { callback.done(); root.clear(); setupLoop(); } }); cancel(); } } }.scheduleRepeating(100); }
public ViewHTMLRenderDialog(String html) { // Set the dialog box's caption. setText(LocaleMessages.LANG.information()); // Enable animation. setAnimationEnabled(false); // Enable glass background. setGlassEnabled(true); // Label label = new Label("Consulta enviada al servidor"); final Hidden user = new Hidden(); final Hidden password = new Hidden(); user.setName("user"); user.setValue(ApplicationContext.getAuth().getUser()); password.setValue(ApplicationContext.getAuth().getPass()); password.setName("password"); Button ok = new Button(LocaleMessages.LANG.accept()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ViewHTMLRenderDialog.this.hide(); } }); VerticalPanel panel = new VerticalPanel(); HTMLPanel htmlPanel = new HTMLPanel(html); panel.setHeight("500px"); panel.setWidth("800px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); panel.add(htmlPanel); panel.add(ok); panel.add(user); panel.add(password); final FormPanel form = new FormPanel(); form.setAction("BPMConsoleApp/complete"); form.setHeight("475px"); form.setWidth("800px"); form.addSubmitHandler( new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. // We can take this opportunity to perform validation. // event.cancel(); } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // When the form submission is successfully completed, // this event is fired. Assuming the service returned // a response of type text/html, we can get the result // here. // Window.alert(event.getResults()); } }); form.add(panel); setWidget(form); }
/** @param repositoryFile */ public ImportDialog(RepositoryFile repositoryFile, boolean allowAdvancedDialog) { super( Messages.getString("import"), Messages.getString("ok"), Messages.getString("cancel"), false, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ form = new FormPanel(); form.addSubmitHandler( new SubmitHandler() { @Override public void onSubmit(SubmitEvent se) { // if no file is selected then do not proceed okButton.setEnabled(false); cancelButton.setEnabled(false); MantleApplication.showBusyIndicator( Messages.getString("pleaseWait"), Messages.getString("importInProgress")); } }); form.addSubmitCompleteHandler( new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent sce) { MantleApplication.hideBusyIndicator(); okButton.setEnabled(false); cancelButton.setEnabled(true); ImportDialog.this.hide(); String result = sce.getResults(); if (result.length() > 5) { HTML messageTextBox = null; if (result.contains("INVALID_MIME_TYPE") == true) { messageTextBox = new HTML(Messages.getString("uploadInvalidFileTypeQuestion", result)); } else { logWindow(result, Messages.getString("importLogWindowTitle")); } if (messageTextBox != null) { PromptDialogBox dialogBox = new PromptDialogBox( Messages.getString("uploadUnsuccessful"), Messages.getString("close"), null, true, true); dialogBox.setContent(messageTextBox); dialogBox.center(); } } // if mantle_isBrowseRepoDirty=true: do getChildren call // if mantle_isBrowseRepoDirty=false: use stored fileBrowserModel in // myself.get("cachedData") setBrowseRepoDirty(Boolean.TRUE); // BISERVER-9319 Refresh browse perspective after import final GenericEvent event = new GenericEvent(); event.setEventSubType("ImportDialogEvent"); EventBusUtil.EVENT_BUS.fireEvent(event); } }); VerticalPanel rootPanel = new VerticalPanel(); VerticalPanel spacer = new VerticalPanel(); spacer.setHeight("10px"); rootPanel.add(spacer); Label fileLabel = new Label(Messages.getString("file") + ":"); final TextBox importDir = new TextBox(); rootPanel.add(fileLabel); okButton.setEnabled(false); final TextBox fileTextBox = new TextBox(); fileTextBox.setHeight("26px"); fileTextBox.setEnabled(false); // We use an fileNameOverride because FileUpload can only handle US character set reliably. final Hidden fileNameOverride = new Hidden("fileNameOverride"); final FileUpload upload = new FileUpload(); upload.setName("fileUpload"); ChangeHandler fileUploadHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { fileTextBox.setText(upload.getFilename()); if (!"".equals(importDir.getValue())) { // Set the fileNameOverride because the fileUpload object can only reliably transmit // US-ASCII // character set. See RFC283 section 2.3 for details String fileNameValue = upload.getFilename().replaceAll("\\\\", "/"); fileNameValue = fileNameValue.substring(fileNameValue.lastIndexOf("/") + 1); fileNameOverride.setValue(fileNameValue); okButton.setEnabled(true); } else { okButton.setEnabled(false); } } }; upload.addChangeHandler(fileUploadHandler); upload.setVisible(false); HorizontalPanel fileUploadPanel = new HorizontalPanel(); fileUploadPanel.add(fileTextBox); fileUploadPanel.add(new HTML(" ")); Button browseButton = new Button(Messages.getString("browse") + "..."); browseButton.setStyleName("pentaho-button"); fileUploadPanel.add(browseButton); browseButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { setRetainOwnershipState(); jsClickUpload(upload.getElement()); } }); rootPanel.add(fileUploadPanel); rootPanel.add(upload); applyAclPermissions.setName("applyAclPermissions"); applyAclPermissions.setValue(Boolean.FALSE); applyAclPermissions.setFormValue("false"); applyAclPermissions.setEnabled(true); applyAclPermissions.setVisible(false); final CheckBox overwriteAclPermissions = new CheckBox(Messages.getString("overwriteAclPermissions"), true); overwriteAclPermissions.setName("overwriteAclPermissions"); applyAclPermissions.setValue(Boolean.FALSE); applyAclPermissions.setFormValue("false"); overwriteAclPermissions.setEnabled(true); overwriteAclPermissions.setVisible(false); final Hidden overwriteFile = new Hidden("overwriteFile"); overwriteFile.setValue("true"); final Hidden logLevel = new Hidden("logLevel"); logLevel.setValue("ERROR"); final Hidden retainOwnership = new Hidden("retainOwnership"); retainOwnership.setValue("true"); rootPanel.add(applyAclPermissions); rootPanel.add(overwriteAclPermissions); rootPanel.add(overwriteFile); rootPanel.add(logLevel); rootPanel.add(retainOwnership); rootPanel.add(fileNameOverride); spacer = new VerticalPanel(); spacer.setHeight("4px"); rootPanel.add(spacer); DisclosurePanel disclosurePanel = new DisclosurePanel(Messages.getString("advancedOptions")); disclosurePanel.getHeader().setStyleName("gwt-Label"); disclosurePanel.setVisible(allowAdvancedDialog); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(new HTML(" ")); VerticalPanel disclosureContent = new VerticalPanel(); HTML replaceLabel = new HTML(Messages.getString("fileExists")); replaceLabel.setStyleName("gwt-Label"); disclosureContent.add(replaceLabel); final CustomListBox overwriteFileDropDown = new CustomListBox(); final CustomListBox filePermissionsDropDown = new CustomListBox(); DefaultListItem replaceListItem = new DefaultListItem(Messages.getString("replaceFile")); replaceListItem.setValue("true"); overwriteFileDropDown.addItem(replaceListItem); DefaultListItem doNotImportListItem = new DefaultListItem(Messages.getString("doNotImport")); doNotImportListItem.setValue("false"); overwriteFileDropDown.addItem(doNotImportListItem); overwriteFileDropDown.setVisibleRowCount(1); disclosureContent.add(overwriteFileDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); HTML filePermissionsLabel = new HTML(Messages.getString("filePermissions")); filePermissionsLabel.setStyleName("gwt-Label"); disclosureContent.add(filePermissionsLabel); DefaultListItem usePermissionsListItem = new DefaultListItem(Messages.getString("usePermissions")); usePermissionsListItem.setValue("false"); filePermissionsDropDown.addItem( usePermissionsListItem); // If selected set "overwriteAclPermissions" to // false. DefaultListItem retainPermissionsListItem = new DefaultListItem(Messages.getString("retainPermissions")); retainPermissionsListItem.setValue("true"); filePermissionsDropDown.addItem( retainPermissionsListItem); // If selected set "overwriteAclPermissions" to // true. final ChangeListener filePermissionsHandler = new ChangeListener() { @Override public void onChange(Widget sender) { String value = filePermissionsDropDown.getSelectedItem().getValue().toString(); applyAclPermissions.setValue(Boolean.valueOf(value)); applyAclPermissions.setFormValue(value); overwriteAclPermissions.setFormValue(value); overwriteAclPermissions.setValue(Boolean.valueOf(value)); setRetainOwnershipState(); } }; filePermissionsDropDown.addChangeListener(filePermissionsHandler); filePermissionsDropDown.setVisibleRowCount(1); disclosureContent.add(filePermissionsDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); HTML fileOwnershipLabel = new HTML(Messages.getString("fileOwnership")); fileOwnershipLabel.setStyleName("gwt-Label"); disclosureContent.add(fileOwnershipLabel); retainOwnershipDropDown.addChangeListener( new ChangeListener() { @Override public void onChange(Widget sender) { String value = retainOwnershipDropDown.getSelectedItem().getValue().toString(); retainOwnership.setValue(value); } }); DefaultListItem keepOwnershipListItem = new DefaultListItem(Messages.getString("keepOwnership")); keepOwnershipListItem.setValue("true"); retainOwnershipDropDown.addItem(keepOwnershipListItem); DefaultListItem assignOwnershipListItem = new DefaultListItem(Messages.getString("assignOwnership")); assignOwnershipListItem.setValue("false"); retainOwnershipDropDown.addItem(assignOwnershipListItem); retainOwnershipDropDown.setVisibleRowCount(1); disclosureContent.add(retainOwnershipDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); ChangeListener overwriteFileHandler = new ChangeListener() { @Override public void onChange(Widget sender) { String value = overwriteFileDropDown.getSelectedItem().getValue().toString(); overwriteFile.setValue(value); } }; overwriteFileDropDown.addChangeListener(overwriteFileHandler); HTML loggingLabel = new HTML(Messages.getString("logging")); loggingLabel.setStyleName("gwt-Label"); disclosureContent.add(loggingLabel); final CustomListBox loggingDropDown = new CustomListBox(); loggingDropDown.addChangeListener( new ChangeListener() { public void onChange(Widget sender) { String value = loggingDropDown.getSelectedItem().getValue().toString(); logLevel.setValue(value); } }); DefaultListItem noneListItem = new DefaultListItem(Messages.getString("none")); noneListItem.setValue("ERROR"); loggingDropDown.addItem(noneListItem); DefaultListItem shortListItem = new DefaultListItem(Messages.getString("short")); shortListItem.setValue("WARN"); loggingDropDown.addItem(shortListItem); DefaultListItem debugListItem = new DefaultListItem(Messages.getString("verbose")); debugListItem.setValue("TRACE"); loggingDropDown.addItem(debugListItem); loggingDropDown.setVisibleRowCount(1); disclosureContent.add(loggingDropDown); mainPanel.add(disclosureContent); disclosurePanel.setContent(mainPanel); rootPanel.add(disclosurePanel); importDir.setName("importDir"); importDir.setText(repositoryFile.getPath()); importDir.setVisible(false); rootPanel.add(importDir); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); setFormAction(); form.add(rootPanel); setContent(form); }