com.vaadin.data.Item Java Examples

The following examples show how to use com.vaadin.data.Item. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WinLogView.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
private Container getServerList(Container container) {
    InstanceService instanceService = BeanContext.getBean(InstanceService.class);

    if (cmbMyCloud.getValue() != null) {
        Long farmNo = (Long) cmbMyCloud.getValue();
        List<InstanceDto> instanceDtos;
        instanceDtos = instanceService.getInstances(farmNo);

        for (InstanceDto instanceDto : instanceDtos) {
            Item item;
            item = container.addItem(instanceDto.getInstance().getInstanceNo());
            item.getItemProperty("serverName").setValue(instanceDto.getInstance().getInstanceName());
        }
    }

    return container;
}
 
Example #2
Source File: ZookeeperProviderManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 创建删除按钮
 * @return
 */
private Button createDeleteButton() {
    Button deleteButton = new Button("删除",FontAwesome.CLOSE);
    deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
        //validate
        Collection<Object> items = grid.getSelectedRows();
        if(items.size() == 0){
            Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
            return;
        }
        //batch delete
        for (Object object : items) {
            Item item = grid.getContainerDataSource().getItem(object);
            if (item != null) {
                Long id = (Long) item.getItemProperty("序号").getValue();
                zookeeperProviderRepository.delete(id);
            }
        }
        search();
    });
    return deleteButton;
}
 
Example #3
Source File: ZookeeperProviderManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #4
Source File: ZookeeperAppManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        Long appId = (Long) item.getItemProperty("序号").getValue();
        String appName = (String) item.getItemProperty("应用名称").getValue();
        if ("清理".equals(pId)) {
            zookeeperAppClearUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppClearUI);
        } else if ("切换".equals(pId)) {
            zookeeperAppSwitchUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppSwitchUI);
        }
    }));
}
 
Example #5
Source File: ZookeeperConsumerManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 创建删除按钮
 * @return
 */
private Button createDeleteButton() {
    Button deleteButton = new Button("删除",FontAwesome.CLOSE);
    deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
        //validate
        Collection<Object> items = grid.getSelectedRows();
        if(items.size() == 0){
            Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
            return;
        }
        //batch delete
        for (Object object : items) {
            Item item = grid.getContainerDataSource().getItem(object);
            if (item != null) {
                Long id = (Long) item.getItemProperty("序号").getValue();
                zookeeperConsumerRepository.delete(id);
            }
        }
        search();
    });
    return deleteButton;
}
 
Example #6
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
private IndexedContainer createElasticIpContainer() {
    IndexedContainer elasticIpContainer = new IndexedContainer();
    elasticIpContainer.addContainerProperty(ELASTIC_IP_CAPTION_ID, String.class, null);

    String dynamic = ViewProperties.getCaption("field.elasticIp.dynamic");
    String associated = ViewProperties.getCaption("field.elasticIp.associated");

    // ElasticIP無しの項目
    Item item = elasticIpContainer.addItem(NULL_ADDRESS);
    item.getItemProperty(ELASTIC_IP_CAPTION_ID).setValue(dynamic);

    for (AddressDto address : elasticIps) {
        item = elasticIpContainer.addItem(address);

        //InstanceNoがNullならPool状態
        if (null == address.getInstanceNo()) {
            item.getItemProperty(ELASTIC_IP_CAPTION_ID).setValue(address.getPublicIp());
        } else {
            item.getItemProperty(ELASTIC_IP_CAPTION_ID).setValue(address.getPublicIp() + " " + associated);
        }
    }

    return elasticIpContainer;
}
 
Example #7
Source File: ZookeeperAppManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        Long appId = (Long) item.getItemProperty("序号").getValue();
        String appName = (String) item.getItemProperty("应用名称").getValue();
        if ("清理".equals(pId)) {
            zookeeperAppClearUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppClearUI);
        } else if ("切换".equals(pId)) {
            zookeeperAppSwitchUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppSwitchUI);
        }
    }));
}
 
Example #8
Source File: ZookeeperAppManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 创建删除按钮
 * @return
 */
private Button createDeleteButton() {
    Button deleteButton = new Button("删除",FontAwesome.CLOSE);
    deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
        //validate
        Collection<Object> items = grid.getSelectedRows();
        if(items.size() == 0){
            Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
            return;
        }
        //batch delete
        for (Object object : items) {
            Item item = grid.getContainerDataSource().getItem(object);
            if(item != null){
                Long id = (Long) item.getItemProperty("序号").getValue();
                zookeeperAppRepository.delete(id);
            }
        }
        search();
    });
    return deleteButton;
}
 
