com.google.gwt.cell.client.TextCell Java Examples

The following examples show how to use com.google.gwt.cell.client.TextCell. 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: ConnectorServiceList.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();

    table = new DefaultCellTable<>(10, ActivemqConnectorService::getName);

    provider = new ListDataProvider<>();
    provider.addDataDisplay(table);

    Column<ActivemqConnectorService, String> name = new Column<ActivemqConnectorService, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqConnectorService object) {
            return object.getName();
        }
    };

    table.addColumn(name, "Name");

    ToolStrip tools = new ToolStrip();
    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_add(),
                    clickEvent -> presenter.launchNewConnectorServiceWizard()));

    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm(
                    Console.MESSAGES.deleteTitle("ConnectorService"),
                    Console.MESSAGES.deleteConfirm("ConnectorService " + getSelectedEntity().getName()),
                    isConfirmed -> {
                        if (isConfirmed) {
                            presenter.onDeleteConnectorService(getSelectedEntity());
                        }
                    })));

    connectorServiceForm = new ConnectorServiceForm(presenter,
            new FormToolStrip.FormCallback<ActivemqConnectorService>() {
                @Override
                public void onSave(Map<String, Object> changeset) {
                    presenter.onSaveConnectorService(getSelectedEntity(), changeset);
                }

                @Override
                public void onDelete(ActivemqConnectorService entity) {
                }
            });

    properties = new PropertyEditor(presenter, true);

    MultipleToOneLayout layout = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(Console.CONSTANTS.jmsConnectorServiceDescription())
            .setMaster(Console.MESSAGES.available("Services"), table)
            .setMasterTools(tools)
            .addDetail(Console.CONSTANTS.common_label_details(), connectorServiceForm.asWidget())
            .addDetail(Console.CONSTANTS.common_label_properties(), properties.asWidget());

    connectorServiceForm.getForm().bind(table);

    table.getSelectionModel().addSelectionChangeHandler(selectionChangeEvent -> {
        List<PropertyRecord> props = getSelectedEntity().getParameter();

        String tokens = "connector-service_#_" + getSelectedEntity().getName();
        properties.setProperties(tokens, props);
    });

    return layout.build();

}
 
Example #2
Source File: ConnectorList.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();

    table = new DefaultCellTable<>(10, ActivemqConnector::getName);
    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);

    provider = new ListDataProvider<>();
    provider.addDataDisplay(table);

    Column<ActivemqConnector, String> name = new Column<ActivemqConnector, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqConnector object) {
            return object.getName();
        }
    };

    table.addColumn(name, "Name");

    ToolStrip tools = new ToolStrip();
    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_add(),
                    clickEvent -> presenter.launchNewConnectorWizard(type)));

    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Connector"),
                    Console.MESSAGES.deleteConfirm("Connector " + getSelectedEntity().getSocketBinding()),
                    isConfirmed -> {
                        if (isConfirmed) {
                            presenter.onDeleteConnector(getSelectedEntity());
                        }
                    })));

    connectorForm = new ConnectorForm(presenter, new FormToolStrip.FormCallback<ActivemqConnector>() {
        @Override
        public void onSave(Map<String, Object> changeset) {
            presenter.onSaveConnector(getSelectedEntity(), changeset);
        }

        @Override
        public void onDelete(ActivemqConnector entity) {}
    }, type);

    properties = new PropertyEditor(presenter, true);

    VerticalPanel layout = new VerticalPanel();
    layout.add(tools);
    layout.add(table);
    layout.add(pager);

    connectorForm.getForm().bind(table);

    TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");
    tabs.getElement().setAttribute("style", "margin-top:15px;");
    tabs.addStyleName("master_detail-detail");

    tabs.add(connectorForm.asWidget(), Console.CONSTANTS.common_label_details());
    tabs.add(properties.asWidget(), Console.CONSTANTS.common_label_properties());

    layout.add(tabs);
    tabs.selectTab(0);

    table.getSelectionModel().addSelectionChangeHandler(selectionChangeEvent -> {
        List<PropertyRecord> props = getSelectedEntity().getParameter();
        String tokens = getSelectedEntity().getType().getResource() + "_#_" + getSelectedEntity().getName();
        properties.setProperties(tokens, props);
    });

    return layout;
}
 
