Example #1
0
 @Override
 public void set(Component newComponent, String name) {
   clear();
   owner.addTab(newComponent, name);
   owner.setSelectedTab(newComponent);
   current = newComponent;
 }
Example #2
0
  public OutputStream receiveUpload(String filename, String MIMEType) {
    mainTabs.setReadOnly(true);
    subTabs.setReadOnly(true);
    FileOutputStream fos = null; // Output stream to write to
    file = new File(filename);

    try {
      System.out.println(MIMEType);
      if (MIMEType.equalsIgnoreCase("text/plain")
          || MIMEType.equalsIgnoreCase(
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
          || MIMEType.equalsIgnoreCase("application/octet-stream")) {
        fos = new FileOutputStream(file);
      } else {
      }

    } catch (final java.io.FileNotFoundException e) {
      Label l = new Label("<h4 style='color:red'>" + e.getMessage() + "</h4>");
      l.setContentMode(Label.CONTENT_XHTML);
      expDetails.addComponent(l);
      e.printStackTrace();
      return null;
    } catch (final Exception e) {
      // Error while opening the file. Not reported here.
      e.printStackTrace();
      return null;
    }

    return fos; // Return the output stream to write to
  }
 private AbstractComponent getTestTabsheet() {
   TabSheet tabsheet = new TabSheet();
   tabsheet.setSizeUndefined();
   tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource(GLOBE_16_PNG));
   tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
   return tabsheet;
 }
 public PackagePanel(HSAdminSession session, Object itemId) throws RpcException {
   this.session = session;
   final Panel panel = new Panel();
   panel.setSizeFull();
   final TabSheet tabsheet = createTabs(itemId);
   tabsheet.setSizeFull();
   panel.setContent(tabsheet);
   setCompositionRoot(panel);
 }
  public void buildView() {
    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    VerticalLayout layoutUtama = new VerticalLayout();
    layoutUtama.setSizeFull();
    layoutUtama.setMargin(true);

    // LAYOUT TOP
    VerticalLayout layoutTop = new VerticalLayout();
    layoutTop.setMargin(true);
    HorizontalLayout layoutTopInner1 = new HorizontalLayout();
    HorizontalLayout layoutTopInner2 = new HorizontalLayout();
    layoutTop.addComponent(layoutTopInner1);
    layoutTop.addComponent(layoutTopInner2);

    // LAYOUT TABLE
    VerticalLayout layoutTable = new VerticalLayout();
    layoutTable.setSizeFull();
    layoutTable.addComponent(table);
    table.setSizeFull();

    // LAYOUT BOTTOM
    VerticalLayout layoutBottom = new VerticalLayout();
    HorizontalLayout layoutFooter1 = new HorizontalLayout();
    HorizontalLayout layoutFooter2 = new HorizontalLayout();
    layoutBottom.addComponent(layoutFooter1);
    layoutBottom.addComponent(layoutFooter2);

    // LAYOUT UTAMA
    layoutUtama.addComponent(layoutTop);
    layoutUtama.addComponent(layoutTable);
    layoutUtama.addComponent(layoutBottom);

    tabSheet.addComponent(layoutUtama);
    content.addComponent(tabSheet);
    setCompositionRoot(content);

    // Extended Konfigurasi Size
    layoutUtama.setExpandRatio(layoutTable, 1);

    layoutTopInner1.addComponent(fieldSearchById);
    layoutTopInner1.setComponentAlignment(fieldSearchById, Alignment.BOTTOM_CENTER);
    layoutTopInner1.addComponent(comboSearchByDivision);
    layoutTopInner1.setComponentAlignment(comboSearchByDivision, Alignment.BOTTOM_CENTER);
    layoutTopInner1.addComponent(dateFieldSearchByTransdateFrom);
    layoutTopInner1.setComponentAlignment(dateFieldSearchByTransdateFrom, Alignment.BOTTOM_CENTER);
    layoutTopInner1.addComponent(dateFieldSearchByTransdateTo);
    layoutTopInner1.setComponentAlignment(dateFieldSearchByTransdateTo, Alignment.BOTTOM_CENTER);

    layoutTopInner1.addComponent(btnSearch);
    layoutTopInner1.setComponentAlignment(btnSearch, Alignment.BOTTOM_CENTER);

    layoutBottom.addComponent(btnSelect);

    // init
    formLayout.setVisible(true);
  }
