<commit_before>/**
 * Copyright 2005-2013 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.uif.layout;

import org.apache.commons.lang.StringUtils;
import org.kuali.rice.krad.datadictionary.parse.BeanTag;
import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
import org.kuali.rice.krad.uif.component.Component;
import org.kuali.rice.krad.uif.container.Container;
import org.kuali.rice.krad.uif.element.Label;
import org.kuali.rice.krad.uif.field.Field;
import org.kuali.rice.krad.util.KRADUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * A Css Grid Layout which only takes fields as its content and separates out the field's labels into
 * separate columns
 *
 * <p>This layout does not use the container's items' colspan property to influence column size.</p>
 *
 * @author Kuali Rice Team (<EMAIL>)
 */
@BeanTag(name = "cssGridLabelColumnLayout-bean", parent = "Uif-CssGridLabelColumnLayout")
public class CssGridLabelColumnLayoutManager extends CssGridLayoutManagerBase {
    private static final long serialVersionUID = 3100360397450755904L;

    private int numberOfLabelColumns = 1;
    private String labelColumnCssClass = "";

    /**
     * CssGridLabelColumnLayoutManager's performFinalize method calculates and separates the items into rows
     *
     * @see org.kuali.rice.krad.uif.component.Component#performFinalize(org.kuali.rice.krad.uif.view.View, Object,
     *      org.kuali.rice.krad.uif.component.Component)
     */
    @Override
    public void performFinalize(Object model, Component component) {
        super.performFinalize(model, component);

        Container container = (Container) component;
        processSeparateLabelLayout(container);
    }

    /**
     * Separates the labels and field content into the appropriate number of rows and div "cells" based on
     * the numberOfLabelColumns property, by making making labels take up their own column and turning off rendering
     * them for the fields
     *
     * @param container the container using this layout manager
     */
    private void processSeparateLabelLayout(Container container) {
        int labelColumnSize = (NUMBER_OF_COLUMNS / numberOfLabelColumns) * 1 / 3;
        int fieldColumnSize = (NUMBER_OF_COLUMNS / numberOfLabelColumns) * 2 / 3;
        int itemNumber = 0;<commit_msg>[KULRICE-10017] css Grid layout column size tweaks<commit_after>/**
 * Copyright 2005-2013 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.uif.layout;

import org.apache.commons.lang.StringUtils;
import org.kuali.rice.krad.datadictionary.parse.BeanTag;
import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
import org.kuali.rice.krad.uif.component.Component;
import org.kuali.rice.krad.uif.container.Container;
import org.kuali.rice.krad.uif.element.Label;
import org.kuali.rice.krad.uif.field.Field;
import org.kuali.rice.krad.util.KRADUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * A Css Grid Layout which only takes fields as its content and separates out the field's labels into
 * separate columns
 *
 * <p>This layout does not use the container's items' colspan property to influence column size.</p>
 *
 * @author Kuali Rice Team (<EMAIL>)
 */
@BeanTag(name = "cssGridLabelColumnLayout-bean", parent = "Uif-CssGridLabelColumnLayout")
public class CssGridLabelColumnLayoutManager extends CssGridLayoutManagerBase {
    private static final long serialVersionUID = 3100360397450755904L;

    private int numberOfLabelColumns = 1;
    private String labelColumnCssClass = "";

    /**
     * CssGridLabelColumnLayoutManager's performFinalize method calculates and separates the items into rows
     *
     * @see org.kuali.rice.krad.uif.component.Component#performFinalize(org.kuali.rice.krad.uif.view.View, Object,
     *      org.kuali.rice.krad.uif.component.Component)
     */
    @Override
    public void performFinalize(Object model, Component component) {
        super.performFinalize(model, component);

        Container container = (Container) component;
        processSeparateLabelLayout(container);
    }

    /**
     * Separates the labels and field content into the appropriate number of rows and div "cells" based on
     * the numberOfLabelColumns property, by making making labels take up their own column and turning off rendering
     * them for the fields
     *
     * @param container the container using this layout manager
     */
    private void processSeparateLabelLayout(Container container) {
        int labelColumnSize = 3;
        int fieldColumnSize = 9;
        if (numberOfLabelColumns > 1) {
            labelColumnSize = (NUMBER_OF_COLUMNS / numberOfLabelColumns) * 1 / 3;
            fieldColumnSize = (NUMBER_OF_COLUMNS / numberOfLabelColumns) * 2 / 3;
        }
        int itemNumber = 0;
{'fraction_non_alphanumeric': 0.08323504633529907, 'fraction_numerical': 0.013479359730412805, 'mean_word_length': 3.8103727714748783, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6967169', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1666, 'n_words': 532}