Example usage for org.apache.poi.xslf.usermodel XSLFSlideLayout getName

List of usage examples for org.apache.poi.xslf.usermodel XSLFSlideLayout getName

Introduction

In this page you can find the example usage for org.apache.poi.xslf.usermodel XSLFSlideLayout getName.

Prototype

public String getName() 

Source Link

Usage

From source file:org.joeffice.presentation.actions.NewSlideAction.java

License:Apache License

private XSLFSlideLayout getSlideLayout(XMLSlideShow presentation) {
    XSLFSlideMaster defaultMaster = presentation.getSlideMasters()[0];
    String askLayout = NbBundle.getMessage(getClass(), "MSG_ChooseLayout");
    JComboBox layoutsCombo = new JComboBox();
    for (XSLFSlideLayout layout : defaultMaster.getSlideLayouts()) {
        layoutsCombo.addItem(layout.getName());
    }//w  w  w  . j  ava2 s.c om

    Object dialogAnswer = OfficeUIUtils.ask(askLayout, DialogDescriptor.OK_CANCEL_OPTION, askLayout,
            layoutsCombo);
    if (dialogAnswer == DialogDescriptor.OK_OPTION) {
        int selectedIndex = layoutsCombo.getSelectedIndex();
        XSLFSlideLayout slideLayout = defaultMaster.getSlideLayouts()[selectedIndex];
        return slideLayout;
    }
    return null;
}