Commit 30de91f6 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Managed add/delete from tabbed panel. Added data layer test class. Refactoring.

parent 5f0faffb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@
 */
package it.inaf.oats.ia2.tap.utils;

import it.inaf.oats.ia2.tap.utils.tapschema.Column;
import it.inaf.oats.ia2.tap.utils.tapschema.Schema;
import it.inaf.oats.ia2.tap.utils.tapschema.Table;
import it.inaf.oats.ia2.tap.utils.model.Column;
import it.inaf.oats.ia2.tap.utils.model.Schema;
import it.inaf.oats.ia2.tap.utils.model.Table;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+10 −4
Original line number Diff line number Diff line
package it.inaf.oats.ia2.tap.utils;

import it.inaf.oats.ia2.tap.utils.model.Credentials;
import it.inaf.oats.ia2.tap.utils.model.TapSchema;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.SecurePackageResourceGuard;
import org.apache.wicket.protocol.http.WebApplication;
@@ -42,6 +46,8 @@ public class Application extends WebApplication {
     */
    @Override
    public Class<? extends Page> getHomePage() {
        return CredentialPage.class;
        
        return HomeTest.class;
        //return CredentialPage.class;
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -113,20 +113,20 @@ public abstract class BasePage extends WebPage {
        response.render(JavaScriptHeaderItem.forReference(MAIN_REF));
    }

    protected void addInfo(String message) {
    public void addInfo(String message) {
        alerts.add(new Alert(message, AlertType.INFO));
    }

    protected void addInfo(String message, AjaxRequestTarget target) {
    public void addInfo(String message, AjaxRequestTarget target) {
        addInfo(message);
        target.add(alertPanel);
    }

    protected void addError(String message) {
    public void addError(String message) {
        alerts.add(new Alert(message, AlertType.ERROR));
    }

    protected void addError(String message, AjaxRequestTarget target) {
    public void addError(String message, AjaxRequestTarget target) {
        addError(message);
        target.add(alertPanel);
    }
+43 −0
Original line number Diff line number Diff line
package it.inaf.oats.ia2.tap.utils;

import it.inaf.oats.ia2.tap.utils.panel.SchemaPanel;
import it.inaf.oats.ia2.tap.utils.model.IDbEntity;
import it.inaf.oats.ia2.tap.utils.model.Schema;
import it.inaf.oats.ia2.tap.utils.model.Status;
import it.inaf.oats.ia2.tap.utils.model.Table;
import it.inaf.oats.ia2.tap.utils.panel.TablePanel;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;

/**
 * 
 *
 * @author pietro
 */
public class DbEntityTab extends AbstractTab {

    private final Panel panel;
    private final IDbEntity dbEntity;

    public DbEntityTab(SchemaPage schemaPage, String panelId, Schema schema) {
        super(new Model<String>(schema.getName()));
        this.dbEntity = schema;
        panel = new SchemaPanel(schemaPage, panelId, schema);
    }
    
    public DbEntityTab(SchemaPage schemaPage, String panelId, Table table) {
        super(new Model<String>(table.getName()));
        this.dbEntity = table;
        panel = new TablePanel(schemaPage, panelId, table);
    }

    @Override
    public Panel getPanel(String panelId) {
        return panel;
    }
    
    public Status getStatus() {
        return dbEntity.getStatus();
    }
}
+0 −12
Original line number Diff line number Diff line
<!DOCTYPE html> 
<html xmlns:wicket="http://wicket.apache.org">
    <head> 
        <meta charset="UTF-8"> 
        <meta name="description" content="Put your description here!" /> 
    </head> 
    <body>
    <wicket:panel>
        <span wicket:id="footerpanel_text">This gets replaced</span>
    </wicket:panel>
</body>
</html>
Loading