Example #6
0
  @AutoGenerated
  private TabSheet buildTabSheetClient() {
    // common part: create layout
    tabSheetClient = new TabSheet();
    tabSheetClient.setImmediate(true);
    tabSheetClient.setWidth("100.0%");
    tabSheetClient.setHeight("100.0%");

    // generalLayout
    generalLayout = buildGeneralLayout();
    tabSheetClient.addTab(generalLayout, "General", null);

    // addressLayout
    addressLayout = buildAddressLayout();
    tabSheetClient.addTab(addressLayout, "Dirección", null);

    // securityLayout
    securityLayout = buildSecurityLayout();
    tabSheetClient.addTab(securityLayout, "Seguridad", null);

    // organizationLayout
    organizationLayout = buildOrganizationLayout();
    tabSheetClient.addTab(organizationLayout, "Organización", null);

    // applicationverticalLayout
    applicationverticalLayout = buildApplicationverticalLayout();
    tabSheetClient.addTab(applicationverticalLayout, "Aplicaciones", null);

    // rolLayout
    rolLayout = buildRolLayout();
    tabSheetClient.addTab(rolLayout, "Rol", null);

    return tabSheetClient;
  }
Example #7
0
 @Override
 public void clear() {
   if (current != null) {
     final Tab tab = owner.getTab(current);
     if (tab != null) {
       owner.removeTab(tab);
     }
     current = null;
     previous = null;
   }
 }
Example #8
0
  public CustomerMenu(MshenguMain app, String selectedTab) {
    main = app;

    Label heading = new Label("CREATE A NEW CUSTOMER");
    heading.setSizeUndefined();
    heading.addStyleName("h4");
    VerticalLayout customerDetailsTab = new VerticalLayout();
    customerDetailsTab.setMargin(true);
    customerDetailsTab.addComponent(new CustomerDetailsTab(main));

    customerContractsTab = new CustomerContractsTab(main);
    newCustomerTab = new NewCustomerTab(app);
    //        customerContractsTab.setMargin(true);
    //        customerContractsTab.addComponent(new CustomerContractsTab(main));

    tab = new TabSheet();
    tab.setHeight("100%");
    tab.setWidth("100%");
    tab.addTab(customerDetailsTab, "Customer Details", null);
    tab.addTab(customerContractsTab, "Hiring Terms", null);
    tab.addTab(newCustomerTab, "New Customer Form", null);

    if (selectedTab.equals("LANDING")) {
      tab.setSelectedTab(customerDetailsTab);
    } else if (selectedTab.equals("CONTRACTS")) {
      tab.setSelectedTab(customerContractsTab);
    } else if (selectedTab.equals("New_Customer")) {
      tab.setSelectedTab(newCustomerTab);
    }
    addComponent(heading);
    addComponent(tab);
    setMargin(true);
  }
  /** Shows the tab and put into the foreground, if no query is executed yet. */
  private void showTab() {
    if (mainTab == null) {
      mainTab = ui.getMainTab();
    }

    if (mainTab != null) {
      tab = mainTab.getTab(this);
      tab.getComponent().addStyleName("example-queries-tab");
      tab.setEnabled(true);

      if (!(mainTab.getSelectedTab() instanceof ResultViewPanel)) {
        mainTab.setSelectedTab(tab);
      }
    }
  }
  /** Constructor initializes View. */
  public EvaluationView() {
    this.setSizeFull();

    // buildMainLayout

    // Tab 1 content
    //		tab1 = new VerticalLayout();
    //		tab1.setMargin(true);
    //		tab1.addComponent(buildTab1Content());

    // Tab 2 content
    tab2 = new VerticalLayout();
    tab2.setMargin(true);
    tab2.addComponent(buildTab2Content());

    // Tab 3 content
    tab3 = new VerticalLayout();
    tab3.setMargin(true);
    tab3.addComponent(buildTab3Content());

    tabsheet = new TabSheet();
    // tabsheet.setSizeFull();
    //		tabsheet.addTab(tab1, "Home");
    tabsheet.addTab(tab2, "Annotation");
    tabsheet.addTab(tab3, "Evaluation");

    // reset to default status
    this.resetComponents();

    this.addComponent(tabsheet);
  }
