Create toolbar for creating a new object

@param aWPEC
The web page execution context
@param aForm
The handled form. Never <code>null</code>.
@param aSelectedObject
Optional selected object. May be <code>null</code>.
@return Never <code>null</code>.
169367
@Nonnull
  @OverrideOnDemand
  protected TOOLBAR_TYPE createCreateToolbar (@Nonnull final WPECTYPE aWPEC,
                                              @Nonnull final FORM_TYPE aForm,
                                              @Nullable final DATATYPE aSelectedObject)
  {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale ();

    final TOOLBAR_TYPE aToolbar = createNewCreateToolbar (aWPEC);
    aToolbar.addHiddenField (CPageParam.PARAM_ACTION, CPageParam.ACTION_CREATE);
    if (aSelectedObject != null)
      aToolbar.addHiddenField (CPageParam.PARAM_OBJECT, aSelectedObject.getID ());
    aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
    // Save button
    aToolbar.addSubmitButton (getCreateToolbarSubmitButtonText (aDisplayLocale), getCreateToolbarSubmitButtonIcon ());
    // Cancel button
    aToolbar.addButtonCancel (aDisplayLocale);

    // Callback
    modifyCreateToolbar (aWPEC, aToolbar);
    return aToolbar;
  }
1276982
protected JComponent createButtonBar() {
		this.dialogCommandGroup = getCommandManager().createCommandGroup(null, getCommandGroupMembers());
		JComponent buttonBar = this.dialogCommandGroup.createButtonBar();
		GuiStandardUtils.attachDialogBorder(buttonBar);
		return buttonBar;
	}
239405
private static void createFactoryInstance() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
    try {
      Class cls = Class.forName(JS_MESSAGE_HANDLE_FACTORY_CLASS);
      instance = (JsMessageHandleFactory) cls.newInstance();
    }
    catch (Exception e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.JsMessageHandleFactory.createFactoryInstance", "133");
      SibTr.error(tc,"UNABLE_TO_CREATE_HANDLEFACTORY_CWSIF0031",e);
      NoClassDefFoundError ncdfe = new NoClassDefFoundError(e.getMessage());
      ncdfe.initCause(e);
      throw ncdfe;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance");
  }
836027
static BaseDoubleColumnValueSelector makeColumnValueSelectorWithDoubleDefault(
      final ColumnSelectorFactory metricFactory,
      final ExprMacroTable macroTable,
      @Nullable final String fieldName,
      @Nullable final String fieldExpression,
      final double nullValue
  )
  {
    if ((fieldName == null) == (fieldExpression == null)) {
      throw new IllegalArgumentException("");
    }
    if (fieldName != null) {
      return metricFactory.makeColumnValueSelector(fieldName);
    } else {
      final Expr expr = Parser.parse(fieldExpression, macroTable);
      final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr);
      class ExpressionDoubleColumnSelector implements DoubleColumnSelector
      {
        @Override
        public double getDouble()
        {
          final ExprEval exprEval = baseSelector.getObject();
          return exprEval.isNumericNull() ? nullValue : exprEval.asDouble();
        }

        @Override
        public void inspectRuntimeShape(RuntimeShapeInspector inspector)
        {
          inspector.visit("baseSelector", baseSelector);
        }

        @Override
        public boolean isNull()
        {
          final ExprEval exprEval = baseSelector.getObject();
          return exprEval == null || exprEval.isNumericNull();
        }
      }
      return new ExpressionDoubleColumnSelector();
    }
  }
