当前位置: 首页>>代码示例>>Java>>正文


Java Component类代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.components.Component的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Component类属于com.haulmont.cuba.gui.components包,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeAll

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
public void removeAll() {
    content.removeAll();

    List<Component> innerComponents = new ArrayList<>(components);
    components.clear();

    for (Component component : innerComponents) {
        if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
            ((DesktopAbstractComponent) component).setParentEnabled(true);
        }

        component.setParent(null);
    }

    adjustViewPreferredSize();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:DesktopScrollBoxLayout.java

示例2: initPermissionColoredColumns

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
public void initPermissionColoredColumns(TreeTable specificPermissionsTree) {
    specificPermissionsTree.addGeneratedColumn("permissionVariant", new Table.ColumnGenerator<BasicPermissionTarget>() {
        @Override
        public Component generateCell(BasicPermissionTarget entity) {
            Label label = AppConfig.getFactory().createComponent(Label.class);
            JLabel jLabel = (JLabel) DesktopComponentsHelper.unwrap(label);

            StringBuilder builder = new StringBuilder();

            PermissionVariant permissionVariant = entity.getPermissionVariant();

            if (permissionVariant != PermissionVariant.NOTSET) {
                builder.append("<html>");
                builder.append("<font color=\"").append(permissionVariant.getColor()).append("\">")
                        .append(messages.getMessage(permissionVariant)).append("</font>");

                builder.append("</html>");
            }

            jLabel.setText(builder.toString());

            return label;
        }
    }, Label.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:SpecificPermissionsFrameCompanion.java

示例3: DesktopFieldGroup

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
public DesktopFieldGroup() {
    LC lc = new LC();
    lc.hideMode(3); // Invisible components will not participate in the layout at all and it will for instance not take up a grid cell.
    lc.insets("0 0 0 0");
    if (LayoutAdapter.isDebug()) {
        lc.debug(1000);
    }

    layout = new MigLayout(lc);
    impl = new JPanel(layout);
    assignClassDebugProperty(impl);
    collapsiblePanel = new CollapsiblePanel(super.getComposition());
    assignClassDebugProperty(collapsiblePanel);
    collapsiblePanel.setBorderVisible(false);

    setWidth(Component.AUTO_SIZE);

    fieldFactory = AppBeans.get(FieldGroupFieldFactory.NAME);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:DesktopFieldGroup.java

示例4: PresentationEditor

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
public PresentationEditor(Presentation presentation, Component.HasPresentations component) {
    this.presentation = presentation;
    this.component = component;

    messages = AppBeans.get(Messages.NAME);
    sessionSource = AppBeans.get(UserSessionSource.NAME);

    isNew = PersistenceHelper.isNew(presentation);
    allowGlobalPresentations = sessionSource.getUserSession()
            .isSpecificPermitted("cuba.gui.presentations.global");

    initLayout();

    setWidthUndefined();

    String titleMessageKey = isNew ? "PresentationsEditor.new" : "PresentationsEditor.edit";
    setCaption(getMessage(titleMessageKey));

    setModal(true);
    setResizable(false);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:PresentationEditor.java

示例5: removeAll

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
public void removeAll() {
    impl.removeAll();
    componentByIds.clear();

    List<Component> components = new ArrayList<>(ownComponents);
    ownComponents.clear();

    for (Component component : components) {
        if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
            ((DesktopAbstractComponent) component).setParentEnabled(true);
        }

        component.setParent(null);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:DesktopSplitPanel.java

示例6: actionPerform

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
public void actionPerform(Component component) {
    if (!isEnabled())
        return;

    if (beforeActionPerformedHandler != null) {
        if (!beforeActionPerformedHandler.beforeActionPerformed())
            return;
    }

    @SuppressWarnings("unchecked")
    Set<Entity> selected = target.getSelected();
    if (!selected.isEmpty()) {
        if (confirm) {
            confirmAndRemove(selected);
        } else {
            doRemove(selected, autocommit);
            afterRemove(selected);

            if (afterRemoveHandler != null) {
                afterRemoveHandler.handle(selected);
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:ExcludeAction.java

示例7: testValueChangeListener

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Test
public void testValueChangeListener() {
    SearchField searchField = factory.createComponent(SearchField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    searchField.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    user.setGroup(groups.get(0));

    boolean[] valueWasChanged = {false};
    Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
    searchField.addValueChangeListener(listener);

    searchField.setDatasource(userDs, "group");
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:SearchFieldDsTest.java

示例8: createComponent

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
protected Component createComponent() {
    componentsFactory = AppBeans.get(ComponentsFactory.class);
    popupButton = componentsFactory.createComponent(PopupButton.class);

    OpManager opManager = AppBeans.get(OpManager.class);
    for (Op op : opManager.availableOps(condition.getJavaClass())) {
        OperatorChangeAction operatorChangeAction = new OperatorChangeAction(op);
        popupButton.addAction(operatorChangeAction);
    }

    popupButton.setCaption(condition.getOperator().getLocCaption());
    popupButton.setStyleName("condition-operation-button");

    return popupButton;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:PropertyOperationEditor.java

示例9: testUnsubscribeComponentListener

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Test
public void testUnsubscribeComponentListener() {
    DateField dateField = (DateField) factory.createComponent(DateField.NAME);

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();

    Date updateTs = new Date();
    user.setUpdateTs(updateTs);
    dateField.setDatasource(userDs, "updateTs");
    dateField.setResolution(DateField.Resolution.SEC);

    // unbind
    dateField.setDatasource(null, null);

    Component.ValueChangeListener valueChangeListener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    dateField.addValueChangeListener(valueChangeListener);

    user.setUpdateTs(new Date());
    assertEquals(updateTs, dateField.getValue());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:DateFieldDsTest.java

示例10: showFrame

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
@Override
protected void showFrame(Component parent, Frame frame) {
    // the same as web window manager does
    if (parent instanceof Component.Container) {
        Component.Container container = (Component.Container) parent;
        for (Component c : container.getComponents()) {
            if (c instanceof Component.Disposable) {
                Component.Disposable disposable =
                        (Component.Disposable) c;
                if (!disposable.isDisposed()) {
                    disposable.dispose();
                }
            }
            container.remove(c);
        }
        container.add(frame);
    } else {
        throw new IllegalStateException(
                "Parent component must be com.haulmont.cuba.gui.components.Component.Container"
        );
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:DesktopWindowManager.java

示例11: onBtnSetNewStatusClick

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
public void onBtnSetNewStatusClick(Component source) {
    Order o = ordersDs.getItem();
    if (o != null) {
        o.setStatus(OrderStatus.NEW);
        ordersDs.commit();
    }
}
 
开发者ID:cuba-platform,项目名称:sample-workshop,代码行数:8,代码来源:OrderBrowse.java

示例12: onBtnSetReadyStatusClick

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
public void onBtnSetReadyStatusClick(Component source) {
    Order o = ordersDs.getItem();
    if (o != null) {
        o.setStatus(OrderStatus.READY);
        ordersDs.commit();
    }
}
 
开发者ID:cuba-platform,项目名称:sample-workshop,代码行数:8,代码来源:OrderBrowse.java

示例13: onBtnSetInProgressStatusClick

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
public void onBtnSetInProgressStatusClick(Component source) {
    Order o = ordersDs.getItem();
    if (o != null) {
        o.setStatus(OrderStatus.IN_PROGRESS);
        ordersDs.commit();
    }
}
 
开发者ID:cuba-platform,项目名称:sample-workshop,代码行数:8,代码来源:OrderBrowse.java

示例14: initShowCommandLineAction

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
protected void initShowCommandLineAction() {
    AbstractAction action = new AbstractAction("showCommandLine") {
        @Override
        public String getCaption() {
            return "";
        }

        @Override
        public void actionPerform(Component component) {
            commandLineHBox.setVisible(!commandLineHBox.isVisible());
        }
    };
    action.setShortcut("CTRL-ALT-Q");
    addAction(action);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:16,代码来源:CalendarScreen.java

示例15: adjustTabSize

import com.haulmont.cuba.gui.components.Component; //导入依赖的package包/类
protected void adjustTabSize(Component tabComponent) {
    if (getWidth() >= 0) {
        tabComponent.setWidth("100%");
    } else {
        tabComponent.setWidth(Component.AUTO_SIZE);
    }

    if (getHeight() >= 0) {
        tabComponent.setHeight("100%");
    } else {
        tabComponent.setHeight(Component.AUTO_SIZE);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:DesktopTabSheet.java


注:本文中的com.haulmont.cuba.gui.components.Component类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。