<commit_before>/**
 * This file is part of DBNavigationBar.
 *
 * DBNavigationBar is free software: you can redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * DBNavigationBar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with DBNavigationBar. If
 * not, see <a href="http://www.gnu.org/licenses>http://www.gnu.org/licenses</a>
 *
 *
 * Copyright (c) 2011-2015 <NAME>
 *
 */

package de.knightsoft.dbnavigationbar.client.ui;

import de.knightsoft.dbnavigationbar.client.domain.AbstractDomainDBBasics;
import de.knightsoft.dbnavigationbar.client.domain.AbstractDomainUser;
import de.knightsoft.dbnavigationbar.client.ui.widget.DBNaviBarWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

import org.apache.commons.lang3.StringUtils;

/**
 *
 * The <code>AbstractBasicDBTemplateUI</code> class is a template for database input mask.
 *
 * @param <E> data structure
 * @author <NAME>
 * @version 1.0.0, 2011-02-14
 */
public abstract class AbstractBasicDBTemplateUI<E extends AbstractDomainDBBasics>
    extends AbstractBasicTemplateUI implements AsyncCallback<E> {

  /**
   * images.
   */
  protected static final Images IMAGES = GWT.create(Images.class);

  /**
   * navigation bar.
   */
  private DBNaviBarWidget myNavigationBar;

  /**
   * form panel.
   */
  private final FormPanel form;

  /**
   * do save.
   */
  private boolean dosave = false;

  /**
   * Pictures used.
   */
  public interface Images extends ClientBundle {
    /**
     * db head picture.
     *
     * @return image
     */
    @Source("BasicDBTemplateUI.png")
    ImageResource dbHeadTemplateUI();

    /**
     * delete position picture.
     *
     * @return image
     */
    @Source("DeletePosition.png")
    ImageResource deletePosition();
  }

  /**
   * db entry.
   */
  private E dbEntry;

  /**
   * constants.
   */
  private final BasicDBTemplateUIConstants constants;

  /**
   * widget list.
   */
  private final Widget[] widgetlist;

  /**
   * user defined function.
   */
  private final String userDefFunction;

  /**
   * mask is set up.
   */
  private boolean maskSetUp;

  /**
   * Constructor.
   *
   * @param pParentwidget the parent widget, where this frame is displayed
   * @param pThisWidgetlist list of widgets to display
   * @param pUserdefinedfunction special function to include into the navigation bar
   */
  public AbstractBasicDBTemplateUI(final Widget[] pThisWidgetlist,
      final String pUserdefinedfunction) {

    super();
    this.maskSetUp = false;
    this.widgetlist = pThisWidgetlist;
    this.userDefFunction = pUserdefinedfunction;

    this.constants = (BasicDBTemplateUIConstants) GWT.create(BasicDBTemplateUIConstants.class);

    this.form = new FormPanel();

    this.initWidget(this.form);

  }

  /**
   * set up the mask.
   *
   * @param pUser user information about the currently logged in user
   */
  @Override
  protected final void setUpMask(final AbstractDomainUser pUser) {
    if (!this.maskSetUp) {
      this.myNavigationBar = new DBNaviBarWidget(this.getSearchFields(),
          this.getSearchFieldsDisplay(), this.userDefFunction);
      final VerticalPanel myPanel = new VerticalPanel();
      myPanel.setWidth("100%");
      myPanel.setHeight("100%");
      myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

      final HorizontalPanel titlePanel = new HorizontalPanel();
      titlePanel.setWidth("100%");
      titlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
      final String pageTitle = "<h1>" + this.getHeaderTitle() + "</h1>";
      final HTML htmlPageTitle = new HTML(pageTitle);
      titlePanel.add(htmlPageTitle);

      myPanel.add(titlePanel);

      myPanel.add(this.myNavigationBar);

      myPanel.add(this.createAndFormatContentPanel());

      this.form.add(myPanel);
      this.form.setWidth("100%");
      this.form.setHeight("100%");
      this.form.getElement().getStyle().setOverflow(Overflow.AUTO);

      this.myNavigationBar.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent pEvent) {
          AbstractBasicDBTemplateUI.this.dosave = false;
          final DBTemplateRemoteServiceAsync<E> service =
              AbstractBasicDBTemplateUI.this.getServiceFactory();
<commit_msg>removed wrong height setting<commit_after>/**
 * This file is part of DBNavigationBar.
 *
 * DBNavigationBar is free software: you can redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * DBNavigationBar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with DBNavigationBar. If
 * not, see <a href="http://www.gnu.org/licenses>http://www.gnu.org/licenses</a>
 *
 *
 * Copyright (c) 2011-2015 <NAME>
 *
 */

package de.knightsoft.dbnavigationbar.client.ui;

import de.knightsoft.dbnavigationbar.client.domain.AbstractDomainDBBasics;
import de.knightsoft.dbnavigationbar.client.domain.AbstractDomainUser;
import de.knightsoft.dbnavigationbar.client.ui.widget.DBNaviBarWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

import org.apache.commons.lang3.StringUtils;

/**
 *
 * The <code>AbstractBasicDBTemplateUI</code> class is a template for database input mask.
 *
 * @param <E> data structure
 * @author <NAME>
 * @version 1.0.0, 2011-02-14
 */
public abstract class AbstractBasicDBTemplateUI<E extends AbstractDomainDBBasics>
    extends AbstractBasicTemplateUI implements AsyncCallback<E> {

  /**
   * images.
   */
  protected static final Images IMAGES = GWT.create(Images.class);

  /**
   * navigation bar.
   */
  private DBNaviBarWidget myNavigationBar;

  /**
   * form panel.
   */
  private final FormPanel form;

  /**
   * do save.
   */
  private boolean dosave = false;

  /**
   * Pictures used.
   */
  public interface Images extends ClientBundle {
    /**
     * db head picture.
     *
     * @return image
     */
    @Source("BasicDBTemplateUI.png")
    ImageResource dbHeadTemplateUI();

    /**
     * delete position picture.
     *
     * @return image
     */
    @Source("DeletePosition.png")
    ImageResource deletePosition();
  }

  /**
   * db entry.
   */
  private E dbEntry;

  /**
   * constants.
   */
  private final BasicDBTemplateUIConstants constants;

  /**
   * widget list.
   */
  private final Widget[] widgetlist;

  /**
   * user defined function.
   */
  private final String userDefFunction;

  /**
   * mask is set up.
   */
  private boolean maskSetUp;

  /**
   * Constructor.
   *
   * @param pParentwidget the parent widget, where this frame is displayed
   * @param pThisWidgetlist list of widgets to display
   * @param pUserdefinedfunction special function to include into the navigation bar
   */
  public AbstractBasicDBTemplateUI(final Widget[] pThisWidgetlist,
      final String pUserdefinedfunction) {

    super();
    this.maskSetUp = false;
    this.widgetlist = pThisWidgetlist;
    this.userDefFunction = pUserdefinedfunction;

    this.constants = (BasicDBTemplateUIConstants) GWT.create(BasicDBTemplateUIConstants.class);

    this.form = new FormPanel();

    this.initWidget(this.form);

  }

  /**
   * set up the mask.
   *
   * @param pUser user information about the currently logged in user
   */
  @Override
  protected final void setUpMask(final AbstractDomainUser pUser) {
    if (!this.maskSetUp) {
      this.myNavigationBar = new DBNaviBarWidget(this.getSearchFields(),
          this.getSearchFieldsDisplay(), this.userDefFunction);
      final VerticalPanel myPanel = new VerticalPanel();
      myPanel.setWidth("100%");
      myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

      final HorizontalPanel titlePanel = new HorizontalPanel();
      titlePanel.setWidth("100%");
      titlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
      final String pageTitle = "<h1>" + this.getHeaderTitle() + "</h1>";
      final HTML htmlPageTitle = new HTML(pageTitle);
      titlePanel.add(htmlPageTitle);

      myPanel.add(titlePanel);

      myPanel.add(this.myNavigationBar);

      myPanel.add(this.createAndFormatContentPanel());

      this.form.add(myPanel);
      this.form.setWidth("100%");
      this.form.setHeight("100%");
      this.form.getElement().getStyle().setOverflow(Overflow.AUTO);

      this.myNavigationBar.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent pEvent) {
          AbstractBasicDBTemplateUI.this.dosave = false;
          final DBTemplateRemoteServiceAsync<E> service =
              AbstractBasicDBTemplateUI.this.getServiceFactory();

{'fraction_non_alphanumeric': 0.10570249484149315, 'fraction_numerical': 0.006846745451134871, 'mean_word_length': 3.518220338983051, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '380191', 'n_tokens_mistral': 3191, 'n_tokens_neox': 3083, 'n_words': 758}