Example #11
0
  @Override
  public void init() {
    setMainWindow(mainWindow);
    setTheme("bluesmoke");

    helper = new SpringContextHelper(this);
    feed = (OHLCFeed) helper.getBean("feed");
    correlatorPool = (CorrelatorPool) helper.getBean("correlatorPool");
    correlatorBuilderManager =
        (CorrelatorBuilderManager) helper.getBean("correlatorBuilderManager");
    emulator = (PassageOfTimeEmulationWorker) helper.getBean("emulator");

    buildMainLayout();
    mainWindow.setContent(mainLayout);
    mainLayout.setSizeFull();
    mainWindow.addListener(
        new Window.CloseListener() {
          public void windowClose(Window.CloseEvent e) {
            analytics.terminate();
          }
        });
    mainWindow.addListener(
        new Window.ResizeListener() {
          public void windowResized(Window.ResizeEvent e) {
            analytics.resize();
          }
        });
    mainWindow.addComponent(pusher);
  }
Example #12
0
 @Override
 public void change(final Component newComponent) {
   final Component oldComponent = current;
   owner.replaceComponent(oldComponent, newComponent);
   previous = oldComponent;
   current = newComponent;
 }
  public void setComponentStyles() {
    //		if (! getUI().getTheme().equals("vaadin_theme")) {
    //			tableList.addStyleName("compact small");
    //			tableDetil.addStyleName("compact small");
    //
    //			fieldOrderno.addStyleName("small");
    //			fieldInvoiceno.addStyleName("small");
    //			comboTipeJual.addStyleName("small");
    //			comboSalesman.addStyleName("small");
    //			comboCustomer.addStyleName("small");
    //			dateFieldOrderdate.addStyleName("small");
    //			dateFieldInvoicedate.addStyleName("small");
    //			comboTunaikredit.addStyleName("small");
    //			comboTop.addStyleName("small");
    //			dateFieldDuedate.addStyleName("small");
    //			comboWarehouse.addStyleName("small");
    //			checkEndofday.addStyleName("small");
    //			checkSaldo.addStyleName("small");
    //			checkSearch1.addStyleName("small");

    btnSearch.addStyleName("small");
    btnNewForm.addStyleName("small");
    btnEditForm.addStyleName("small");
    btnDeleteForm.addStyleName("small");
    //			btnPrint.addStyleName("small");

    btnSaveForm.addStyleName("small");
    btnCancelForm.addStyleName("small");

    btnAddItem.addStyleName("small");
    btnEditItem.addStyleName("small");
    btnRemoveItem.addStyleName("small");

    btnPosting.addStyleName("small");
    btnLapselisih.addStyleName("small");
    btnPostingBatal.addStyleName("small");

    btnSeparator1.addStyleName("small");
    btnSeparator2.addStyleName("small");

    //		}

    //		tabSheet.addStyleName("framed compact-tabbar small");
    tabSheet.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabSheet.addStyleName(Reindeer.TABSHEET_SMALL);
  }
Example #14
0
  @Override
  protected ComponentContainer createBottomPanel() {
    final TabSheet tabContainer = new TabSheet();
    tabContainer.setWidth("100%");

    tabContainer.addTab(
        this.noteListItems, "Notes", MyCollabResource.newResource("icons/16/crm/note.png"));
    tabContainer.addTab(
        this.associateActivityList,
        "Activities",
        MyCollabResource.newResource("icons/16/crm/calendar.png"));
    tabContainer.addTab(
        this.associateOpportunityList,
        "Opportunities",
        MyCollabResource.newResource("icons/16/crm/opportunity.png"));
    return tabContainer;
  }
