Skip to content

Commit

Permalink
applied isEnableExperimentalFeatures flag for new assignments tab
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jul 11, 2017
1 parent 91d1b36 commit 9dc4f64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Expand Up @@ -48,7 +48,7 @@ public class FocusAssignmentsTabPanel<F extends FocusType> extends AbstractObjec
private static final String ID_ASSIGNMENTS = "assignmentsContainer";
private static final String ID_ASSIGNMENTS_PANEL = "assignmentsPanel";
private static final String DOT_CLASS = FocusAssignmentsTabPanel.class.getName() + ".";
private static final String OPERATION_GET_SYSTEM_CONFIGURATION = DOT_CLASS + "getSystemConfiguration";
private static final String OPERATION_GET_ADMIN_GUI_CONFIGURATION = DOT_CLASS + "getAdminGuiConfiguration";

private static final String MODAL_ID_ASSIGNMENTS_PREVIEW = "assignmentsPreviewPopup";

Expand All @@ -69,15 +69,8 @@ private void initLayout() {
assignments.setOutputMarkupId(true);
add(assignments);

OperationResult result = new OperationResult(OPERATION_GET_SYSTEM_CONFIGURATION);
SystemConfigurationType systemConfig = null;
try{
systemConfig = pageBase.getModelInteractionService().getSystemConfiguration(result);
} catch (Exception ex){
LOGGER.error("Cannot get system configuration object, ", ex);
}
Component panel;
if (SystemConfigurationTypeUtil.isExperimentalCodeEnabled(systemConfig)){
if (isEnableExperimentalFeatures()){
panel = new AssignmentDataTablePanel(ID_ASSIGNMENTS_PANEL, assignmentsModel, pageBase);
} else {
panel = new AssignmentTablePanel(ID_ASSIGNMENTS_PANEL,
Expand Down Expand Up @@ -108,6 +101,19 @@ protected void showAllAssignments(AjaxRequestTarget target) {
assignments.add(panel);
}

private boolean isEnableExperimentalFeatures(){
OperationResult result = new OperationResult(OPERATION_GET_ADMIN_GUI_CONFIGURATION);
AdminGuiConfigurationType adminGuiConfig = null;
try{
adminGuiConfig = pageBase.getModelInteractionService().getAdminGuiConfiguration(pageBase.createSimpleTask(OPERATION_GET_ADMIN_GUI_CONFIGURATION), result);
} catch (Exception ex){
LOGGER.error("Cannot get admin gui configuration object, ", ex);
}
return adminGuiConfig != null && adminGuiConfig.isEnableExperimentalFeatures() != null &&
adminGuiConfig.isEnableExperimentalFeatures();

}

public boolean isAssignmentsModelChanged(){
return getAssignmentTablePanel().isModelChanged();
}
Expand Down
Expand Up @@ -60,6 +60,9 @@ private static void applyAdminGuiConfiguration(AdminGuiConfigurationType composi
if (adminGuiConfiguration.getPreferredDataLanguage() != null) {
composite.setPreferredDataLanguage(adminGuiConfiguration.getPreferredDataLanguage());
}
if (adminGuiConfiguration.isEnableExperimentalFeatures() != null) {
composite.setEnableExperimentalFeatures(adminGuiConfiguration.isEnableExperimentalFeatures());
}
if (adminGuiConfiguration.getObjectLists() != null) {
if (composite.getObjectLists() == null) {
composite.setObjectLists(adminGuiConfiguration.getObjectLists().clone());
Expand Down

0 comments on commit 9dc4f64

Please sign in to comment.