Example #9
Source File: ZookeeperProviderManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #10
Source File: RolloutListGrid.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void handleEvent(final RolloutChangedEvent rolloutChangeEvent) {
    if (!rolloutUIState.isShowRollOuts() || rolloutChangeEvent.getRolloutId() == null) {
        return;
    }
    final Optional<Rollout> rollout = rolloutManagement.getWithDetailedStatus(rolloutChangeEvent.getRolloutId());

    if (!rollout.isPresent()) {
        return;
    }
    final GeneratedPropertyContainer rolloutContainer = (GeneratedPropertyContainer) getContainerDataSource();
    final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
    if (item == null) {
        refreshContainer();
        return;
    }

    updateItem(rollout.get(), item);
}
 
Example #11
Source File: TargetFilterQueryDetailsTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Populate software module metadata.
 *
 * @param distributionSet
 *            the selected distribution set
 */
public void populateTableByDistributionSet(final DistributionSet distributionSet) {
    removeAllItems();
    if (distributionSet == null) {
        return;
    }

    final Container dataSource = getContainerDataSource();
    final List<TargetFilterQuery> filters = distributionSet.getAutoAssignFilters();
    filters.forEach(query -> {
        final Object itemId = dataSource.addItem();
        final Item item = dataSource.getItem(itemId);
        item.getItemProperty(TFQ_NAME).setValue(query.getName());
        item.getItemProperty(TFQ_QUERY).setValue(query.getQuery());
    });

}
 
Example #12
Source File: AbstractFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private DragAndDropWrapper addGeneratedCell(final Object itemId) {

        final Item item = getItem(itemId);
        final Long id = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_ID).getValue();
        final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
        final String desc = (String) item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue() != null
                ? item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue().toString()
                : null;
        final String color = (String) item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue() != null
                ? item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue().toString()
                : DEFAULT_GREEN;
        final Button typeButton = createFilterButton(id, name, desc, color, itemId);
        typeButton.addClickListener(filterButtonClickBehaviour::processFilterButtonClick);

        if ((NO_TAG_BUTTON_ID.equals(typeButton.getData()) && isNoTagStateSelected())
                || (id != null && isClickedByDefault(name))) {
            filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
        }

        return createDragAndDropWrapper(typeButton, name, id);
    }
 
Example #13
Source File: PolicyContainer.java    From XACML with MIT License 6 votes vote down vote up
@Override
public Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException {
	if (logger.isTraceEnabled()) {
		logger.trace("addItemAfter: " + previousItemId + " new " + newItemId);
	}
	/*
	if (newItemId instanceof PolicySetType) {
		
	}
	//
	// Get our parents
	//
	Object parentPreviousItem = this.getParent(previousItemId);
	*/
	return null;
}
 
Example #14
Source File: RolloutListGrid.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void deleteRollout(final Long rolloutId) {
    final Optional<Rollout> rollout = rolloutManagement.getWithDetailedStatus(rolloutId);

    if (!rollout.isPresent()) {
        return;
    }

    final String formattedConfirmationQuestion = getConfirmationQuestion(rollout.get());
    final ConfirmationDialog confirmationDialog = new ConfirmationDialog(
            i18n.getMessage("caption.entity.delete.action.confirmbox"), formattedConfirmationQuestion,
            i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL),
            ok -> {
                if (!ok) {
                    return;
                }
                final Item row = getContainerDataSource().getItem(rolloutId);
                final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
                rolloutManagement.delete(rolloutId);
                uiNotification.displaySuccess(i18n.getMessage("message.rollout.deleted", rolloutName));
            }, UIComponentIdProvider.ROLLOUT_DELETE_CONFIRMATION_DIALOG);
    UI.getCurrent().addWindow(confirmationDialog.getWindow());
    confirmationDialog.getWindow().bringToFront();
}
 
Example #15
Source File: DistributionSetTypeSoftwareModuleSelectLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void addTooltTipToSelectedTable() {
    selectedTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
            final Item item = selectedTable.getItem(itemId);
            final String description = (String) (item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
            if (DIST_TYPE_NAME.equals(propertyId) && !StringUtils.isEmpty(description)) {
                return i18n.getMessage("label.description") + description;
            } else if (DIST_TYPE_MANDATORY.equals(propertyId)) {
                return i18n.getMessage(UIMessageIdProvider.TOOLTIP_CHECK_FOR_MANDATORY);
            }
            return null;
        }
    });
}
 
