com.google.gwt.view.client.SelectionChangeEvent Java Examples

The following examples show how to use com.google.gwt.view.client.SelectionChangeEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerConfigView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void updateFrom(MailSession session) {
    this.session = session;
    headline.setText("Mail Session: " + session.getName());


    List<MailServerDefinition> server = new ArrayList<>();
    if (session.getImapServer() != null) {
        server.add(session.getImapServer());
    }

    if (session.getSmtpServer() != null) {
        server.add(session.getSmtpServer());
    }

    if (session.getPopServer() != null) {
        server.add(session.getPopServer());
    }

    dataProvider.setList(server);
    mailFormAsset.getForm().clearValues();
    credentialReferenceFormAsset.getForm().clearValues();
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #2
Source File: MaterialStepper.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
/**
 * Called internally when the index is changed. Fires a {@link SelectionChangeEvent}
 * when the current index changes.
 */
protected void setCurrentStepIndex(int currentStepIndex) {
    if (this.currentStepIndex != currentStepIndex) {
        this.currentStepIndex = currentStepIndex;
        SelectionChangeEvent.fire(this);
    }

}
 
Example #3
Source File: ServerConfigDetails.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void bind(final DefaultCellTable table) {
    form.bind(table);

    table.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            final Server server = ((SingleSelectionModel<Server>) table.getSelectionModel()).getSelectedObject();
            if(server!=null && "".equals(server.getSocketBinding()))
            {
                // preselect inherited socket binding value
                for(final ServerGroupRecord group : groups)
                {
                    if(group.getName().equals(server.getGroup()))
                    {
                        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                            @Override
                            public void execute() {
                                socketItem.setValue(group.getSocketBinding());
                            }
                        });
                        break;
                    }
                }
            }
        }
    });
}
 
Example #4
Source File: DeploymentScannerView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void update(final List<Property> scanners) {
    dataProvider.setList(scanners);
    if (scanners.isEmpty()) {
        selectionModel.clear();
    } else {
        table.selectDefaultEntity();
        SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
    }
}
 
Example #5
Source File: IOPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(final List<Property> models) {
    dataProvider.setList(models);
    if (models.isEmpty()) {
        selectionModel.clear();
    } else {
        table.selectDefaultEntity();
    }
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #6
Source File: IOPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected Widget buildFormPanel(final ResourceDescription definition, SecurityContext securityContext) {
    final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
            .setConfigOnly()
            .setResourceDescription(definition)
            .setSecurityContext(securityContext).build();
    formAssets.getForm().setToolsCallback(new FormCallback() {
        @Override
        public void onSave(Map changeSet) {
            IOPanel.this.onModify(selectionModel.getSelectedObject().getName(),
                    formAssets.getForm().getChangedValues());
        }

        @Override
        public void onCancel(Object entity) {
            formAssets.getForm().cancel();
        }
    });

    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            Property worker = selectionModel.getSelectedObject();
            if (worker != null) {
                formAssets.getForm().edit(worker.getValue());
            } else {
                formAssets.getForm().clearValues();
            }
        }
    });

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.setStyleName("fill-layout-width");
    formPanel.add(formAssets.getHelp().asWidget());
    formPanel.add(formAssets.getForm().asWidget());

    return formPanel;
}
 
Example #7
Source File: FilterEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void updateValuesFromModel(List<Property> filters) {
    dataProvider.setList(filters);
    table.selectDefaultEntity();
    if (filters.isEmpty()) {
        selectionModel.clear();
        formAssets.getForm().clearValues();
    }
    SelectionChangeEvent.fire(selectionModel);

}
 
