Codota Logo
AbstractEditor
Code IndexAdd Codota to your IDE (free)

How to use
AbstractEditor
in
com.haulmont.cuba.gui.components

Best Java code snippets using com.haulmont.cuba.gui.components.AbstractEditor (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: com.haulmont.bpm/bpm-gui

@Override
public void init(Map<String, Object> params) {
  super.init(params);
  initTabSheet();
}
origin: com.haulmont.bpm/bpm-gui

@Override
protected void postInit() {
  super.postInit();
  initProcTaskActionsFrame();
}
origin: com.haulmont.cuba/cuba-gui

protected boolean commitInternal(boolean close) {
  if (!preCommit())
    return false;
  boolean committed;
  DsContext context = getDsContext();
  if (context != null) {
    committed = context.commit();
  } else {
    DataSupplier supplier = getDataService();
    supplier.commit(getItem());
    committed = true;
  }
  return postCommit(committed, close);
}
origin: com.haulmont.cuba/cuba-gui

/**
 * Tries to validate and commit data. If data committed successfully then closes the screen with
 * {@link #WINDOW_COMMIT_AND_CLOSE} action. May show validation errors or open an additional dialog before closing
 * the screen.
 *
 * @return result of close request
 */
public OperationResult closeWithCommit() {
  if (validateAll()) {
    boolean committed = commitInternal(true);
    if (committed) {
      return close(WINDOW_COMMIT_AND_CLOSE_ACTION);
    }
  }
  return OperationResult.fail();
}
origin: com.haulmont.cuba/cuba-gui

/**
 * Called by the framework to set an edited entity after creation of all components and datasources, and after
 * {@link #init(java.util.Map)}.
 * <p>Don't override this method in subclasses, use hooks {@link #initNewItem(com.haulmont.cuba.core.entity.Entity)}
 * and {@link #postInit()} instead.</p>
 * @param item  entity instance
 */
@SuppressWarnings("unchecked")
@Override
public void setItem(Entity item) {
  if (PersistenceHelper.isNew(item)) {
    DatasourceImplementation parentDs = (DatasourceImplementation) getParentDs();
    if (parentDs == null || !parentDs.getItemsToCreate().contains(item)) {
      initNewItem((T) item);
    }
  }
  setItemInternal(item);
  postInit();
}
origin: com.haulmont.cuba/cuba-gui

/**
 * Hook to be implemented in subclasses. Called by the framework after committing datasources.
 * The default implementation notifies about commit and calls {@link #postInit()} if the window is not closing.
 *
 * @param committed whether any data were actually changed and committed
 * @param close     whether the window is going to be closed
 * @return true to continue, false to abort
 */
protected boolean postCommit(boolean committed, boolean close) {
  if (committed && !close) {
    if (showSaveNotification) {
      Entity entity = getItem();
      MetadataTools metadataTools = getBeanLocator().get(MetadataTools.class);
      showNotification(
          messages.formatMainMessage("info.EntitySave",
              messages.getTools().getEntityCaption(entity.getMetaClass()),
              metadataTools.getInstanceName(entity)),
          NotificationType.TRAY);
    }
    postInit();
    afterWindowApplyPostInit();
  }
  return true;
}
origin: com.haulmont.cuba/cuba-web

public void editAttribute() {
  Set<ManagedBeanAttribute> selected = attributesTable.getSelected();
  if (selected.isEmpty()) {
    return;
  }
  ManagedBeanAttribute mba = selected.iterator().next();
  if (!mba.getWriteable()) {
    return;
  }
  AbstractEditor w = openEditor("jmxConsoleEditAttribute", mba, OpenType.DIALOG);
  w.addCloseListener(actionId -> {
    if (Window.COMMIT_ACTION_ID.equals(actionId)) {
      Object item = w.getItem();
      reloadAttribute((ManagedBeanAttribute) item);
    }
  });
}
origin: com.haulmont.cuba/cuba-gui

protected void initCommitActions(@SuppressWarnings("unused") InitEvent event) {
  Component commitAndCloseButton =
      ComponentsHelper.findComponent(getFrame(), WINDOW_COMMIT_AND_CLOSE);
  Configuration configuration = getBeanLocator().get(Configuration.NAME);
    commitAndCloseButtonExists = true;
    getFrame().addAction(
        new BaseAction(WINDOW_COMMIT_AND_CLOSE)
            .withCaption(messages.getMainMessage("actions.OkClose"))
            .withPrimary(true)
            .withShortcut(commitShortcut)
            .withHandler(e -> commitAndClose()));
      .withHandler(e -> {
        if (!finalCommitAndCloseButtonExists) {
          commitAndClose();
        } else {
          if (commit()) {
            commitActionPerformed = true;
  getFrame().addAction(commitAction);
          close(commitActionPerformed ? Window.COMMIT_ACTION_ID : getId())
      );
  getFrame().addAction(closeAction);
origin: com.haulmont.cuba/cuba-gui

@Override
public void setEntityToEdit(T entity) {
  setItem(entity);
}
origin: com.haulmont.cuba/cuba-gui

  @Override
  protected boolean preCommit() {
    if (localizedFrame != null) {
      category.setLocaleNames(localizedFrame.getValue());
    }
    return super.preCommit();
  }
}
origin: com.haulmont.cuba/cuba-gui

@Override
protected boolean postCommit(boolean committed, boolean close) {
  if (committed && needSave) {
    saveFile();
  }
  return super.postCommit(committed, close);
}
origin: com.haulmont.cuba/cuba-gui

@Override
public T getEditedEntity() {
  return getItem();
}
origin: com.haulmont.cuba/cuba-gui

public void validateAdditionalRules(ValidationErrors errors) {
  // all previous validations return no errors
  if (crossFieldValidate && errors.isEmpty()) {
    BeanValidation beanValidation = getBeanLocator().get(BeanValidation.NAME);
    Validator validator = beanValidation.getValidator();
    Set<ConstraintViolation<Entity>> violations = validator.validate(getItem(), UiCrossFieldChecks.class);
    violations.stream()
        .filter(violation -> {
          Path propertyPath = violation.getPropertyPath();
          Path.Node lastNode = Iterables.getLast(propertyPath);
          return lastNode.getKind() == ElementKind.BEAN;
        })
        .forEach(violation -> errors.add(violation.getMessage()));
  }
}
origin: com.haulmont.addon.dashboard/dashboard-web

@Override
protected void postValidate(ValidationErrors errors) {
  super.postValidate(errors);
  //remove errors from widget frames
  errors.getAll().removeIf(error -> !"dashboard$dashboardEditFieldGroup1".equals(error.component.getParent().getId()));
  List<Widget> dashboardWidgets = dashboardDs.getItem().getWidgets();
  Map<String, Long> widgetsCount = dashboardWidgets.stream()
      .collect(Collectors.groupingBy(Widget::getWidgetId, Collectors.counting()));
  List<String> nonUniqueIds = widgetsCount.entrySet().stream()
      .filter(es -> es.getValue() > 1)
      .map(Map.Entry::getKey)
      .collect(toList());
  if (nonUniqueIds.size() > 0) {
    errors.add(null, formatMessage("uniqueWidgetId", String.join(",", nonUniqueIds)));
  }
}
origin: com.haulmont.cuba/cuba-gui

/**
 * Called by the framework to validate and commit changes.
 * <p>Don't override this method in subclasses, use hooks {@link #postValidate(ValidationErrors)}, {@link #preCommit()}
 * and {@link #postCommit(boolean, boolean)} instead.</p>
 *
 * @return true if commit was successful
 */
@Override
public boolean commit() {
  return commit(true);
}
origin: com.haulmont.cuba/cuba-web

  public void close() {
    super.close(Window.CLOSE_ACTION_ID, true);
  }
}
origin: com.haulmont.cuba/cuba-gui

AbstractEditor editor = openEditor("sec$User.edit", newUser, OpenType.THIS_TAB,
    ParamsMap.of("initCopy", true));
editor.addCloseListener(actionId -> {
  if (Window.COMMIT_ACTION_ID.equals(actionId)) {
    usersDs.refresh();
origin: com.haulmont.cuba/cuba-gui

window.addCloseListener(actionId -> {
    Entity editedItem = window.getItem();
    if (editedItem != null) {
      if (parentDs == null) {
window.addCloseListener(editorCloseListener);
origin: com.haulmont.cuba/cuba-gui

@Override
public void setItem(Entity item) {
  super.setItem(item);
  if (StringUtils.isNotEmpty(getItem().getMethodName())) {
    setInitialMethodNameValue(getItem());
  }
}
origin: com.haulmont.reports/reports-gui

@Override
protected boolean preCommit() {
  if (reportRegionPropertiesTableDs.getItems().isEmpty()) {
    showNotification(getMessage("selectAtLeastOneProp"), NotificationType.TRAY);
    return false;
  }
  return super.preCommit();
}
com.haulmont.cuba.gui.componentsAbstractEditor

Javadoc

Base class for edit screen controllers.

Most used methods

  • init
  • postInit
    Hook to be implemented in subclasses. Called by #setItem(com.haulmont.cuba.core.entity.Entity). At t
  • getItem
  • postCommit
    Hook to be implemented in subclasses. Called by the framework after committing datasources. The defa
  • preCommit
    Hook to be implemented in subclasses. Called by the framework when all validation is done and dataso
  • setItem
    Called by the framework to set an edited entity after creation of all components and datasources, an
  • addCloseListener
  • close
  • commit
    Commit changes with optional validation.Don't override this method in subclasses, use hooks #postVal
  • postValidate
  • validateAll
  • addAfterCloseListener
  • validateAll,
  • addAfterCloseListener,
  • addCloseWithCommitListener,
  • addInitListener,
  • afterWindowApplyPostInit,
  • closeWithCommit,
  • commitAndClose,
  • commitInternal,
  • getBeanLocator,
  • getContext

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now