Example #3
Source File: AcceptorList.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();
    table = new DefaultCellTable<>(10, ActivemqAcceptor::getName);
    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);

    provider = new ListDataProvider<>();
    provider.addDataDisplay(table);

    Column<ActivemqAcceptor, String> name = new Column<ActivemqAcceptor, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqAcceptor object) {
            return object.getName();
        }
    };
    table.addColumn(name, "Name");

    ToolStrip tools = new ToolStrip();
    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_add(),
                    clickEvent -> presenter.launchNewAcceptorWizard(type)));

    tools.addToolButtonRight(
            new ToolButton(Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Acceptor"),
                    Console.MESSAGES.deleteConfirm("Acceptor " + getSelectedEntity().getSocketBinding()),
                    isConfirmed -> {
                        if (isConfirmed) {
                            presenter.onDeleteAcceptor(getSelectedEntity());
                        }
                    })));

    acceptorForm = new AcceptorForm(presenter, new FormToolStrip.FormCallback<ActivemqAcceptor>() {
        @Override
        public void onSave(Map<String, Object> changeset) {
            presenter.onSaveAcceptor(getSelectedEntity(), changeset);
        }

        @Override
        public void onDelete(ActivemqAcceptor entity) {}
    }, type);

    properties = new PropertyEditor(presenter, true);

    VerticalPanel layout = new VerticalPanel();
    layout.add(tools);
    layout.add(table);
    layout.add(pager);

    acceptorForm.getForm().bind(table);

    TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");
    tabs.addStyleName("master_detail-detail");
    tabs.getElement().setAttribute("style", "margin-top:15px;");

    tabs.add(acceptorForm.asWidget(), Console.CONSTANTS.common_label_details());
    tabs.add(properties.asWidget(), Console.CONSTANTS.common_label_properties());

    layout.add(tabs);
    tabs.selectTab(0);

    table.getSelectionModel().addSelectionChangeHandler(selectionChangeEvent -> {
        List<PropertyRecord> props = getSelectedEntity().getParameter();
        String tokens = getSelectedEntity().getType().getResource() + "_#_" + getSelectedEntity().getName();
        properties.setProperties(tokens, props);
    });

    return layout;
}
 
Example #4
Source File: AddressingDetails.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    addrTable = new DefaultCellTable<>(8, ActivemqAddressingPattern::getPattern);
    addrProvider = new ListDataProvider<>();
    addrProvider.addDataDisplay(addrTable);

    Column<ActivemqAddressingPattern, String> patternColumn = new Column<ActivemqAddressingPattern, String>(new TextCell()) {
        @Override
        public String getValue(ActivemqAddressingPattern object) {
            return object.getPattern();
        }
    };

    addrTable.addColumn(patternColumn, "Pattern");

    form = new Form<>(ActivemqAddressingPattern.class,
            "{selected.profile}/subsystem=messaging-activemq/server=*/address-setting=*");
    form.setNumColumns(2);
    form.bind(addrTable);

    TextBoxItem dlQ = new TextBoxItem("deadLetterQueue", "Dead Letter Address");
    TextBoxItem expQ = new TextBoxItem("expiryQueue", "Expiry Address");
    NumberBoxItem redelivery = new NumberBoxItem("redeliveryDelay", "Redelivery Delay");
    NumberBoxItem maxDelivery = new NumberBoxItem("maxDelivery", "Max Delivery Attempts", -1, Integer.MAX_VALUE);

    form.setFields(dlQ, expQ, redelivery, maxDelivery);

    FormHelpPanel helpPanel = new FormHelpPanel(() -> {
        ModelNode address = Baseadress.get();
        address.add("subsystem", "messaging-activemq");
        address.add("server", presenter.getCurrentServer());
        address.add("address-setting", "*");
        return address;
    }, form);

    FormToolStrip<ActivemqAddressingPattern> formTools = new FormToolStrip<>(
            form,
            new FormToolStrip.FormCallback<ActivemqAddressingPattern>() {
                @Override
                public void onSave(Map<String, Object> changeset) {
                    presenter.onSaveAddressDetails(form.getEditedEntity(), changeset);
                }

                @Override
                public void onDelete(ActivemqAddressingPattern entity) {}
            }
    );
    ToolStrip tableTools = new ToolStrip();
    ToolButton addBtn = new ToolButton(Console.CONSTANTS.common_label_add(),
            event -> presenter.launchNewAddrDialogue());
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_addressingDetails());
    tableTools.addToolButtonRight(addBtn);

    ToolButton removeBtn = new ToolButton(Console.CONSTANTS.common_label_delete(), event -> Feedback.confirm(
            Console.MESSAGES.deleteTitle("Addressing Config"),
            Console.MESSAGES.deleteConfirm("Addressing Config"),
            isConfirmed -> {
                if (isConfirmed) { presenter.onDeleteAddressDetails(form.getEditedEntity()); }
            }));

    tableTools.addToolButtonRight(removeBtn);

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.addStyleName("fill-layout-width");

    formPanel.add(helpPanel.asWidget());
    formPanel.add(formTools.asWidget());
    formPanel.add(form.asWidget());

    serverName = new ContentHeaderLabel();

    MultipleToOneLayout layout = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(
                    Console.CONSTANTS.addressingDescription())
            .setMaster(Console.MESSAGES.available("Address Settings"), addrTable)
            .setMasterTools(tableTools.asWidget())
            .setDetail(Console.CONSTANTS.common_label_details(), formPanel);

    return layout.build();

}
 