1323408
protected JComponent createControl()
    {
        PropertyColumnTableDescription desc = new PropertyColumnTableDescription("contactViewTable", Contact.class);
        desc.addPropertyColumn("lastName").withMinWidth(150);
        desc.addPropertyColumn("firstName").withMinWidth(150);
        desc.addPropertyColumn("address.address1");
        desc.addPropertyColumn("address.city");
        desc.addPropertyColumn("address.state");
        desc.addPropertyColumn("address.zip");
        widget = new GlazedListTableWidget(Arrays.asList(contactDataStore.getAllContacts()), desc);
        JPanel table = new JPanel(new BorderLayout());
        table.add(widget.getListSummaryLabel(), BorderLayout.NORTH);
        table.add(widget.getComponent(), BorderLayout.CENTER);
        table.add(widget.getButtonBar(), BorderLayout.SOUTH);

        CommandGroup popup = new CommandGroup();
        popup.add((ActionCommand) getWindowCommandManager().getCommand("deleteCommand", ActionCommand.class));
        popup.addSeparator();
        popup.add((ActionCommand) getWindowCommandManager().getCommand("propertiesCommand", ActionCommand.class));
        JPopupMenu popupMenu = popup.createPopupMenu();

        widget.getTable().addMouseListener(new MouseAdapter()
        {
            public void mousePressed(MouseEvent e)
            {
                // If the user right clicks on a row other than the selection,
                // then move the selection to the current row
                if (e.getButton() == MouseEvent.BUTTON3)
                {
                    int rowUnderMouse = widget.getTable().rowAtPoint(e.getPoint());
                    if (rowUnderMouse != -1 && !widget.getTable().isRowSelected(rowUnderMouse))
                    {
                        // Select the row under the mouse
                        widget.getTable().getSelectionModel().setSelectionInterval(rowUnderMouse, rowUnderMouse);
                    }
                }
            }

            @Override
            public void mouseClicked(MouseEvent e)
            {
                if (e.getClickCount() >= 2)
                {
                    if (propertiesExecutor.isEnabled())
                        propertiesExecutor.execute();
                }
            }
        });

        widget.getTable().addMouseListener(new PopupMenuMouseListener(popupMenu));

        ValueModel selectionHolder = new ListSelectionValueModelAdapter(widget.getTable().getSelectionModel());
        new ListSingleSelectionGuard(selectionHolder, deleteExecutor);
        new ListSingleSelectionGuard(selectionHolder, propertiesExecutor);

        JPanel view = new JPanel(new BorderLayout());
        view.add(widget.getTextFilterField(), BorderLayout.NORTH);
        view.add(table, BorderLayout.CENTER);
        return view;


        //"lastName", "firstName", "address.address1", "address.city", "address.state", "address.zip"

//		JPanel filterPanel = new JPanel(new BorderLayout());
//		JLabel filterLabel = getComponentFactory().createLabel("nameAddressFilter.label");
//		filterPanel.add(filterLabel, BorderLayout.WEST);
//
//		String tip = getMessage("nameAddressFilter.caption");
//		filterField = getComponentFactory().createTextField();
//		filterField.setToolTipText(tip);
//		filterPanel.add(filterField, BorderLayout.CENTER);
//		filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
//
//		contactTable = new ContactTableFactory().createContactTable();
//
//		JPanel view = new JPanel(new BorderLayout());
//		JScrollPane sp = getComponentFactory().createScrollPane(contactTable.getControl());
//		view.add(filterPanel, BorderLayout.NORTH);
//		view.add(sp, BorderLayout.CENTER);
//		return view;
    }
583322
public FieldList makeSelectedRowCurrent()
    {
        FieldList record = null;
        int iRow = m_jTableScreen.getSelectedRow();
        if (iRow != -1)
            record = m_thinTableModel.makeRowCurrent(iRow, false);
        if (record == null)
        {
            record = this.getFieldList();
            try   {
                record.getTable().addNew();
            } catch (DBException ex)    {
                ex.printStackTrace(); // Never.
            }
        }
        return record;
    }
738255
@Override
    public <T> T createSpyComponent(final T instance) {
        checkArgument(instance != null, "instance must not be null!");
        if (isFinalOrPrimitive(instance.getClass())) {
            LOG.warn("Skipping creation of a spy : {} as it is final or primitive type.", instance.getClass()
                    .getSimpleName());
            return null;
        }
        return Mockito.spy(instance);
    }
824728
public static EventModel createEvent(ModelForm form, Object model) throws Exception {
		EventModel em = new EventModel();
		try {
			PropertyUtils.copyProperties(model, form);
			em.setModelIF(model);
			String action = form.getAction();
			em.setActionName(action);
			em.setActionType(FormBeanUtil.actionTransfer(action));
		} catch (Exception ex) {
			Debug.logError("[JdonFramework]create Event error:" + ex, module);
			throw new Exception(ex);
		}
		return em;
	}
541409
public ExpectedColumn selectColumn() throws Exception
    {
        if (isNull()) return new NullColumn();

        if (expectFalse()) return new ExpectFalseColumn(message());
        if (expectTrue()) return new ExpectTrueColumn(message());
        if (expectNull()) return new ExpectNullColumn(message());
        if (expectNotNull()) return new ExpectNotNullColumn(message());

        return new ExpectedColumn(message());
    }
