/** * Generates an error message when the client is trying to to something * ('what') with a connector which is disabled or invisible. * * @since 7.1.8 * @param connector * the connector which is disabled (or invisible) * @return an error message */ public static String getIgnoredDisabledError(String what, ClientConnector connector) { String msg = "Ignoring " + what + " for disabled connector " + connector.getClass().getName(); if (connector instanceof Component) { String caption = ((Component) connector).getCaption(); if (caption != null) { msg += ", caption=" + caption; } } return msg; } }
@Override public String getMessage() { StringBuilder sb = new StringBuilder(); Component component = existingArea.getComponent(); sb.append(component); sb.append("( type = "); sb.append(component.getClass().getName()); if (component.getCaption() != null) { sb.append(", caption = \""); sb.append(component.getCaption()); sb.append("\""); } sb.append(')'); sb.append(" is already added to "); sb.append(existingArea.childData.column1); sb.append(','); sb.append(existingArea.childData.column1); sb.append(','); sb.append(existingArea.childData.row1); sb.append(','); sb.append(existingArea.childData.row2); sb.append("(column1, column2, row1, row2)."); return sb.toString(); }
/** * Creates a string containing debug info for the connector. * * @since 7.1 * @param connector * The connector to print debug info about * @return A string with debug information */ public static String getDebugInformation(ClientConnector connector) { StringBuilder sb = new StringBuilder(); sb.append("*** Debug details of a connector: *** \n"); sb.append("Type: "); sb.append(connector.getClass().getName()); sb.append("\nId:"); sb.append(connector.getConnectorId()); if (connector instanceof Component) { Component component = (Component) connector; if (component.getCaption() != null) { sb.append("\nCaption:"); sb.append(component.getCaption()); } } writeHierarchyInformation(connector, sb); return sb.toString(); }
err.append('/').append(Integer.toHexString(component.hashCode())); if (component.getCaption() != null) { err.append(" \""); err.append(component.getCaption()); err.append("\"");
/** * Adds a new tab into TabSheet. Component caption and icon are copied to * the tab metadata at creation time. * * If the tab sheet already contains the component, its tab is returned. * * @param component * the component to be added onto tab - should not be null. * @param position * The position where the tab should be added * @return the created {@link Tab} */ public Tab addTab(Component component, int position) { Tab result = tabs.get(component); if (result == null) { result = addTab(component, component.getCaption(), component.getIcon(), position); } return result; }
/** * Tries to bind the given {@link Component} instance to a member field of * the bind target. The fields are matched based on localId, id and caption. * * @param instance * the instance to be bound to a field * @param localId * the localId used for mapping the field to an instance field * @return true on success * @throws FieldBindingException * if error occurs when trying to bind the instance to a field */ public boolean bindField(Component instance, String localId) { // check that the field exists, is correct type and is null boolean success = bindFieldByIdentifier(localId, instance); if (!success) { success = bindFieldByIdentifier(instance.getId(), instance); } if (!success) { success = bindFieldByIdentifier(instance.getCaption(), instance); } if (!success) { String idInfo = "localId: " + localId + " id: " + instance.getId() + " caption: " + instance.getCaption(); getLogger().finest("Could not bind component to a field " + instance.getClass().getName() + " " + idInfo); } return success; }
+ connector.getClass().getName(); if (connector instanceof Component) { String caption = ((Component) connector).getCaption(); if (caption != null) { msg += ", caption=" + caption;
} else if (parent instanceof Window) { return parent.getCaption() != null && !parent.getCaption().isEmpty();
String caption = component.getCaption(); if (caption != null) { mapCaption(caption, component);
@Override public String getCaption() { return getComposition().getCaption(); }
@Override public String getCaption() { if (delegate.isBorderVisible()) { return delegate.getCaption(); } else { return component.getCaption(); } }
public boolean apply(Component component) { component.setCaption(CmsVaadinUtils.localizeString(component.getCaption())); return true; } });
protected void registerComponent(Component component) { getLogger().log(Level.FINEST, "Registered {0}: {1}", new Object[] { component.getClass().getSimpleName(), component.getCaption() }); if (!equals(component.getParent())) { component.setParent(this); } visibleComponents.add(component); }
public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { Component selectedTab = getSelectedTab(); if ("+".equals(selectedTab.getCaption())) { setSelectedTab((m_lastTab != null ? m_lastTab : iterator().next())); addNewTabComponent(); } else { m_lastTab = selectedTab; } } });
@Override public void setBorderVisible(boolean visible) { if (delegate.isBorderVisible() == visible) { return; } delegate.setBorderVisible(visible); String caption = visible ? component.getCaption() : delegate.getCaption(); setCaption(caption); }
@Override public void selectedTabChange(final SelectedTabChangeEvent event) { if (i18n.getMessage("caption.filter.simple").equals(getSelectedTab().getCaption())) { managementUIState.setCustomFilterSelected(false); eventBus.publish(this, ManagementUIEvent.RESET_TARGET_FILTER_QUERY); } else { managementUIState.setCustomFilterSelected(true); eventBus.publish(this, ManagementUIEvent.RESET_SIMPLE_FILTERS); } }
@Override public void selectedTabChange(final SelectedTabChangeEvent event) { if (i18n.getMessage("caption.filter.simple").equals(getSelectedTab().getCaption())) { managementUIState.setCustomFilterSelected(false); eventBus.publish(this, ManagementUIEvent.RESET_TARGET_FILTER_QUERY); } else { managementUIState.setCustomFilterSelected(true); eventBus.publish(this, ManagementUIEvent.RESET_SIMPLE_FILTERS); } }
private AbstractSplitPanel initMainPanel(Component first, Component second) { AbstractSplitPanel layout = new HorizontalSplitPanel(); layout.setSizeFull(); layout.setLocked(false); layout.setSplitPosition(20, UNITS_PERCENTAGE); layout.setFirstComponent(first); layout.setSecondComponent(second); layout.setCaption(first.getCaption()); return layout; }
private Panel wrapToPanel(Component component) { Panel panel = new Panel(component.getCaption()); panel.setSizeFull(); VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setSizeFull(); layout.addComponent(component); panel.setContent(layout); component.setCaption(null); return panel; }
@Test public void simpleCheckBoxFieldTest() throws Exception { // GIVEN checkBoxField = new CheckBoxFieldFactory(definition, baseItem, uiContext, i18NAuthoringSupport); checkBoxField.setComponentProvider(componentProvider); // WHEN Field<Boolean> field = checkBoxField.createField(); // THEN assertTrue(field instanceof CheckBoxField); assertEquals(CHECKBOX_FIELD_LABEL, field.getCaption()); assertEquals(CHECKBOX_CAPTION, ((CheckBoxField) field).iterator().next().getCaption()); }