Example #15
0
 @Override
 public void back() {
   final Component oldComponent = current;
   final Component newComponent = previous;
   owner.replaceComponent(oldComponent, newComponent);
   previous = null;
   current = newComponent;
 }
  @Override
  protected void setup(VaadinRequest request) {

    final TabSheet tabsheet = new TabSheet();
    tabsheet.setWidth("400px");

    Component lastLabel = null;

    for (int i = 1; i <= 5; i++) {
      String caption = "Tab " + i;
      Label label = new Label(caption);
      tabsheet.addTab(label, caption);

      lastLabel = label;
    }

    tabsheet.setSelectedTab(0);

    final Component lastTab = lastLabel;

    tabsheet.addSelectedTabChangeListener(
        new SelectedTabChangeListener() {

          @Override
          public void selectedTabChange(SelectedTabChangeEvent event) {
            if (tabsheet.getSelectedTab().equals(lastTab)) {

              // Set focus back to first tab in tabsheet
              tabsheet.setSelectedTab(0);
              Notification.show("Focus set back to tab at position 0");
            }
          }
        });

    addComponent(tabsheet);

    addButton(
        "Select Last Tab",
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            tabsheet.setSelectedTab(lastTab);
          }
        });
  }
Example #17
0
  /**
   * Loads a dynamic tab as a <code>Layout</code> which is then added to the given TabSheet given
   * <code>TabSheet</code>
   *
   * @param source Layout to add to the tab, the Layout is responsible for implementing any
   *     interactions by itself
   * @param caption String that the tab should have as its name in the TabSheet
   * @param parent TabSheet to add the new tab to
   */
  private static void createDynamicContentTab(Layout source, String caption, TabSheet parent) {

    GeneralMacros.errorIfContainsNull(source, caption, parent); // Check for null arguments

    source.setCaption(caption);
    source.setMargin(true);
    parent.addTab(source);
  }
  @Override
  protected void setup() {

    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();
    MyCustomComponent mcc = new MyCustomComponent();
    mcc.setSizeUndefined();

    // Doesn't work
    tabs.addTab(mcc, "Doesn't work (CustomComponent)", null);

    // Works:
    tabs.addTab(mcc.buildLayout(), "Works (no CustomComponent, same layout)", null);

    addComponent(tabs);
    getLayout().setSizeFull();
  }
Example #19
0
 /**
  * Receive any contributions.
  *
  * <p>We need to know when to remove the component so we need a map from the factory to the
  * instance so that when the factory is unregistered, we can dispose it.
  *
  * @param factory The DS Component Factory that can make, well, ehh, components.
  */
 @Reference(type = '*', target = "(component.factory=com.vaadin.Component/contribution)")
 protected void setContribution(ComponentFactory factory) {
   ComponentInstance ci = factory.newInstance(null);
   Component c = (Component) ci.getInstance();
   synchronized (this) {
     tabs.addTab(c);
     mapping.put(factory, ci);
   }
 }
 public void locateComponents() {
   sendOrderButton = new Button("Make order");
   for (Menu menu : menuCollection) {
     tabSheet.addTab(addPanelMenu(menu), menu.getCafeName());
   }
   addComponent(tabSheet);
   addComponent(sendOrderButton);
   sendOrderButton.addListener(new SendOrderButtonListener());
 }
  @Override
  protected ComponentContainer createSectionWidget(
      ComponentContainer previousSectionWidget,
      String section,
      Map<String, String> attributes,
      ComponentContainer container,
      VaadinMetawidget metawidget) {

    TabSheet tabSheet;

    // Whole new tabbed pane?

    if (previousSectionWidget == null) {

      tabSheet = new TabSheet();
      tabSheet.setWidth("100%");

      // Add to parent container

      Map<String, String> tabbedPaneAttributes = CollectionUtils.newHashMap();
      tabbedPaneAttributes.put(LABEL, "");
      tabbedPaneAttributes.put(LARGE, TRUE);
      getDelegate().layoutWidget(tabSheet, PROPERTY, tabbedPaneAttributes, container, metawidget);
    } else {
      tabSheet = (TabSheet) previousSectionWidget.getParent();
    }

    // New tab

    Panel tabPanel = new Panel();

    // Tab name (possibly localized)

    String localizedSection = metawidget.getLocalizedKey(StringUtils.camelCase(section));

    if (localizedSection == null) {
      localizedSection = section;
    }

    tabSheet.addTab(tabPanel, localizedSection, null);

    return tabPanel;
  }