1116132
public static JComponent createButtonBar(Object[] groupMembers) {
		CommandGroupFactoryBean commandGroupFactoryBean = new CommandGroupFactoryBean(
				null, groupMembers);
		// CommandGroup dialogCommandGroup =
		// CommandGroup.createCommandGroup(null,
		// groupMembers);
		CommandGroup dialogCommandGroup = commandGroupFactoryBean
				.getCommandGroup();
		JComponent buttonBar = dialogCommandGroup.createButtonBar();
		GuiStandardUtils.attachDialogBorder(buttonBar);
		return buttonBar;
	}
992888
private void makeSimpleExample() {
		add(new WHeading(HeadingLevel.H3, "Simple WRadioButtonSelect"));
		WPanel examplePanel = new WPanel();
		examplePanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.MEDIUM));
		add(examplePanel);

		/**
		 * The radio button select.
		 */
		final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
		final WTextField text = new WTextField();

		text.setReadOnly(true);
		text.setText(NO_SELECTION);

		WButton update = new WButton("Update");
		update.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				text.setText("The selected item is: "
						+ rbSelect.getSelected());
			}
		});
		//setting the default submit button improves usability. It can be set on a WPanel or the WRadioButtonSelect directly
		examplePanel.setDefaultSubmitButton(update);

		examplePanel.add(new WLabel("Select a state or territory", rbSelect));
		examplePanel.add(rbSelect);
		examplePanel.add(text);
		examplePanel.add(update);
		add(new WAjaxControl(update, text));
	}
63441
private I_CmsFormWidget createTemplateSelector() {

        if (m_handler.useAdeTemplates()) {

            CmsSelectBox selectBox = null;
            Map<String, String> values = new LinkedHashMap<String, String>();
            for (Map.Entry<String, CmsClientTemplateBean> templateEntry : m_handler.getPossibleTemplates().entrySet()) {
                CmsClientTemplateBean template = templateEntry.getValue();
                String title = template.getTitle();
                if ((title == null) || (title.length() == 0)) {
                    title = template.getSitePath();
                }
                values.put(template.getSitePath(), title);
            }
            selectBox = new CmsPropertySelectBox(values);
            return selectBox;
        } else {
            CmsTextBox textbox = new CmsTextBox();
            return textbox;
        }
    }
695341
@Override
	public Widget createDetailWidget() {
		return new AbstractWidget() {

			@Override
			public void onAboutToShow() {
				DefaultDataEditorWidget.this.onAboutToShow();
			}

			@Override
			public void onAboutToHide() {
				DefaultDataEditorWidget.this.onAboutToHide();
			}

			public JComponent getComponent() {
				return getDetailForm().getControl();
			}

			@Override
			public List<? extends AbstractCommand> getCommands() {
				return Arrays.asList(getDetailForm().getCommitCommand());
			}

			@Override
			public String getId() {
				return DefaultDataEditorWidget.this.getId() + "."
						+ getDetailForm().getId();
			}
		};
	}
1265582
@Nonnull
  @OverrideOnDemand
  protected TOOLBAR_TYPE createUndeleteToolbar (@Nonnull final WPECTYPE aWPEC,
                                                @Nonnull final FORM_TYPE aForm,
                                                @Nonnull final ICommonsList <DATATYPE> aSelectedObjects)
  {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale ();

    final TOOLBAR_TYPE aToolbar = getUIHandler ().createToolbar (aWPEC);
    aToolbar.addHiddenField (CPageParam.PARAM_ACTION, aWPEC.getAction ());
    aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
    for (final DATATYPE aItem : aSelectedObjects)
      aToolbar.addHiddenField (getFieldName (), aItem.getID ());

    // Yes button
    aToolbar.addSubmitButton (getUndeleteToolbarSubmitButtonText (aDisplayLocale),
                              getUndeleteToolbarSubmitButtonIcon ());
    // No button
    aToolbar.addButtonNo (aDisplayLocale);

    // Callback
    modifyUndeleteToolbar (aWPEC, aToolbar);
    return aToolbar;
  }
