Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 22, 2014
2 parents 7bcd973 + fe38e9e commit 3c96da7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Expand Up @@ -42,6 +42,7 @@
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.markup.html.basic.Label;
Expand Down Expand Up @@ -132,7 +133,7 @@ private void initLoggers() {
new PropertyModel<List<LoggerConfiguration>>(getModel(), "loggers"));
TablePanel table = new TablePanel<>(ID_LOGGERS_TABLE, provider, initLoggerColumns());
table.setOutputMarkupId(true);
table.setShowPaging(false);
table.setShowPaging(true);
add(table);

AjaxButton addStandardLogger = new AjaxButton(ID_BUTTON_ADD_STANDARD_LOGGER,
Expand Down Expand Up @@ -174,8 +175,6 @@ public void onClick(AjaxRequestTarget target) {
}
};
add(deleteLogger);

//initProfiling();
}

private void initRoot() {
Expand Down Expand Up @@ -259,6 +258,8 @@ private void addStandardLoggerPerformed(AjaxRequestTarget target){
logger.setEditing(true);
dto.getLoggers().add(logger);

TablePanel loggersTable = getLoggersTable();
adjustLoggersTablePage(loggersTable, dto);
target.add(getLoggersTable());
}

Expand All @@ -268,7 +269,9 @@ private void addComponentLoggerPerformed(AjaxRequestTarget target) {
logger.setEditing(true);
dto.getLoggers().add(logger);

target.add(getLoggersTable());
TablePanel loggersTable = getLoggersTable();
adjustLoggersTablePage(loggersTable, dto);
target.add(loggersTable);
}

private void addClassLoggerPerformed(AjaxRequestTarget target) {
Expand All @@ -277,9 +280,21 @@ private void addClassLoggerPerformed(AjaxRequestTarget target) {
logger.setEditing(true);
dto.getLoggers().add(logger);

TablePanel loggersTable = getLoggersTable();
adjustLoggersTablePage(loggersTable, dto);
target.add(getLoggersTable());
}

private void adjustLoggersTablePage(TablePanel loggersTable, LoggingDto dto){
if(loggersTable != null && dto.getLoggers().size() % 10 == 1 && dto.getLoggers().size() != 1){
DataTable table = loggersTable.getDataTable();

if(table != null){
table.setCurrentPage((long)(dto.getLoggers().size()/10));
}
}
}

private TablePanel getLoggersTable() {
return (TablePanel) get(ID_LOGGERS_TABLE);
}
Expand Down
Expand Up @@ -30,7 +30,7 @@ public abstract class LoggerConfiguration extends Selectable implements Editable

private boolean editing;
private LoggingLevelType level;
private List<String> appenders = new ArrayList<String>();
private List<String> appenders = new ArrayList<>();

public abstract String getName();
public abstract void setName(String name);
Expand Down
Expand Up @@ -32,7 +32,7 @@ public class LoggingDto implements Serializable {
public static String F_APPENDERS = "appenders";

public static final String LOGGER_PROFILING = "PROFILING";
public static final Map<String, LoggingComponentType> componentMap = new HashMap<String, LoggingComponentType>();
public static final Map<String, LoggingComponentType> componentMap = new HashMap<>();

static {
componentMap.put("com.evolveum.midpoint", LoggingComponentType.ALL);
Expand All @@ -51,13 +51,13 @@ public class LoggingDto implements Serializable {
private LoggingLevelType rootLevel;
private String rootAppender;

private List<LoggerConfiguration> loggers = new ArrayList<LoggerConfiguration>();
private List<FilterConfiguration> filters = new ArrayList<FilterConfiguration>();
private List<LoggerConfiguration> loggers = new ArrayList<>();
private List<FilterConfiguration> filters = new ArrayList<>();

private ProfilingLevel profilingLevel;
private String profilingAppender;

private List<AppenderConfiguration> appenders = new ArrayList<AppenderConfiguration>();
private List<AppenderConfiguration> appenders = new ArrayList<>();

private boolean auditLog = false;
private boolean auditDetails;
Expand Down

0 comments on commit 3c96da7

Please sign in to comment.