Example #8
Source File: ApplicationSecurityDomainResourceView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(final List<Property> models) {
    dataProvider.setList(models);
    table.selectDefaultEntity();
    if (models.isEmpty()) {
        formAttributesAssets.getForm().clearValues();
        selectionModel.clear();
    }
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #9
Source File: BridgesList.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setBridges(List<ActivemqBridge> bridges) {
    dataProvider.setList(bridges);
    serverName.setText("Bridges: Provider " + presenter.getCurrentServer());
    table.selectDefaultEntity();
    credentialRefFormAsset.getForm().clearValues();
    defaultAttributes.getForm().clearValues();
    connectionAttributes.getForm().clearValues();
    if (bridges.size() == 0)
        selectionModel.clear();
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #10
Source File: GenericResourceView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(final List<Property> models) {
    headerLabel.setText(title + ": Provider " + presenter.getCurrentServer());
    dataProvider.setList(models);
    table.selectDefaultEntity();
    if (models.isEmpty()) {
        modelForm.getForm().clearValues();
        selectionModel.clear();
    }
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #11
Source File: ServiceViewTemplate.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setData(List<Property> data) {
    if(selectionModel!=null) {
        dataProvider.setList(data);
        table.selectDefaultEntity();
        SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
    }
}
 
Example #12
Source File: ElytronGenericResourceView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(final List<Property> models) {
    dataProvider.setList(models);
    if (models.isEmpty()) {
        modelForm.getForm().clearValues();
        selectionModel.clear();
    }
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #13
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the scrollable list of cells each of which serves as a link to a template.
 *
 * @param list an ArrayList of TemplateInfo
 * @return A CellList widget
 */
public CellList<TemplateInfo> makeTemplateSelector(ArrayList<TemplateInfo> list) {
  TemplateCell templateCell = new TemplateCell(list.get(0), templateHostUrl);

  CellList<TemplateInfo> templateCellList = new CellList<TemplateInfo>(templateCell,TemplateInfo.KEY_PROVIDER);
  templateCellList.setPageSize(list.size() + 10);
  templateCellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
  templateCellList.setWidth("250px");
  templateCellList.setHeight("355px");
  templateCellList.setVisible(true);
  templateCellList.getElement().getStyle().setOverflowY(Style.Overflow.SCROLL);

  // Add a selection model to handle user selection.
  final SingleSelectionModel<TemplateInfo> selectionModel =
    new SingleSelectionModel<TemplateInfo>(TemplateInfo.KEY_PROVIDER);
  templateCellList.setSelectionModel(selectionModel);
  selectionModel.setSelected(list.get(0), true);
  final TemplateUploadWizard wizard = this;
  selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
      public void onSelectionChange(SelectionChangeEvent event) {
        TemplateInfo selected = selectionModel.getSelectedObject();
        if (selected != null) {
          selectedTemplateNAME = selected.name;
          TemplateWidget.setTemplate(selected, wizard.getTemplateUrlHost());
        }
      }
    });

  // Set the total row count. This isn't strictly necessary, but it affects
  // paging calculations, so its good habit to keep the row count up to date.
  templateCellList.setRowCount(list.size(), true);

  // Push the data into the widget.
  templateCellList.setRowData(0, list);
  return templateCellList;
}
 
Example #14
Source File: PropertiesRealmView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void update(final List<Property> models) {
    dataProvider.setList(models);
    table.selectDefaultEntity();
    if (models.isEmpty()) {
        modelFormAsset.getForm().clearValues();
        groupsPropertiesFormAssets.getForm().clearValues();
        usersPropertiesFormAssets.getForm().clearValues();
        selectionModel.clear();
    }
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #15
Source File: LdapRealmView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void update(final List<Property> models) {
    dataProvider.setList(models);
    table.selectDefaultEntity();
    if (models.isEmpty()) {
        modelForm.getForm().clearValues();
        selectionModel.clear();
        identityMappingFormAsset.getForm().clearValues();
        identityAttributeMappingView.clearValues();
        newIdentityAttributesView.clearValues();
        userPasswordMapperFormAsset.getForm().clearValues();
        otpCredentialMapperFormAsset.getForm().clearValues();
    }
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #16
Source File: JdbcRealmView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void update(final List<Property> models) {
    dataProvider.setList(models);
    table.selectDefaultEntity();
    if (models.isEmpty()) {
        principalsQueryViewView.clearValues();
        selectionModel.clear();
    }
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #17
Source File: PolicyView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(List<Property> models) {
    dataProvider.setList(models);
    addButton.setEnabled(models.isEmpty());
    if (models.isEmpty()) {
        forms.showWidget(0);
        customPolicyForm.getForm().clearValues();
        jaccPolicyForm.getForm().clearValues();
        selectionModel.clear();
    }
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #18
Source File: SimplePermissionMappingEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void update(Property prop) {
    permissionMapping = prop.getName();
    if (prop.getValue().hasDefined("permission-mappings")) {
        List<ModelNode> models = prop.getValue().get("permission-mappings").asList();
        table.setRowCount(models.size(), true);

        List<ModelNode> dataList = dataProvider.getList();
        dataList.clear(); // cannot call setList() as that breaks the sort handler
        dataList.addAll(models);
    } else {
        clearValues();
    }
    selectionModel.clear();
    SelectionChangeEvent.fire(selectionModel);
}
 
Example #19
Source File: ApplicationSecurityDomainView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #20
Source File: ThreadPoolView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #21
Source File: PassivationView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #22
Source File: MasterDetailPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void update(final List<Property> models) {
    dataProvider.setList(models);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #23
Source File: BeanPoolView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #24
Source File: CategoryView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #25
Source File: CachesView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setData(List<Property> data) {
    dataProvider.setList(data);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel); // updates ModelNodeForm's editedEntity with current value
}
 
Example #26
Source File: MaterialStepperTest.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
protected void checkSelection(MaterialStepper stepper) {
    final boolean[] isSelectionFired = {false};
    stepper.addSelectionChangeHandler(event -> isSelectionFired[0] = true);
    SelectionChangeEvent.fire(stepper);
    assertTrue(isSelectionFired[0]);
}
 
Example #27
Source File: MaterialStepper.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addSelectionChangeHandler(final Handler handler) {
    return addHandler(handler, SelectionChangeEvent.getType());
}
 
Example #28
Source File: ComboPicker.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ComboPicker(String cssSuffix) {

        cellList = new CellList<String>(new TextCell()
        {
            @Override
            public void render(Context context, String data, SafeHtmlBuilder sb) {
                String cssName = (context.getIndex() %2 > 0) ? "combobox-item combobox-item-odd" : "combobox-item";

                if(data.equals(displayed.getActual()))
                    cssName+=" combobox-item-selected";

                sb.append(TEMPLATE.item(cssName, data));
            }

        });

        cellList.setPageSize(100);

        final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
        cellList.setSelectionModel(selectionModel);

        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
            public void onSelectionChange(SelectionChangeEvent event) {
                String selectedValue = selectionModel.getSelectedObject();

                setDisplayedValue(selectedValue);
                popup.hide();

                onSelection(selectedValue);
            }
        });

        final String panelId = "combopicker_popup";
        popup = new PopupPanel(true, true) {

            @Override
            protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
                if (Event.ONKEYUP == event.getTypeInt()) {
                    if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                        // Dismiss when escape is pressed
                        popup.hide();
                    }
                }
            }

            public void onBrowserEvent(Event event) {
                super.onBrowserEvent(event);
            }
        };

        popup.getElement().setId(panelId);

        popup.setStyleName("default-popup");

        popup.addStyleName("triangle-border");
        popup.addStyleName("top-left");

        popup.setWidget(new ScrollPanel(cellList));

        displayed = new Display("");

        header = new HorizontalPanel();
        header.setStyleName("combobox"+cssSuffix);
        header.add(displayed);

        HTML icon = new HTML("<span style='font-size:12px;cursor:pointer'><i class='icon-chevron-down'></i></span>");
        header.add(icon);

        displayed.getElement().getParentElement().setAttribute("width", "100%");

        icon.getParent().getElement().setAttribute("width", "18");

        //header.getElement().setAttribute("width", "95%");
        header.getElement().setAttribute("cellspacing", "0");
        header.getElement().setAttribute("cellpadding", "0");
        header.getElement().setAttribute("border", "0");


        ClickHandler clickHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                openPanel();
            }
        };

        displayed.addClickHandler(clickHandler);
        icon.addClickHandler(clickHandler);

    }
 
Example #29
Source File: FinderColumn.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void addSelectionChangeHandler(SelectionChangeEvent.Handler handler) {
    selectionModel.addSelectionChangeHandler(handler);
}
 
Example #30
Source File: HostJVMView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void updateModel(List<Property> jvms) {
    dataProvider.setList(jvms);
    table.selectDefaultEntity();
    SelectionChangeEvent.fire(selectionModel);
}