Example #22
0
  private void prepareTabs() throws Exception {
    Locale locale = getApplication().getLocale();
    GsonBuilder gb = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
    Gson gson = gb.create();
    Type collectionType = new TypeToken<LinkedHashMap<Integer, String>>() {}.getType();
    TreeMap<Integer, String> tabList = new TreeMap<Integer, String>();
    String metaDataString =
        getPbApplication().getBpmModule().getMetaData("PROCESSBASE_TABSHEETS_LIST");
    if (metaDataString != null) {
      LinkedHashMap<Integer, String> tabs2 = gson.fromJson(metaDataString, collectionType);
      if (!tabs2.isEmpty()) {
        tabList.putAll(tabs2);
      }
    }

    PbPanelModuleService pms = getPbApplication().getPanelModuleService();

    for (Entry<String, PbPanelModule> pm : pms.getModules().entrySet()) {
      System.out.println("moduleName = " + pm.getKey());

      if (pm != null) {
        try {
          PbPanelModule panel = pm.getValue();
          if (CollectionUtils.containsAny(Arrays.asList(panel.getRoles()), accessSet)) {
            tabs.addTab(panel, panel.getTitle(locale), null);
          } else {
            System.out.println("No rights for module = " + pm.getKey());
          }
        } catch (Exception ex) {
          System.out.println("Exception with pm = " + pm.getKey());
          ex.printStackTrace();
          throw new RuntimeException(ex);
        }
      }
    }
    if (tabs.getSelectedTab() != null && tabs.getSelectedTab() instanceof PbPanel) {
      PbPanel first = (PbPanel) tabs.getSelectedTab();
      first.initUI();
      first.setInitialized(true);
      first.setSizeFull();
    }
  }
Example #23
0
 /**
  * The contribution is unregistered.
  *
  * @param factory The component factory.
  */
 protected void unsetContribution(ComponentFactory factory) {
   ComponentInstance ci;
   Component c;
   synchronized (this) {
     ci = mapping.remove(factory);
     c = (Component) ci.getInstance();
     tabs.removeComponent(c);
   }
   c.detach();
   ci.dispose();
 }
  public ServerDesc() {
    setWidth("100%");
    setHeight("100%");
    setCaption(ViewProperties.getCaption("panel.serverDesc"));
    addStyleName(Reindeer.PANEL_LIGHT);
    addStyleName("server-desc-panel");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setMargin(false);
    layout.setSpacing(false);
    layout.addStyleName("server-desc-layout");
    tabDesc.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabDesc.setWidth("100%");
    tabDesc.setHeight("100%");
    tabDesc.addTab(
        serverDescBasic, ViewProperties.getCaption("tab.serverDescBasic"), Icons.BASIC.resource());
    tabDesc.addTab(
        serverDescDetail,
        ViewProperties.getCaption("tab.serverDescDetail"),
        Icons.DETAIL.resource());
    // タブ用リスナー
    tabDesc.addListener(TabSheet.SelectedTabChangeEvent.class, this, "selectedTabChange");
    addComponent(tabDesc);
  }