Example #5
Source File: ListEditor.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Widget asWidget() {
        VerticalPanel panel = new VerticalPanel();
        panel.addStyleName("fill-layout-width");

        listTable = new DefaultCellTable<T>(numRows);
        listTable.getElement().setAttribute("style", "margin-top:5px;");
        listProvider = new ListDataProvider<T>();
        listProvider.addDataDisplay(listTable);

        ToolStrip itemTools = new ToolStrip();

        addItem = new ToolButton(Console.CONSTANTS.common_label_add());

        addItem.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if(ListEditor.this.enabled)
                    listManager.launchNewItemDialoge();
            }
        });
        addItem.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_listEditor());
        itemTools.addToolButtonRight(addItem);

        panel.add(itemTools);

        //       ColumnSortEvent.ListHandler<T> sortHandler =
        //               new ColumnSortEvent.ListHandler<T>(listProvider.getList());

        // Create columns
        Column<T, String> valueColumn = new Column<T, String>(new TextCell()) {

            @Override
            public String getValue(T object) {
                return object.toString();
            }

        };
        //      valueColumn.setSortable(true);

        Column<T, T> removeCol = new Column<T, T>(
                new TextLinkCell<T>(I18n.CONSTANTS.common_label_delete(), new ActionCell.Delegate<T>() {
                    @Override
                    public void execute(final T o) {
                        Feedback.confirm(
                                Console.MESSAGES.deleteTitle(Console.CONSTANTS.common_label_item()),
                                Console.MESSAGES.deleteConfirm(Console.CONSTANTS.common_label_item())
                                , new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed)
                                     listManager.onDeleteItem(o);
                            }
                        });


                    }
                })
        ) {
            @Override
            public T getValue(T item) {
                return item;
            }
        };

        // Add the columns.
        listTable.addColumn(valueColumn, this.headerLabel);

        listTable.addColumn(removeCol, Console.CONSTANTS.common_label_option());


        listTable.setColumnWidth(valueColumn, 30, Style.Unit.PCT);

        listTable.setColumnWidth(removeCol, 20, Style.Unit.PCT);

//        listTable.addColumnSortHandler(sortHandler);
        listTable.getColumnSortList().push(valueColumn);

        if(helpText!=null)
        {
            StaticHelpPanel helpPanel = new StaticHelpPanel(helpText);
            panel.add(helpPanel.asWidget());
        }

        panel.add(listTable);

        DefaultPager pager = new DefaultPager();
        pager.setDisplay(listTable);

        panel.add(pager);

        return panel;
    }
 
Example #6
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 #7
Source File: ModelNodeColumn.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ModelNodeColumn(String attributeName) {
    super(new TextCell());
    this.attributeName = attributeName;
}
 
Example #8
Source File: ModelNodeColumn.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ModelNodeColumn(ValueAdapter adapter) {
    super(new TextCell());
    this.adapter = adapter;
}