Example #16
Source File: RolloutListGrid.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void startOrResumeRollout(final Long rolloutId) {
    final Item row = getContainerDataSource().getItem(rolloutId);

    final RolloutStatus rolloutStatus = (RolloutStatus) row.getItemProperty(SPUILabelDefinitions.VAR_STATUS)
            .getValue();
    final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();

    if (RolloutStatus.READY == rolloutStatus) {
        rolloutManagement.start(rolloutId);
        uiNotification.displaySuccess(i18n.getMessage("message.rollout.started", rolloutName));
        return;
    }

    if (RolloutStatus.PAUSED == rolloutStatus) {
        rolloutManagement.resumeRollout(rolloutId);
        uiNotification.displaySuccess(i18n.getMessage("message.rollout.resumed", rolloutName));
    }
}
 
Example #17
Source File: UpdateDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void addTargetTableForUpdate(final SoftwareModuleType swModuleType, final boolean mandatory) {
    if (getTwinTables().getSelectedTableContainer() == null) {
        return;
    }
    final Item saveTblitem = getTwinTables().getSelectedTableContainer().addItem(swModuleType.getId());
    getTwinTables().getSourceTable().removeItem(swModuleType.getId());
    saveTblitem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeName())
            .setValue(swModuleType.getName());
    final CheckBox mandatoryCheckbox = new CheckBox("", mandatory);
    mandatoryCheckbox.setId(swModuleType.getName());
    saveTblitem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeMandatory())
            .setValue(mandatoryCheckbox);

    final Item originalItem = originalSelectedTableContainer.addItem(swModuleType.getId());
    originalItem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeName())
            .setValue(swModuleType.getName());
    originalItem.getItemProperty(DistributionSetTypeSoftwareModuleSelectLayout.getDistTypeMandatory())
            .setValue(mandatoryCheckbox);

    getWindow().updateAllComponents(mandatoryCheckbox);
}
 
Example #18
Source File: ZookeeperConsumerManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 创建删除按钮
 * @return
 */
private Button createDeleteButton() {
    Button deleteButton = new Button("删除",FontAwesome.CLOSE);
    deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
        //validate
        Collection<Object> items = grid.getSelectedRows();
        if(items.size() == 0){
            Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
            return;
        }
        //batch delete
        for (Object object : items) {
            Item item = grid.getContainerDataSource().getItem(object);
            if (item != null) {
                Long id = (Long) item.getItemProperty("序号").getValue();
                zookeeperConsumerRepository.delete(id);
            }
        }
        search();
    });
    return deleteButton;
}
 
Example #19
Source File: DistributionSetTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void addTableStyleGenerator() {
    setCellStyleGenerator((source, itemId, propertyId) -> {
        if (propertyId == null) {
            // Styling for row
            final Item item = getItem(itemId);
            final Boolean isComplete = (Boolean) item
                    .getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
            if (!isComplete) {
                return SPUIDefinitions.DISABLE_DISTRIBUTION;
            }
            return null;
        } else {
            return null;
        }
    });
}
 
Example #20
Source File: ActionStatusMsgGrid.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Component getDetails(final RowReference rowReference) {
    // Find the bean to generate details for
    final Item item = rowReference.getItem();
    final String message = (String) item.getItemProperty(ProxyMessage.PXY_MSG_VALUE).getValue();

    final TextArea textArea = new TextArea();
    textArea.addStyleName(ValoTheme.TEXTAREA_BORDERLESS);
    textArea.addStyleName(ValoTheme.TEXTAREA_TINY);
    textArea.addStyleName("inline-icon");
    textArea.setHeight(120, Unit.PIXELS);
    textArea.setWidth(100, Unit.PERCENTAGE);
    textArea.setValue(message);
    textArea.setReadOnly(Boolean.TRUE);
    return textArea;
}
 
Example #21
Source File: AbstractMetadataPopupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected Item addItemToGrid(final M metaData) {
    final IndexedContainer metadataContainer = (IndexedContainer) metaDataGrid.getContainerDataSource();
    final Item item = metadataContainer.addItem(metaData.getKey());
    item.getItemProperty(VALUE).setValue(metaData.getValue());
    item.getItemProperty(KEY).setValue(metaData.getKey());
    return item;
}
 
Example #22
Source File: WinLogView.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
void fillContainer(Container container, List<EventLog> eventLogs) {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
    int i = 0;
    for (EventLog eventLog : eventLogs) {
        String id = String.valueOf(i++);
        Item item = container.addItem(id);
        item.getItemProperty("DateTime").setValue(simpleDateFormat.format(eventLog.getLogDate()));
        item.getItemProperty("LogLevel").setValue(transformLogLevel(eventLog.getLogLevel()));
        item.getItemProperty("myCloud").setValue(eventLog.getFarmName());
        item.getItemProperty("Service").setValue(eventLog.getComponentName());
        item.getItemProperty("Server").setValue(eventLog.getInstanceName());
        item.getItemProperty("Message").setValue(eventLog.getMessage());
    }
}
 