Example #25
0
  /**
   * Loads a Static tab with {@link #cz.nkp.differ.gui.tabs.TabLoader} and adds it to the given
   * <code>TabSheet</code>
   *
   * @param source String identifying the proper load resource as recognized by <code>TabLoader
   *     </code>
   * @param caption String that the tab should have as its name in the TabSheet
   * @param parent TabSheet to add the new tab to
   */
  private static void createStaticContentTab(String source, String caption, TabSheet parent) {

    GeneralMacros.errorIfContainsNull(source, caption, parent); // Check for null arguments

    try {
      VerticalLayout tab = new TabLoader(source);
      tab.setMargin(true);
      tab.setCaption(caption);
      parent.addTab(tab);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  private void hideTabSheet() {
    if (mainTab == null) {
      mainTab = ui.getMainTab();
    }

    if (mainTab != null) {
      tab = mainTab.getTab(this);

      if (tab != null) {
        tab.setEnabled(false);
      }
    }
  }
  @Override
  public TabSheet createTabs(Object itemId) throws RpcException {
    final TabSheet tabsheet = new TabSheet();
    tabsheet.addSelectedTabChangeListener(this);
    tabsheet.addTab(new GenericForm("pac", session, itemId, "name"), I18N.getText("pac"));
    final HSTab usersTab = new HSTab("user", session, "pac", itemId, "name");
    usersTab.fillTable();
    tabsheet.addTab(usersTab, I18N.getText("user"));
    final HSTab aliasTab = new HSTab("emailalias", session, "pac", itemId, "name");
    tabsheet.addTab(aliasTab, I18N.getText("emailalias"));
    final HSTab domainTab = new HSTab("domain", session, "pac", itemId, "name");
    tabsheet.addTab(domainTab, I18N.getText("domain"));

    final HSTab mysqluserTab = new HSTab("mysqluser", session, "pac", itemId, "name");
    tabsheet.addTab(mysqluserTab, I18N.getText("mysqluser"));
    final HSTab mysqldbTab = new HSTab("mysqldb", session, "pac", itemId, "name");
    tabsheet.addTab(mysqldbTab, I18N.getText("mysqldb"));
    final HSTab postgresqluserTab = new HSTab("postgresqluser", session, "pac", itemId, "name");
    tabsheet.addTab(postgresqluserTab, I18N.getText("postgresqluser"));
    final HSTab postgresqldbTab = new HSTab("postgresqldb", session, "pac", itemId, "name");
    tabsheet.addTab(postgresqldbTab, I18N.getText("postgresqldb"));
    return tabsheet;
  }
Example #28
0
  @AutoGenerated
  private TabSheet buildTabSheet_1() {
    // common part: create layout
    tabSheet_1 = new TabSheet();
    tabSheet_1.setImmediate(true);
    tabSheet_1.setWidth("100.0%");
    tabSheet_1.setHeight("100.0%");

    // parentForm_1
    parentForm_1 = new ParentForm();
    parentForm_1.setImmediate(false);
    parentForm_1.setWidth("100.0%");
    parentForm_1.setHeight("100.0%");
    tabSheet_1.addTab(parentForm_1, "Parents", null);

    // stockPriceForm_1
    stockPriceForm_1 = new StockPriceForm();
    stockPriceForm_1.setImmediate(false);
    stockPriceForm_1.setWidth("100.0%");
    stockPriceForm_1.setHeight("100.0%");
    tabSheet_1.addTab(stockPriceForm_1, "Stock", null);

    return tabSheet_1;
  }
  @Override
  public void init() {
    Window mainWindow = new Window("SplitButton Demo Application");
    setMainWindow(mainWindow);

    setTheme("splitbuttondemo-reindeer");

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainWindow.setContent(mainLayout);

    Label headerLabel = new Label("SplitButton");
    headerLabel.setStyleName(Reindeer.LABEL_H1);
    mainLayout.addComponent(headerLabel);

    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    mainLayout.addComponent(tabSheet);
    mainLayout.setExpandRatio(tabSheet, 1);

    tabSheet.addTab(createChameleonTab(), "Chameleon", null);
    tabSheet.addTab(createReindeerTab(), "Reindeer", null);
  }
Example #30
0
  @Override
  protected void init(VaadinRequest vaadinRequest) {

    TabSheet tabs = new TabSheet();

    tabs.setSizeFull();

    tabs.addTab(new PreJava8Tab(), "Pre-Java 8");
    tabs.addTab(new Java8LambdaTab(), "Lambda Java 8");
    tabs.addTab(new DedicatedComponentTab(), "Dedicated Component");
    tabs.addTab(new EventBusTab(), "Event Bus w/ Java 8");

    setContent(tabs);
  }