387483
private void initContextMenauAndToolBar() {
        toolbar = new JToolBar();
        toolbar.add(new Button(saveAction));
        toolbar.add(new Button(printAction));
        toolbar.addSeparator();
        toolbar.add(new Button(zoomInAction));
        toolbar.add(new Button(zoomOutAction));
        toolbar.add(new Button(resetAction));
        toolbar.addSeparator();
        toolbar.add(new Button(enlargePlotAreaAction));
        toolbar.add(new Button(shrinkPlotAreaAction));
        toolbar.add(new Button(increaseHeightAction));
        toolbar.add(new Button(decreaseHeightAction));
        toolbar.add(new Button(increaseWidthAction));
        toolbar.add(new Button(decreaseWidthAction));
        toolbar.addSeparator();
        toolbar.add(new Button(propertyAction));
    
        decreaseHeightAction.setEnabled(false);
        decreaseWidthAction.setEnabled(false);
        
        //Initialize popup menu.
        popup = new JPopupMenu();        
        popup.add(new JMenuItem(saveAction));
        popup.add(new JMenuItem(printAction));
        popup.addSeparator();
        popup.add(new JMenuItem(zoomInAction));
        popup.add(new JMenuItem(zoomOutAction));
        popup.add(new JMenuItem(resetAction));
        popup.addSeparator();
        popup.add(new JMenuItem(enlargePlotAreaAction));
        popup.add(new JMenuItem(shrinkPlotAreaAction));
        popup.add(new JMenuItem(increaseHeightAction));
        popup.add(new JMenuItem(decreaseHeightAction));
        popup.add(new JMenuItem(increaseWidthAction));
        popup.add(new JMenuItem(decreaseWidthAction));
        popup.addSeparator();
        popup.add(new JMenuItem(propertyAction));
        
        AncestorListener ancestorListener = new AncestorListener() {

            @Override
            public void ancestorAdded(AncestorEvent ae) {
                boolean inScrollPane = false;
                Container parent = getParent();
                while (parent != null) {
                    if (parent instanceof JScrollPane) {
                        inScrollPane = true;
                        scrollPane = (JScrollPane) parent;
                        break;
                    }
                    
                    parent = parent.getParent();
                }
                
                increaseHeightAction.setEnabled(inScrollPane);
                increaseWidthAction.setEnabled(inScrollPane);
            }

            @Override
            public void ancestorRemoved(AncestorEvent ae) {
            }

            @Override
            public void ancestorMoved(AncestorEvent ae) {
            }
        };
        
        addAncestorListener(ancestorListener);
    }
695681
function createSelectionTrimmer(methodName) {
        return createEntryPointFunction(
            function(session, characterOptions) {
                var trimmed = false;
                this.changeEachRange(function(range) {
                    trimmed = range[methodName](characterOptions) || trimmed;
                });
                return trimmed;
            }
        );
    }
166789
public Object clickAndExpectOneOf(final Object... expected) {
        dispatcher.beforeClick(this, expected);

        getElement().click();
        if (Boolean.parseBoolean(Config.getConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING))) {
            logUIAction(UIActions.CLICKED);
        }

        // If there are no expected objects, then it means user wants this method
        // to behave as a clickonly. So lets skip processing of alerts and leave
        // that to the user.
        if (expected == null || expected.length == 0) {
            return null;
        }
        if (parent != null) {
            WebDriverWaitUtils.waitUntilPageIsLoaded(parent.getCurrentPage());
        }
        validatePresenceOfAlert();

        long timeout = Grid.getExecutionTimeoutValue() / 1000;

        try {

            WebDriverWait wait = new WebDriverWait(Grid.driver(), timeout);
            wait.ignoring(NoSuchElementException.class);
            wait.ignoring(PageValidationException.class);

            Object expectedObj = wait.ignoring(ExpectOneOfException.class).until(new Function<WebDriver, Object>() {

                // find the first object that is matched and return it
                @Override
                public Object apply(WebDriver webDriver) {
                    StringBuilder sb = new StringBuilder();

                    int i = 1;
                    for (Object expect : expected) {
                        try {
                            if (expect instanceof AbstractElement) {
                                AbstractElement element = (AbstractElement) expect;
                                if (HtmlElementUtils.locateElement(element.getLocator()) != null) {
                                    return expect;
                                }
                            } else if (expect instanceof String) {
                                String s = (String) expect;
                                if (HtmlElementUtils.locateElement(s) != null) {
                                    return expect;
                                }
                            } else if (expect instanceof WebPage) {
                                WebPage w = (WebPage) expect;

                                w.validatePage();
                                return expect;
                            }
                        } catch (NoSuchElementException | PageValidationException e) { // NOSONAR
                            sb.append("\n\tObject " + i + ": " + expect.getClass().getSimpleName() + "\n");
                            sb.append("\t" + ExceptionUtils.getRootCauseMessage(e) + "\n");
                            sb.append("\t\t" + StringUtils.substringBetween(ExceptionUtils.getStackTrace(e), "\n"));
                        }
                        i++;
                    }

                    throw new ExpectOneOfException(sb.toString());
                }
            });

            return expectedObj;

        } finally {
            // Attempt at taking screenshots even when there are time-outs triggered from the wait* methods.
            processScreenShot();

            dispatcher.afterClick(this, expected);
        }
    }