Example #23
Source File: WinLogView.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private IndexedContainer getLogLevelList() {
    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty("logLevel", String.class, null);

    for (EventLogLevel eventLogLevel : EventLogLevel.values()) {
        if (eventLogLevel == EventLogLevel.ALL || eventLogLevel == EventLogLevel.OFF) {
            continue;
        }
        Item item;
        item = container.addItem(eventLogLevel.getCode());
        item.getItemProperty("logLevel").setValue(eventLogLevel.name());
    }
    return container;
}
 
Example #24
Source File: DistributionSetDetails.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void updateSoftwareModule(final SoftwareModule module) {
    if (assignedSWModule == null) {
        assignedSWModule = new HashMap<>();
    }

    getSoftwareModuleTable().getContainerDataSource().getItemIds();
    if (assignedSWModule.containsKey(module.getType().getName())) {

        /*
         * If the module type allows multiple assignments, just append the
         * module entry to the list.
         */
        if (module.getType().getMaxAssignments() > 1) {
            assignedSWModule.get(module.getType().getName()).append("</br>").append("<I>")
                    .append(getUnsavedAssignedSwModule(module.getName(), module.getVersion())).append("</I>");
        }

        /*
         * If the module type does not allow multiple assignments, override
         * the previous module entry.
         */
        if (module.getType().getMaxAssignments() == 1) {
            assignedSWModule.put(module.getType().getName(), new StringBuilder().append("<I>")
                    .append(getUnsavedAssignedSwModule(module.getName(), module.getVersion())).append("</I>"));
        }

    } else {
        assignedSWModule.put(module.getType().getName(), new StringBuilder().append("<I>")
                .append(getUnsavedAssignedSwModule(module.getName(), module.getVersion())).append("</I>"));
    }

    for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
        final Item item = getSoftwareModuleTable().getContainerDataSource().getItem(entry.getKey());
        if (item != null) {
            item.getItemProperty(SOFT_MODULE).setValue(createSoftwareModuleLayout(entry.getValue().toString()));
        }
    }
}
 
Example #25
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void updateVisibleItemOnEvent(final Target target) {
    final Long targetId = target.getId();

    final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
    final Item item = targetContainer.getItem(targetId);

    item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(target.getUpdateStatus());
    item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(target.getName());
    item.getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP)
            .setValue(HawkbitCommonUtil.getPollStatusToolTip(target.getPollStatus(), getI18n()));
}
 
Example #26
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private String createTargetTableStyle(final Object itemId, final Object propertyId) {
    if (propertyId == null) {
        final Item item = getItem(itemId);
        final Long assignedDistributionSetId = (Long) item
                .getItemProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_ID).getValue();
        final Long installedDistributionSetId = (Long) item
                .getItemProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_ID).getValue();
        return getTargetTableStyle(assignedDistributionSetId, installedDistributionSetId);
    }
    return null;
}
 
Example #27
Source File: GitRepositoryContainer.java    From XACML with MIT License 5 votes vote down vote up
@Override
public Item addItem(Object itemId) throws UnsupportedOperationException {
	if (! (itemId instanceof File)) {
        throw new UnsupportedOperationException(
                "Git repository container does not support this operation for Objects that are not files.");
	}
	if (logger.isTraceEnabled()) {
		logger.trace("addItem: " + ((File)itemId).hashCode() + " " + ((File)itemId).getName());
	}

	fireItemSetChange();
  	
    return new FileItem((File) itemId);
}
 
Example #28
Source File: GitRepositoryContainer.java    From XACML with MIT License 5 votes vote down vote up
@Override
public Item getItem(Object itemId) {

	if (logger.isTraceEnabled()) {
		logger.trace("getItem: " + ((File)itemId).hashCode() + " " + ((File)itemId).getName());
	}

	if (!(itemId instanceof File)) {
        return null;
    }
    return new FileItem((File) itemId);
}
 
Example #29
Source File: PDPGroupContainer.java    From XACML with MIT License 5 votes vote down vote up
@Override
public Item getItem(Object itemId) {
	if (logger.isTraceEnabled()) {
		logger.trace("getItem: " + itemId);
	}
	if (this.isSupported(itemId)) {
		return new PDPGroupItem((PDPGroup) itemId);
	}
	return null;
}
 
Example #30
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
private IndexedContainer createKeyPairContainer() {
    IndexedContainer keyPairContainer = new IndexedContainer();
    keyPairContainer.addContainerProperty(CID_KEY_PAIR, String.class, null);

    for (KeyPairDto keyPairDto : vcloudKeyPairs) {
        Item item = keyPairContainer.addItem(keyPairDto.getKeyNo());
        item.getItemProperty(CID_KEY_PAIR).setValue(keyPairDto.getKeyName());
    }

    return keyPairContainer;
}